From f29ddff912ddcd58a4726736702b24655505ce09 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Sat, 17 Oct 2026 10:36:36 +0200 Subject: refactor: introduce nixos/default.nix The system prompt addition is to make it run `npins show ` rather than `npins show` when looking for a specific pin. `npins get-path` is mentioned because the model doesn't "know" it yet (the subcommand was introduced in 2025 Dec). --- nixos/default.nix | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 nixos/default.nix (limited to 'nixos/default.nix') diff --git a/nixos/default.nix b/nixos/default.nix new file mode 100644 index 0000000..e5090db --- /dev/null +++ b/nixos/default.nix @@ -0,0 +1,57 @@ +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; + + standaloneSystems = mkSystems standaloneConfigurations; +} -- cgit v1.3.1