summaryrefslogtreecommitdiffstats
path: root/lib/machines.nix
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2025-09-06 14:02:31 +0200
committerLibravatar Alexander Foremny <aforemny@posteo.de>2025-09-06 14:03:05 +0200
commiteba6e440861a9f94f6837bb6b37fd2ef7e4e0446 (patch)
tree556062943c2f794edeeb9920e52491bf67a539d7 /lib/machines.nix
parent7132c52c038de995eb291070a4cda3eaf975635b (diff)
refactor lib/{machines,nixosModules}.nix
Diffstat (limited to 'lib/machines.nix')
-rw-r--r--lib/machines.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/machines.nix b/lib/machines.nix
new file mode 100644
index 0000000..d652fcf
--- /dev/null
+++ b/lib/machines.nix
@@ -0,0 +1,46 @@
+{ lib
+, pkgs
+, self
+, sources
+, ...
+}:
+let
+ nixos = config: import (sources.nixpkgs + "/nixos/lib/eval-config.nix") {
+ modules = [
+ config
+ {
+ documentation.enable = false;
+ boot.loader.grub.device = "nodev";
+ fileSystems."/".device = "tmpfs";
+ nixpkgs.localSystem = {
+ system = "x86_64-linux";
+ };
+ }
+ ];
+ specialArgs = {
+ inherit
+ pkgs
+ self
+ sources
+ ;
+ };
+ system = null;
+ };
+in
+{
+ options = {
+ machines = lib.mkOption {
+ type = lib.types.attrsOf lib.types.raw;
+ default = {};
+ };
+ outputs.machines = lib.mkOption {
+ type = lib.types.attrsOf lib.types.raw;
+ default = {};
+ };
+ };
+ config = {
+ outputs.machines = lib.mapAttrs (name: configuration:
+ nixos configuration
+ ) self.config.machines;
+ };
+}