summaryrefslogtreecommitdiff
path: root/system-profiles/rebuild-machines/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'system-profiles/rebuild-machines/default.nix')
-rw-r--r--system-profiles/rebuild-machines/default.nix28
1 files changed, 25 insertions, 3 deletions
diff --git a/system-profiles/rebuild-machines/default.nix b/system-profiles/rebuild-machines/default.nix
index 68788023..fe9a5f14 100644
--- a/system-profiles/rebuild-machines/default.nix
+++ b/system-profiles/rebuild-machines/default.nix
@@ -26,7 +26,9 @@ let
26 phases = [ "buildPhase" "installPhase" ]; 26 phases = [ "buildPhase" "installPhase" ];
27 27
28 inherit (pkgs) zsh coreutils openssh; 28 inherit (pkgs) zsh coreutils openssh;
29 inherit (cfg) flake scriptName; 29 inherit (cfg) scriptName;
30 inherit (cfg.flake) flakeOutput;
31 flake = cfg.flake.name;
30 nixosRebuild = config.system.build.nixos-rebuild; 32 nixosRebuild = config.system.build.nixos-rebuild;
31 inherit (config.security) wrapperDir; 33 inherit (config.security) wrapperDir;
32 inherit sshConfig; 34 inherit sshConfig;
@@ -52,8 +54,21 @@ in {
52 }; 54 };
53 55
54 flake = mkOption { 56 flake = mkOption {
55 type = types.nullOr types.str; 57 type = types.submodule {
56 default = "git+ssh://${cfg.repoHost}/nixos?ref=flakes#${hostName}"; 58 options = {
59 flake = mkOption {
60 type = types.attrs;
61 };
62 flakeOutput = mkOption {
63 type = types.str;
64 };
65 name = mkOption {
66 type = types.str;
67 default = "machines";
68 };
69 };
70 };
71 default = { flake.url = "git+ssh://${cfg.repoHost}/nixos?ref=flakes"; flakeOutput = hostName; };
57 description = '' 72 description = ''
58 The Flake URI of the NixOS configuration to build. 73 The Flake URI of the NixOS configuration to build.
59 ''; 74 '';
@@ -136,5 +151,12 @@ in {
136 Persistent = true; 151 Persistent = true;
137 }; 152 };
138 }; 153 };
154
155 nix.registry = lib.mkIf (cfg.flake != null) {
156 ${cfg.flake.name} = {
157 exact = false;
158 to = cfg.flake.flake;
159 };
160 };
139 }; 161 };
140} 162}