Minimal hyprland config

This commit is contained in:
LarsZauberer 2024-04-12 15:53:06 +02:00
commit 0df4d4ab32
6 changed files with 91 additions and 18 deletions

View file

@ -28,5 +28,10 @@
url = "github:nix-community/fenix"; url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
hyprland = {
url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
} }

View file

@ -1,21 +1,76 @@
{ config, inputs, pkgs, ... }: { config, lib, inputs, pkgs, ... }:
let with lib; let
username = config.myOptions.other.system.username; username = config.myOptions.other.system.username;
cfg = config.myOptions.hyprland;
in { in {
options.myOptions.hyprland.nvidia.enable = mkEnableOption "nvidia";
options.myOptions.hyprland.enable = mkEnableOption "hyprland";
config = mkIf cfg.enable {
environment.sessionVariables = mkIf cfg.nvidia.enable {
LIBVA_DRIVER_NAME = "nvidia";
XDG_SESSION_TYPE = "wayland";
GBM_BACKEND = "nvidia-drm";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
WLR_NO_HARDWARE_CURSORS = "1";
SDL_VIDEODRIVER = "wayland";
_JAVA_AWT_WM_NONREPARENTING = "1";
CLUTTER_BACKEND = "wayland";
WLR_RENDERER = "vulkan";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_DESKTOP = "Hyprland";
GTK_USE_PORTAL = "1";
NIXOS_XDG_OPEN_USE_PORTAL = "1";
};
programs.hyprland = { programs.hyprland = {
enable = true; enable = true;
xwayland.enable = true; xwayland.enable = true;
}; };
xdg.portal.wlr.enable = true;
xdg.portal.lxqt.enable = false;
systemd.user.services.xdg-desktop-portal-gnome.enable = false;
wayland.windowManager.hyprland = { home-manager.users.${username} = {
enable = true; wayland.windowManager.hyprland = {
settings = { enable = true;
"$mod" = "SUPER"; settings = {
bind = [ "$mod" = "SUPER";
"$mod, Q, killactive"
"$mod, return, kitty" monitor = [
"$mod SHIFT, return, firefox" "DP-2,2560x1440@144,0x0,1"
]; "DP-1,1920x1080@60,2560x0,1"
];
input = {
kb_layout = "ch";
};
bind = [
"$mod, Q, killactive"
"$mod, return, exec, alacritty"
"$mod SHIFT, return, exec, firefox"
# Monitor management
"$mod SHIFT, k, movecurrentworkspacetomonitor, DP-2"
"$mod SHIFT, j, movecurrentworkspacetomonitor, DP-1"
]
++ (
builtins.concatLists (builtins.genList (
x: let
ws = let
c = (x + 1) / 10;
in
builtins.toString (x+1-(c * 10));
in [
"$mod, ${ws}, workspace, ${toString (x+1)}"
"$mod SHIFT, ${ws}, movetoworkspace, ${toString(x + 1)}"
]
)
10)
);
};
};
}; };
}; };
} }

View file

@ -7,5 +7,11 @@
username = "lars"; username = "lars";
}; };
}; };
hyprland = {
enable = true;
nvidia.enable = true;
};
}; };
services.getty.autologinUser = "lars";
} }

View file

@ -1,6 +1,12 @@
_: { _: {
imports = [ imports = [
../. ../.
./../programs.nix
./../hyprland.nix
./programs.nix
./configuration.nix
./hardware-configuration.nix
./profile.nix
./configuration.nix ./configuration.nix
./programs.nix ./programs.nix
./hardware-configuration.nix ./hardware-configuration.nix

View file

@ -8,18 +8,18 @@
[ (modulesPath + "/installer/scan/not-detected.nix") [ (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
{ device = "/dev/disk/by-uuid/bca69c91-6f66-4b21-b90e-15b4bc21a405"; { device = "/dev/disk/by-uuid/4d68fd1c-bfcf-44b8-b9a2-c27be0a4f4c3";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/8683-FD07"; { device = "/dev/disk/by-uuid/0461-D6B4";
fsType = "vfat"; fsType = "vfat";
}; };
@ -30,8 +30,9 @@
# still possible to use this option, but it's recommended to use it in conjunction # still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true; networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp1s0f0.useDHCP = lib.mkDefault true; # networking.interfaces.enp6s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; # networking.interfaces.enp7s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;

View file

@ -3,7 +3,7 @@ _: {
../../../options/boot/grub-boot.nix ../../../options/boot/grub-boot.nix
../../../options/desktop/fonts.nix ../../../options/desktop/fonts.nix
../../../options/common/networking.nix ../../../options/common/networking.nix
../../options/common/gpu/nvidia.nix ../../../options/common/gpu/nvidia.nix
../../../options/common/pin-registry.nix ../../../options/common/pin-registry.nix
../../../options/common/preserve-system.nix ../../../options/common/preserve-system.nix
]; ];