let sources = import ./npins; mkConfiguration = _hostName: { channel, module, ... }: let nixpkgsPath = sources.${channel}.outPath; in import "${nixpkgsPath}/nixos/lib/eval-config.nix" { modules = [ module ]; specialArgs = { inherit sources nixpkgsPath; configurationPath = module; }; }; mkConfigurations = selectModule: hostDefs: builtins.mapAttrs ( hostName: hostDef: mkConfiguration hostName (hostDef // { module = selectModule hostDef; }) ) hostDefs; mkSystems = builtins.mapAttrs (_: configuration: configuration.config.system.build.toplevel); in rec { hostDefs = { ev = { description = "home server"; channel = "nixos-small"; module = ./hosts/ev/private.nix; standaloneModule = ./hosts/ev/default.nix; }; hamac = { description = "laptop"; channel = "nixos"; module = ./hosts/hamac/private.nix; standaloneModule = ./hosts/hamac/default.nix; }; tente = { description = "VPS"; channel = "nixos-small"; module = ./hosts/tente/default.nix; standaloneModule = ./hosts/tente/default.nix; }; }; configurations = mkConfigurations (host: host.module) hostDefs; systems = mkSystems configurations; standaloneConfigurations = mkConfigurations (host: host.standaloneModule) hostDefs; packages = { server = let pkgs = import sources.nixos-small.outPath { }; in pkgs.lib.packagesFromDirectoryRecursive { directory = ./profiles/server/pkgs; callPackage = pkgs.newScope { inherit sources; }; }; workstation = let pkgs = import sources.nixos.outPath { }; pkgs-unstable = import sources.nixos-unstable.outPath { }; in pkgs.lib.packagesFromDirectoryRecursive { directory = ./profiles/workstation/pkgs; callPackage = pkgs.newScope { inherit (pkgs-unstable) pi-coding-agent; }; }; }; }