split/rename options, bundle vendor settings

This commit is contained in:
Vinzenz Schroeter 2023-09-24 10:46:15 +02:00
parent 1b7989336e
commit 3a9a7242fc
18 changed files with 109 additions and 54 deletions

View file

@ -2,7 +2,7 @@
imports = [ imports = [
(import ./modules { (import ./modules {
hostName = "hetzner-vpn1"; hostName = "hetzner-vpn1";
enableDesktop = false; enableHomeManager = false;
}) })
]; ];

View file

@ -3,6 +3,7 @@ modulesCfg: {lib, ...}: {
[ [
./i18n.nix ./i18n.nix
./nixpkgs.nix ./nixpkgs.nix
./globalinstalls.nix
./server.nix ./server.nix
] ]
++ (map (path: (import path modulesCfg)) [ ++ (map (path: (import path modulesCfg)) [

View file

@ -4,28 +4,24 @@ modulesCfg: {
lib, lib,
... ...
}: let }: let
isEnabled = modulesCfg.enableDesktop; enableHomeManager = modulesCfg.enableHomeManager;
cfg = config.my.desktop; cfg = config.my.desktop;
in { in {
imports = lib.optionals isEnabled [ imports =
<home-manager/nixos> [
./gnome.nix ./gnome.nix
./kde.nix ./kde.nix
./vinzenz.nix ./vinzenz.nix
./ronja.nix ./ronja.nix
./gaming.nix ./gaming.nix
]; ]
++ lib.optionals enableHomeManager [
<home-manager/nixos>
];
options.my.modulesCfg.enableDesktop = lib.mkEnableOption "enable desktop module"; options.my.modulesCfg.enableHomeManager = lib.mkEnableOption "enable home manager";
options.my.desktop = { options.my.desktop.enable = lib.mkEnableOption "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";
};
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
@ -114,8 +110,6 @@ in {
systemPackages = with pkgs; [ systemPackages = with pkgs; [
lm_sensors lm_sensors
tldr
ncdu
]; ];
}; };

View file

@ -4,10 +4,13 @@
lib, lib,
... ...
}: let }: let
cfg = config.my.desktop.gaming; isEnabled = config.my.desktop.enableGaming;
in { in {
imports = []; imports = [];
config = lib.mkIf cfg.enable {
options.my.desktop.enableGaming = lib.mkEnableOption "gaming with wine";
config = lib.mkIf isEnabled {
hardware.opengl.driSupport32Bit = true; hardware.opengl.driSupport32Bit = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [

View file

@ -5,7 +5,7 @@
... ...
}: let }: let
desktopCfg = config.my.desktop; desktopCfg = config.my.desktop;
cfg = desktopCfg.gnome; isEnabled = desktopCfg.enableGnome;
applyGnomeUserSettings = { applyGnomeUserSettings = {
home.packages = with pkgs; [ home.packages = with pkgs; [
@ -19,7 +19,9 @@
}; };
}; };
in { in {
config = lib.mkIf cfg.enable { options.my.desktop.enableGnome = lib.mkEnableOption "gnome desktop";
config = lib.mkIf isEnabled {
my.desktop.enable = true; my.desktop.enable = true;
services = { services = {

View file

@ -5,7 +5,7 @@
... ...
}: let }: let
desktopCfg = config.my.desktop; desktopCfg = config.my.desktop;
cfg = desktopCfg.kde; isEnabled = desktopCfg.enableKde;
applyKdeUserSettings = { applyKdeUserSettings = {
home = { home = {
@ -18,7 +18,9 @@
}; };
}; };
in { in {
config = lib.mkIf cfg.enable { options.my.desktop.enableKde = lib.mkEnableOption "KDE desktop";
config = lib.mkIf isEnabled {
my.desktop.enable = true; my.desktop.enable = true;
# flatpak xdg-portal-kde crashes, otherwise this would be global # flatpak xdg-portal-kde crashes, otherwise this would be global

View file

@ -7,6 +7,8 @@
with lib; let with lib; let
cfg = config.my.desktop.ronja; cfg = config.my.desktop.ronja;
in { in {
options.my.desktop.ronja.enable = lib.mkEnableOption "user ronja";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# Define user account # Define user account
users.users.ronja = { users.users.ronja = {

View file

@ -6,6 +6,8 @@
}: let }: let
cfg = config.my.desktop.vinzenz; cfg = config.my.desktop.vinzenz;
in { in {
options.my.desktop.vinzenz.enable = lib.mkEnableOption "user vinzenz";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# Define user account # Define user account
users.users.vinzenz = { users.users.vinzenz = {

View file

@ -0,0 +1,10 @@
{pkgs, ...}: {
config = {
environment.systemPackages = with pkgs; [
pciutils
ncdu
htop
tldr
];
};
}

View file

@ -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;
};
}

View file

@ -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
];
};
}

View file

@ -9,6 +9,9 @@ in {
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
(builtins.toString ./. + "/${hostName}.nix") (builtins.toString ./. + "/${hostName}.nix")
./common-desktop.nix ./common-desktop.nix
./amdcpu.nix
./amdgpu.nix
./intelcpu.nix
]; ];
options.my.modulesCfg.hostName = lib.mkOption { options.my.modulesCfg.hostName = lib.mkOption {

View file

@ -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;
};
}

View file

@ -1,12 +1,13 @@
{...}: { {...}: {
config = { config = {
my.hardware.enableCommonDesktopSettings = true; my.hardware = {
enableCommonDesktopSettings = true;
isIntelCpu = true;
isAmdGpu = true;
};
boot = { boot = {
initrd.availableKernelModules = ["xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci"]; 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"; loader.efi.efiSysMountPoint = "/boot/efi";
}; };
@ -26,7 +27,5 @@
swapDevices = [ swapDevices = [
{device = "/dev/disk/by-uuid/f5932f70-60e4-4abe-b23d-2cab3c095c7d";} {device = "/dev/disk/by-uuid/f5932f70-60e4-4abe-b23d-2cab3c095c7d";}
]; ];
hardware.cpu.intel.updateMicrocode = true;
}; };
} }

View file

@ -1,12 +1,13 @@
{...}: { {...}: {
config = { config = {
my.hardware.enableCommonDesktopSettings = true; my.hardware = {
enableCommonDesktopSettings = true;
isAmdCpu = true;
isAmdGpu = true;
};
boot = { boot = {
initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod"]; # "usb_storage" initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod"]; # "usb_storage"
initrd.kernelModules = [];
kernelModules = ["kvm-amd"];
extraModulePackages = [];
loader.efi.efiSysMountPoint = "/boot"; loader.efi.efiSysMountPoint = "/boot";
}; };
@ -49,7 +50,5 @@
}; };
swapDevices = []; swapDevices = [];
hardware.cpu.amd.updateMicrocode = true;
}; };
} }

View file

@ -38,12 +38,5 @@ in {
} }
]; ];
}; };
environment = {
systemPackages = with pkgs; [
ncdu
htop
];
};
}; };
} }

View file

@ -2,15 +2,16 @@
imports = [ imports = [
(import ./modules { (import ./modules {
hostName = "vinzenz-lpt"; hostName = "vinzenz-lpt";
enableDesktop = true; enableHomeManager = true;
}) })
]; ];
config = { config = {
my.desktop = { my.desktop = {
gnome.enable = true; enableGnome = true;
enableGaming = true;
vinzenz.enable = true; vinzenz.enable = true;
gaming.enable = true;
}; };
# flatpak xdg-portal-kde crashes, otherwise this would be global # flatpak xdg-portal-kde crashes, otherwise this would be global

View file

@ -2,20 +2,19 @@
imports = [ imports = [
(import ./modules { (import ./modules {
hostName = "vinzenz-pc2"; hostName = "vinzenz-pc2";
enableDesktop = true; enableHomeManager = true;
}) })
]; ];
config = { config = {
my.desktop = { my.desktop = {
kde.enable = true; enableKde = true;
enableGaming = true;
vinzenz.enable = true; vinzenz.enable = true;
ronja.enable = true; ronja.enable = true;
gaming.enable = true;
}; };
environment.systemPackages = [pkgs.radeontop];
users.groups."games" = { users.groups."games" = {
members = ["vinzenz" "ronja"]; members = ["vinzenz" "ronja"];
}; };