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 = [
(import ./modules {
hostName = "hetzner-vpn1";
enableDesktop = false;
enableHomeManager = false;
})
];

View file

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

View file

@ -4,28 +4,24 @@ modulesCfg: {
lib,
...
}: let
isEnabled = modulesCfg.enableDesktop;
enableHomeManager = modulesCfg.enableHomeManager;
cfg = config.my.desktop;
in {
imports = lib.optionals isEnabled [
<home-manager/nixos>
./gnome.nix
./kde.nix
./vinzenz.nix
./ronja.nix
./gaming.nix
];
imports =
[
./gnome.nix
./kde.nix
./vinzenz.nix
./ronja.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 = {
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
];
};

View file

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

View file

@ -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 = {

View file

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

View file

@ -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 = {

View file

@ -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 = {

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")
(builtins.toString ./. + "/${hostName}.nix")
./common-desktop.nix
./amdcpu.nix
./amdgpu.nix
./intelcpu.nix
];
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 = {
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;
};
}

View file

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

View file

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

View file

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

View file

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