aboutsummaryrefslogtreecommitdiff
path: root/nixos/default.nix
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2026-10-17 10:36:36 +0200
committerMartin Fischer <martin@push-f.com>2026-10-17 17:02:46 +0200
commitf29ddff912ddcd58a4726736702b24655505ce09 (patch)
treed43e33c1320f229dc448bae2ccdc813a78d5f2de /nixos/default.nix
parentc8165d2a72b9e2e2c67c4b1aad40a0c3e256dd4d (diff)
refactor: introduce nixos/default.nix
The system prompt addition is to make it run `npins show <pin>` 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).
Diffstat (limited to 'nixos/default.nix')
-rw-r--r--nixos/default.nix57
1 files changed, 57 insertions, 0 deletions
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;
+}