From eba6e440861a9f94f6837bb6b37fd2ef7e4e0446 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Sat, 6 Sep 2025 14:02:31 +0200 Subject: refactor lib/{machines,nixosModules}.nix --- lib/machines.nix | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 lib/machines.nix (limited to 'lib/machines.nix') 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; + }; +} -- cgit v1.2.3