diff --git a/hetzner-vpn1.nix b/hetzner-vpn1.nix index 2c2f712..5aaf7ce 100644 --- a/hetzner-vpn1.nix +++ b/hetzner-vpn1.nix @@ -2,7 +2,7 @@ imports = [ (import ./modules { hostName = "hetzner-vpn1"; - enableDesktop = false; + enableHomeManager = false; }) ]; diff --git a/modules/default.nix b/modules/default.nix index 199fa07..0585543 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -3,6 +3,7 @@ modulesCfg: {lib, ...}: { [ ./i18n.nix ./nixpkgs.nix + ./globalinstalls.nix ./server.nix ] ++ (map (path: (import path modulesCfg)) [ diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index ea268fc..6d9ed44 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -4,28 +4,24 @@ modulesCfg: { lib, ... }: let - isEnabled = modulesCfg.enableDesktop; + enableHomeManager = modulesCfg.enableHomeManager; cfg = config.my.desktop; in { - imports = lib.optionals isEnabled [ - - ./gnome.nix - ./kde.nix - ./vinzenz.nix - ./ronja.nix - ./gaming.nix - ]; + imports = + [ + ./gnome.nix + ./kde.nix + ./vinzenz.nix + ./ronja.nix + ./gaming.nix + ] + ++ lib.optionals enableHomeManager [ + + ]; - options.my.modulesCfg.enableDesktop = lib.mkEnableOption "enable desktop module"; + options.my.modulesCfg.enableHomeManager = lib.mkEnableOption "enable home manager"; - options.my.desktop = { - enable = lib.mkEnableOption "desktop"; - gnome.enable = lib.mkEnableOption "gnome desktop"; - kde.enable = lib.mkEnableOption "KDE desktop"; - ronja.enable = lib.mkEnableOption "user ronja"; - vinzenz.enable = lib.mkEnableOption "user vinzenz"; - gaming.enable = lib.mkEnableOption "gaming with wine"; - }; + options.my.desktop.enable = lib.mkEnableOption "desktop"; config = lib.mkIf cfg.enable { home-manager.useUserPackages = true; @@ -114,8 +110,6 @@ in { systemPackages = with pkgs; [ lm_sensors - tldr - ncdu ]; }; diff --git a/modules/desktop/gaming.nix b/modules/desktop/gaming.nix index 81382f7..8b9cd34 100644 --- a/modules/desktop/gaming.nix +++ b/modules/desktop/gaming.nix @@ -4,10 +4,13 @@ lib, ... }: let - cfg = config.my.desktop.gaming; + isEnabled = config.my.desktop.enableGaming; in { imports = []; - config = lib.mkIf cfg.enable { + + options.my.desktop.enableGaming = lib.mkEnableOption "gaming with wine"; + + config = lib.mkIf isEnabled { hardware.opengl.driSupport32Bit = true; environment.systemPackages = with pkgs; [ diff --git a/modules/desktop/gnome.nix b/modules/desktop/gnome.nix index 2e406a4..4a39991 100644 --- a/modules/desktop/gnome.nix +++ b/modules/desktop/gnome.nix @@ -5,7 +5,7 @@ ... }: let desktopCfg = config.my.desktop; - cfg = desktopCfg.gnome; + isEnabled = desktopCfg.enableGnome; applyGnomeUserSettings = { home.packages = with pkgs; [ @@ -19,7 +19,9 @@ }; }; in { - config = lib.mkIf cfg.enable { + options.my.desktop.enableGnome = lib.mkEnableOption "gnome desktop"; + + config = lib.mkIf isEnabled { my.desktop.enable = true; services = { diff --git a/modules/desktop/kde.nix b/modules/desktop/kde.nix index caa0ab3..ed07670 100644 --- a/modules/desktop/kde.nix +++ b/modules/desktop/kde.nix @@ -5,7 +5,7 @@ ... }: let desktopCfg = config.my.desktop; - cfg = desktopCfg.kde; + isEnabled = desktopCfg.enableKde; applyKdeUserSettings = { home = { @@ -18,7 +18,9 @@ }; }; in { - config = lib.mkIf cfg.enable { + options.my.desktop.enableKde = lib.mkEnableOption "KDE desktop"; + + config = lib.mkIf isEnabled { my.desktop.enable = true; # flatpak xdg-portal-kde crashes, otherwise this would be global diff --git a/modules/desktop/ronja.nix b/modules/desktop/ronja.nix index ef5e71c..151b013 100644 --- a/modules/desktop/ronja.nix +++ b/modules/desktop/ronja.nix @@ -7,6 +7,8 @@ with lib; let cfg = config.my.desktop.ronja; in { + options.my.desktop.ronja.enable = lib.mkEnableOption "user ronja"; + config = lib.mkIf cfg.enable { # Define user account users.users.ronja = { diff --git a/modules/desktop/vinzenz.nix b/modules/desktop/vinzenz.nix index 2a19d6f..8a6dccf 100644 --- a/modules/desktop/vinzenz.nix +++ b/modules/desktop/vinzenz.nix @@ -6,6 +6,8 @@ }: let cfg = config.my.desktop.vinzenz; in { + options.my.desktop.vinzenz.enable = lib.mkEnableOption "user vinzenz"; + config = lib.mkIf cfg.enable { # Define user account users.users.vinzenz = { diff --git a/modules/globalinstalls.nix b/modules/globalinstalls.nix new file mode 100644 index 0000000..dd60577 --- /dev/null +++ b/modules/globalinstalls.nix @@ -0,0 +1,10 @@ +{pkgs, ...}: { + config = { + environment.systemPackages = with pkgs; [ + pciutils + ncdu + htop + tldr + ]; + }; +} diff --git a/modules/hardware/amdcpu.nix b/modules/hardware/amdcpu.nix new file mode 100644 index 0000000..6eedbb1 --- /dev/null +++ b/modules/hardware/amdcpu.nix @@ -0,0 +1,15 @@ +{ + lib, + config, + pkgs, + ... +}: let + isEnabled = config.my.hardware.isAmdCpu; +in { + options.my.hardware.isAmdCpu = lib.mkEnableOption "amd cpu"; + + config = lib.mkIf isEnabled { + boot.kernelModules = ["kvm-amd"]; + hardware.cpu.amd.updateMicrocode = true; + }; +} diff --git a/modules/hardware/amdgpu.nix b/modules/hardware/amdgpu.nix new file mode 100644 index 0000000..5c847ae --- /dev/null +++ b/modules/hardware/amdgpu.nix @@ -0,0 +1,16 @@ +{ + lib, + config, + pkgs, + ... +}: let + isEnabled = config.my.hardware.isAmdGpu; +in { + options.my.hardware.isAmdGpu = lib.mkEnableOption "amd gpu"; + + config = lib.mkIf isEnabled { + environment.systemPackages = with pkgs; [ + radeontop + ]; + }; +} diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix index 5e4911e..a6dfabc 100644 --- a/modules/hardware/default.nix +++ b/modules/hardware/default.nix @@ -9,6 +9,9 @@ in { (modulesPath + "/installer/scan/not-detected.nix") (builtins.toString ./. + "/${hostName}.nix") ./common-desktop.nix + ./amdcpu.nix + ./amdgpu.nix + ./intelcpu.nix ]; options.my.modulesCfg.hostName = lib.mkOption { diff --git a/modules/hardware/intelcpu.nix b/modules/hardware/intelcpu.nix new file mode 100644 index 0000000..e9d5ba8 --- /dev/null +++ b/modules/hardware/intelcpu.nix @@ -0,0 +1,14 @@ +{ + lib, + config, + ... +}: let + isEnabled = config.my.hardware.isIntelCpu; +in { + options.my.hardware.isIntelCpu = lib.mkEnableOption "intel cpu"; + + config = lib.mkIf isEnabled { + boot.kernelModules = ["kvm-intel"]; + hardware.cpu.intel.updateMicrocode = true; + }; +} diff --git a/modules/hardware/vinzenz-lpt.nix b/modules/hardware/vinzenz-lpt.nix index 152d804..bec7a08 100644 --- a/modules/hardware/vinzenz-lpt.nix +++ b/modules/hardware/vinzenz-lpt.nix @@ -1,12 +1,13 @@ {...}: { config = { - my.hardware.enableCommonDesktopSettings = true; + my.hardware = { + enableCommonDesktopSettings = true; + isIntelCpu = true; + isAmdGpu = true; + }; boot = { initrd.availableKernelModules = ["xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci"]; - initrd.kernelModules = []; - kernelModules = ["kvm-intel"]; - extraModulePackages = []; loader.efi.efiSysMountPoint = "/boot/efi"; }; @@ -26,7 +27,5 @@ swapDevices = [ {device = "/dev/disk/by-uuid/f5932f70-60e4-4abe-b23d-2cab3c095c7d";} ]; - - hardware.cpu.intel.updateMicrocode = true; }; } diff --git a/modules/hardware/vinzenz-pc2.nix b/modules/hardware/vinzenz-pc2.nix index ccd65c6..9fdaca7 100644 --- a/modules/hardware/vinzenz-pc2.nix +++ b/modules/hardware/vinzenz-pc2.nix @@ -1,12 +1,13 @@ {...}: { config = { - my.hardware.enableCommonDesktopSettings = true; + my.hardware = { + enableCommonDesktopSettings = true; + isAmdCpu = true; + isAmdGpu = true; + }; boot = { initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod"]; # "usb_storage" - initrd.kernelModules = []; - kernelModules = ["kvm-amd"]; - extraModulePackages = []; loader.efi.efiSysMountPoint = "/boot"; }; @@ -49,7 +50,5 @@ }; swapDevices = []; - - hardware.cpu.amd.updateMicrocode = true; }; } diff --git a/modules/server.nix b/modules/server.nix index f5bf2f5..46dffb4 100644 --- a/modules/server.nix +++ b/modules/server.nix @@ -38,12 +38,5 @@ in { } ]; }; - - environment = { - systemPackages = with pkgs; [ - ncdu - htop - ]; - }; }; } diff --git a/vinzenz-lpt.nix b/vinzenz-lpt.nix index f2e0586..a12faee 100644 --- a/vinzenz-lpt.nix +++ b/vinzenz-lpt.nix @@ -2,15 +2,16 @@ imports = [ (import ./modules { hostName = "vinzenz-lpt"; - enableDesktop = true; + enableHomeManager = true; }) ]; config = { my.desktop = { - gnome.enable = true; + enableGnome = true; + enableGaming = true; + vinzenz.enable = true; - gaming.enable = true; }; # flatpak xdg-portal-kde crashes, otherwise this would be global diff --git a/vinzenz-pc2.nix b/vinzenz-pc2.nix index 1d6243b..668b4b8 100644 --- a/vinzenz-pc2.nix +++ b/vinzenz-pc2.nix @@ -2,20 +2,19 @@ imports = [ (import ./modules { hostName = "vinzenz-pc2"; - enableDesktop = true; + enableHomeManager = true; }) ]; config = { my.desktop = { - kde.enable = true; + enableKde = true; + enableGaming = true; + vinzenz.enable = true; ronja.enable = true; - gaming.enable = true; }; - environment.systemPackages = [pkgs.radeontop]; - users.groups."games" = { members = ["vinzenz" "ronja"]; };