Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990{ self, inputs, lib, config, ...}: let inherit (builtins) attrValues; inherit (lib) mapAttrs concatMapAttrs getAttrs; inherit (config.nex.lib) readModules; inherit (config.nex) homeConfigs; microConfigs = lib.filterAttrs (name: val: val.microvm != null) config.hosts; nixosModules = readModules (self + "/nixos-modules"); packedMicroConfigs = mapAttrs ( name: hostConfig: { inherit (hostConfig) system testing; thisConfig = hostConfig; base = { imports = [ hostConfig.microvm.module ] ++ (map (userConfig: (import userConfig).system) (attrValues (getAttrs hostConfig.users homeConfigs))); }; } ) microConfigs; microvmConfigs = mapAttrs ( name: hostConfig: (system: inputs.nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit self inputs nixosModules; inherit (hostConfig) thisConfig; flake = config; }; modules = [ hostConfig.base ( if inputs ? "agenix" then inputs.agenix.nixosModules.default else {} ) ( if inputs ? "agenix-rekey" then inputs.agenix-rekey.nixosModules.default else {} ) ( if inputs ? "microvm" then inputs.microvm.nixosModules.microvm else {} ) ]; }) ) config.nex.packedMicroConfigs;in { options = { nex = { packedMicroConfigs = lib.mkOption { type = lib.types.attrs; default = {}; }; microvmConfigs = lib.mkOption { type = lib.types.attrs; default = {}; }; }; }; config = { nex = { inherit microvmConfigs packedMicroConfigs; }; flake = { inherit (config) hosts; }; perSystem = {system, ...}: { packages = concatMapAttrs (name: microvm: { "${name}-runner" = (microvm system).config.microvm.declaredRunner; "${name}-install" = (microvm system).config.microvm.deploy.installOnHost; }) config.nex.microvmConfigs; }; };}