diff options
author | 2025-09-05 15:57:25 +0200 | |
---|---|---|
committer | 2025-09-05 15:57:25 +0200 | |
commit | 783d84d1a68bcd3d0716e20ec8f47764a2bad4db (patch) | |
tree | 05d5c8d09a441eae3b4476e53492999bcd7b9081 /lib/default.nix | |
parent | 61d1e03854a78a946ce16d71bd30956c27cc9e0b (diff) |
add two systems
Diffstat (limited to 'lib/default.nix')
-rw-r--r-- | lib/default.nix | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/lib/default.nix b/lib/default.nix new file mode 100644 index 0000000..a5f3e17 --- /dev/null +++ b/lib/default.nix @@ -0,0 +1,75 @@ +{ sources ? import ../npins +, pkgs ? import sources.nixpkgs {} +}: +let + inherit (pkgs) lib; + + eval = configuration: + let + self = + lib.evalModules { + modules = [ + configuration + { + options = { + machines = lib.mkOption { + type = lib.types.attrsOf lib.types.raw; + default = {}; + }; + outputs = lib.mkOption { + type = lib.types.attrsOf lib.types.raw; + default = {}; + }; + }; + config = { + outputs.machines = lib.mapAttrs (name: configuration: + nixos configuration + ) self.config.machines; + }; + } + ]; + specialArgs.self = self; + }; + + # nixos = config: lib.evalModules { + # modules = [ + # config + # { + # # XXX Otherwise building manual fails + # documentation.enable = false; + + # boot.loader.grub.device = "nodev"; + # fileSystems."/".device = "tmpfs"; + # nixpkgs.localSystem = "x86_64-linux"; + # } + # ]; + # specialArgs.self = self; + # }; + + nixos = config: import (sources.nixpkgs + "/nixos/lib/eval-config.nix") { + modules = [ + config + { + # XXX Otherwise building manual fails + documentation.enable = false; + + boot.loader.grub.device = "nodev"; + fileSystems."/".device = "tmpfs"; + nixpkgs.localSystem = { + system = "x86_64-linux"; + }; + } + ]; + specialArgs.self = self; + + # The system is inherited from the current pkgs above. + # Set it to null, to remove the "legacy" entrypoint's non-hermetic default. + system = null; + }; + in + self; + +in +{ + inherit eval; +} |