From 5bf105b94f3c63bc738b788b2b651985eed96c11 Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Sat, 29 Mar 2025 12:54:20 +0100 Subject: dynamic nodes --- flake.nix | 79 ++++++++------------------------------------------------------- 1 file changed, 9 insertions(+), 70 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index aa8d6a6..90be6a6 100644 --- a/flake.nix +++ b/flake.nix @@ -30,76 +30,15 @@ update-systemd-resolved.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = inputs@{ - self, - agenix, - disko, - home-manager, - microvm, - nixpkgs, - nixos-facter-modules, - update-systemd-resolved, - ... - }: - let - coreModules = [ - home-manager.nixosModules.home-manager - agenix.nixosModules.default - ./modules/core - ]; - - # These should at some point be included in coreModules - deviceMgmtModules = [ - disko.nixosModules.disko - nixos-facter-modules.nixosModules.facter - ]; - - mkServer = import ./lib/mkserver.nix { - inherit nixpkgs inputs; - }; - in + outputs = inputs@{ self, nixpkgs, ... }: { - nixosConfigurations.work = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; }; - modules = coreModules ++ [ - update-systemd-resolved.nixosModules.update-systemd-resolved - { - environment.systemPackages = [ - agenix.packages."x86_64-linux".default - ]; - } - - ./modules/work - ]; - }; - - nixosConfigurations.tarrel = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; }; - modules = coreModules ++ [ - { - environment.systemPackages = [ - agenix.packages."x86_64-linux".default - ]; - } - - ./modules/tarrel - ]; - }; - - nixosConfigurations.snorlax = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs; }; - - modules = coreModules ++ deviceMgmtModules ++ [ - microvm.nixosModules.host - - { config.facter.reportPath = ./modules/snorlax/facter.json; } - ./modules/snorlax - ]; - }; - - nixosConfigurations.backup = mkServer "backup.jras.nl"; + nixosConfigurations = builtins.listToAttrs (builtins.map (name: { + name = name; + value = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ ./nodes/${name}/configuration.nix ]; + }; + }) (builtins.attrNames (builtins.readDir ./nodes))); }; } -- cgit v1.2.3