{ self, lib, extra_lib, module_args, special_args, nixpkgs-stable, nixpkgs-unstable, deploy-rs, system, }: let hosts = extra_lib.mkByName { useShards = false; baseDirectory = ./by-name; fileName = "configuration.nix"; finalizeFunction = host_name: path: let definition = builtins.fromTOML (builtins.readFile (path + "/../host.toml")); in {inherit path definition;}; }; mkNixosConfiguration = name: host: let nixpkgs = if host.definition.nixpkgs == "stable" then nixpkgs-stable else nixpkgs-unstable; in nixpkgs.lib.nixosSystem { specialArgs = special_args; modules = [ { _module.args = module_args; } host.path ../modules # ../modules/common ]; }; mkDeployHost = name: host: if (host.definition.deployment == "deploy-rs") then { inherit (host.definition) hostname; profiles.system = { user = "root"; path = deploy-rs.lib."${system}".activate.nixos self.nixosConfigurations."${name}"; }; } else null; nixosConfigurations = builtins.mapAttrs mkNixosConfiguration hosts; nodes = lib.filterAttrs (_: value: value != null) (builtins.mapAttrs mkDeployHost hosts); in { inherit nixosConfigurations nodes; }