summaryrefslogtreecommitdiff
path: root/system-profiles
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-03-13 10:41:41 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2022-03-13 10:41:41 +0100
commit46152e140fe428538a562dcfd1627a88a02dcc09 (patch)
treebe9e750b58363bcde0749804681a2c5643883e2e /system-profiles
parentb4d952460bdd970d90e91d7b8e778b44a0ef3394 (diff)
downloadnixos-46152e140fe428538a562dcfd1627a88a02dcc09.tar
nixos-46152e140fe428538a562dcfd1627a88a02dcc09.tar.gz
nixos-46152e140fe428538a562dcfd1627a88a02dcc09.tar.bz2
nixos-46152e140fe428538a562dcfd1627a88a02dcc09.tar.xz
nixos-46152e140fe428538a562dcfd1627a88a02dcc09.zip
...
Diffstat (limited to 'system-profiles')
-rw-r--r--system-profiles/rebuild-machines/default.nix28
-rw-r--r--system-profiles/rebuild-machines/rebuild-machine.zsh2
2 files changed, 26 insertions, 4 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}
diff --git a/system-profiles/rebuild-machines/rebuild-machine.zsh b/system-profiles/rebuild-machines/rebuild-machine.zsh
index c06ef0e4..e018e7a7 100644
--- a/system-profiles/rebuild-machines/rebuild-machine.zsh
+++ b/system-profiles/rebuild-machines/rebuild-machine.zsh
@@ -7,4 +7,4 @@ fi
7export NIX_SSHOPTS="-F @sshConfig@" 7export NIX_SSHOPTS="-F @sshConfig@"
8export GIT_SSH_COMMAND="@openssh@/bin/ssh -F @sshConfig@" 8export GIT_SSH_COMMAND="@openssh@/bin/ssh -F @sshConfig@"
9export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0="init.defaultBranch" GIT_CONFIG_VALUE_0=main 9export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0="init.defaultBranch" GIT_CONFIG_VALUE_0=main
10exec -- @nixosRebuild@/bin/nixos-rebuild --refresh --flake '@flake@' ${@:-switch} 10exec -- @nixosRebuild@/bin/nixos-rebuild --refresh --flake '@flake@#@flakeOutput@' ${@:-switch}