From 281d763c6261535863e287cb01b348af56678433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Fri, 1 May 2026 23:06:26 +0200 Subject: [PATCH] refactor: automatic options for overlays, fix build --- flake.nix | 52 +++++++++---------- nixosConfigurations/aur0ra/hardware.nix | 8 ++- .../damocles/claude-container.nix | 3 +- nixosConfigurations/epimetheus/default.nix | 9 +++- nixosModules/default.nix | 1 + nixosModules/nixpkgs-overlays.nix | 33 ++++++++++++ nixosModules/pxvirt-guest.nix | 12 ----- 7 files changed, 72 insertions(+), 46 deletions(-) create mode 100644 nixosModules/nixpkgs-overlays.nix diff --git a/flake.nix b/flake.nix index 8cacd37..f76fe57 100644 --- a/flake.nix +++ b/flake.nix @@ -146,12 +146,13 @@ in { overlays = { - unstable-packages = final: prev: { + unstable = final: prev: { unstable = import nixpkgs-unstable { localSystem = prev.stdenv.hostPlatform; inherit (prev) config; }; }; + vscodeExtensions = nix-vscode-extensions.overlays.default; }; nixosModules = (importModuleDir ./nixosModules) // { @@ -170,12 +171,6 @@ }; }; }; - pkgs-unstable = { - nixpkgs.overlays = [ self.overlays.unstable-packages ]; - }; - pkgs-vscode-extensions = { - nixpkgs.overlays = [ nix-vscode-extensions.overlays.default ]; - }; }; homeModules = importModuleDir ./homeModules; @@ -208,7 +203,6 @@ lanzaboote.nixosModules.lanzaboote nova-shell.nixosModules.default self.nixosModules.niri - self.nixosModules.pkgs-vscode-extensions servicepoint-cli.nixosModules.default servicepoint-simulator.nixosModules.default servicepoint-tanks.nixosModules.default @@ -233,15 +227,19 @@ doc.enable = false; }; - my.autoupdate.enable = true; - my.distributedBuilds.enable = true; - my.extraCaches.enable = true; - my.globalinstalls.enable = true; - my.lixIsNix.enable = true; - my.openssh.enable = true; - my.prometheusNode.enable = true; - my.systemdBoot.enable = true; - my.tailscale.enable = true; + my = { + autoupdate.enable = true; + distributedBuilds.enable = true; + overlays.unstable.enable = true; + overlays.vscodeExtensions.enable = true; + extraCaches.enable = true; + globalinstalls.enable = true; + lixIsNix.enable = true; + openssh.enable = true; + prometheusNode.enable = true; + systemdBoot.enable = true; + tailscale.enable = true; + }; } ] ++ lib.optionals (home-manager-users != { }) [ @@ -272,15 +270,17 @@ daemonIOSchedClass = "idle"; }; - my.enDe.enable = true; - my.firmwareUpdates.enable = true; - my.gnome.enable = true; - my.kdeconnect.enable = true; - my.modernDesktop.enable = true; - my.niri.enable = true; - my.nixLd.enable = true; - my.quietBoot.enable = true; - my.stylix.enable = true; + my = { + enDe.enable = true; + firmwareUpdates.enable = true; + gnome.enable = true; + kdeconnect.enable = true; + modernDesktop.enable = true; + niri.enable = true; + nixLd.enable = true; + quietBoot.enable = true; + stylix.enable = true; + }; } ]; } diff --git a/nixosConfigurations/aur0ra/hardware.nix b/nixosConfigurations/aur0ra/hardware.nix index 8014f41..8642f79 100644 --- a/nixosConfigurations/aur0ra/hardware.nix +++ b/nixosConfigurations/aur0ra/hardware.nix @@ -10,11 +10,9 @@ # No one got time for xz compression. #isoImage.squashfsCompression = "zstd"; - boot.loader = { - raspberry-pi.bootloader = "kernel"; - systemd-boot.enable = lib.mkForce false; - #generic-extlinux-compatible.enable = lib.mkForce false; - }; + boot.loader.raspberry-pi.bootloader = "kernel"; + + my.systemdBoot.enable = lib.mkForce false; /* fileSystems = { diff --git a/nixosConfigurations/damocles/claude-container.nix b/nixosConfigurations/damocles/claude-container.nix index 17d599f..c568243 100644 --- a/nixosConfigurations/damocles/claude-container.nix +++ b/nixosConfigurations/damocles/claude-container.nix @@ -1,12 +1,11 @@ { pkgs, - self, lib, ... }: { - nixpkgs.overlays = [ self.overlays.unstable-packages ]; + my.overlays.unstable.enable = true; allowedUnfreePackages = [ "claude-code" ]; environment.systemPackages = with pkgs; [ diff --git a/nixosConfigurations/epimetheus/default.nix b/nixosConfigurations/epimetheus/default.nix index bff9b14..19b6219 100644 --- a/nixosConfigurations/epimetheus/default.nix +++ b/nixosConfigurations/epimetheus/default.nix @@ -1,6 +1,13 @@ -{ ... }: +{ modulesPath, ... }: { + imports = [ (modulesPath + "/virtualisation/proxmox-lxc.nix") ]; + config = { my.pxvirtGuest.enable = true; + + proxmoxLXC = { + manageNetwork = false; + privileged = false; + }; }; } diff --git a/nixosModules/default.nix b/nixosModules/default.nix index 621cca7..46dbbd7 100644 --- a/nixosModules/default.nix +++ b/nixosModules/default.nix @@ -18,6 +18,7 @@ ./modern-desktop.nix ./muede-desktop-settings.nix ./nix-ld.nix + ./nixpkgs-overlays.nix ./openssh.nix ./podman.nix ./printing.nix diff --git a/nixosModules/nixpkgs-overlays.nix b/nixosModules/nixpkgs-overlays.nix new file mode 100644 index 0000000..7a657b1 --- /dev/null +++ b/nixosModules/nixpkgs-overlays.nix @@ -0,0 +1,33 @@ +{ + lib, + config, + self, + ... +}: +{ + options.my.overlays = { + enableAll = lib.mkEnableOption "all nixpkgs overlays"; + } + // lib.mapAttrs (_: _: { + enable = lib.mkOption { + type = lib.types.bool; + default = false; + }; + }) self.overlays; + + config = lib.mkMerge ( + [ + { + my.overlays = lib.mapAttrs (_: _: { + enable = lib.mkDefault config.my.overlays.enableAll; + }) self.overlays; + } + ] + ++ lib.mapAttrsToList ( + name: overlay: + lib.mkIf config.my.overlays.${name}.enable { + nixpkgs.overlays = [ overlay ]; + } + ) self.overlays + ); +} diff --git a/nixosModules/pxvirt-guest.nix b/nixosModules/pxvirt-guest.nix index 4a66ff2..a70266a 100644 --- a/nixosModules/pxvirt-guest.nix +++ b/nixosModules/pxvirt-guest.nix @@ -1,24 +1,12 @@ { - modulesPath, lib, config, ... }: { - # Import unconditionally — the module only defines options, activating nothing by default. - imports = [ (modulesPath + "/virtualisation/proxmox-lxc.nix") ]; - options.my.pxvirtGuest.enable = lib.mkEnableOption "Proxmox LXC guest configuration"; config = lib.mkIf config.my.pxvirtGuest.enable { - # TODO is this needed? - # nix.settings.sandbox = false; - - proxmoxLXC = { - manageNetwork = false; - privileged = false; - }; - # Let Proxmox host handle fstrim services.fstrim.enable = false;