refactor: automatic options for overlays, fix build

This commit is contained in:
müde 2026-05-01 23:06:26 +02:00
parent 850d673035
commit 281d763c62
7 changed files with 72 additions and 46 deletions

View file

@ -18,6 +18,7 @@
./modern-desktop.nix
./muede-desktop-settings.nix
./nix-ld.nix
./nixpkgs-overlays.nix
./openssh.nix
./podman.nix
./printing.nix

View file

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

View file

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