{ nixpkgs, nixpkgs-unstable, nixos-hardware, agenix, home-manager, lix-module, authentik-nix, self, ... }: let agenixOverlay = final: prev: { agenix = agenix.packages.${prev.system}.default; }; customOverlays = (final: prev: { }); mkPkgs = nixpkgsSrc: system: import nixpkgsSrc { inherit system; overlays = [ agenixOverlay customOverlays ]; config.allowUnfree = true; config.permittedInsecurePackages = [ "mbedtls-2.28.10" # Required by shadowsocks-libev ]; }; # Helper function to create a Proxmox LXC host mkLXC = { hostModule, unstable ? false, system ? "x86_64-linux", extraModules ? [ ], specialArgs ? { }, }: let nixpkgsSrc = if unstable then nixpkgs-unstable else nixpkgs; in nixpkgsSrc.lib.nixosSystem { pkgs = mkPkgs nixpkgsSrc system; modules = [ # Base modules for all hosts authentik-nix.nixosModules.default ../modules # Proxmox LXC support "${nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix" ../modules/virtualisation/proxmox.nix # Agenix for secrets agenix.nixosModules.default # Home Manager home-manager.nixosModules.home-manager # Host-specific module hostModule ] ++ extraModules; inherit specialArgs; }; # Import the unified host definitions hostDefs = import ./hosts.nix; # Generate nixosConfigurations from host definitions lxcHosts = nixpkgs.lib.mapAttrs ( name: cfg: mkLXC { hostModule = cfg.module; unstable = cfg.unstable or false; extraModules = cfg.extraModules or [ ]; specialArgs = { inherit authentik-nix; } // (cfg.specialArgs or { }); } ) hostDefs; in lxcHosts // { # Special hosts that don't use mkLXC pattern baseLXC = mkLXC { hostModule = ./base-lxc.nix; specialArgs = { inherit self; }; }; # deadbeef = nixpkgs.lib.nixosSystem { # pkgs = mkPkgs nixpkgs "x86_64-linux"; # modules = [ # ./deadbeef # nixos-hardware.nixosModules.dell-xps-15-9560 # home-manager.nixosModules.home-manager # agenix.nixosModules.default # ]; # }; }