nixdirfmt

This commit is contained in:
kat witch 2021-03-16 18:42:10 +00:00
parent f39ede8001
commit a7eb2e7a6f
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
8 changed files with 59 additions and 46 deletions

View file

@ -6,7 +6,9 @@ let
cfg = config.deploy;
secretsScript = concatMapStrings (file:
''
ssh $NIX_SSHOPTS root@${cfg.ssh.host} "mkdir -p ${toString file.out.dir}
ssh $NIX_SSHOPTS -T root@${cfg.ssh.host} "mkdir -p ${
toString file.out.dir
}
cat > ${file.path}
chmod ${file.mode} ${file.path}
chown ${file.owner}:${file.group} ${file.path}"''
@ -54,17 +56,19 @@ in {
deploy.groups = [ "all" ];
system.build.deployScript = ''
#!${pkgs.runtimeShell}
set -xeo pipefail
export PATH=${with pkgs; lib.makeBinPath [ coreutils openssh nix ]}
export NIX_SSHOPTS="$NIX_SSHOPTS -p${toString cfg.ssh.port} -T"
nix build ${ builtins.unsafeDiscardStringContext config.system.build.toplevel.drvPath} -o result-${config.networking.hostName}
nix copy ${
if cfg.substitute then "-s" else ""
} --no-check-sigs --to ssh://root@${cfg.ssh.host} ${config.system.build.toplevel}
${secretsScript}
ssh $NIX_SSHOPTS root@${cfg.ssh.host} "nix-env -p /nix/var/nix/profiles/system -i ${config.system.build.toplevel}"
ssh $NIX_SSHOPTS root@${cfg.ssh.host} "/nix/var/nix/profiles/system/bin/switch-to-configuration $1"
'';
#!${pkgs.runtimeShell}
set -xeo pipefail
export PATH=${with pkgs; lib.makeBinPath [ coreutils openssh nix ]}
export NIX_SSHOPTS="$NIX_SSHOPTS -p${toString cfg.ssh.port}"
nix build ${
builtins.unsafeDiscardStringContext config.system.build.toplevel.drvPath
} -o result-${config.networking.hostName}
nix copy ${
if cfg.substitute then "-s" else ""
} --no-check-sigs --to ssh://root@${cfg.ssh.host} ${config.system.build.toplevel}
${secretsScript}
ssh $NIX_SSHOPTS root@${cfg.ssh.host} "nix-env -p /nix/var/nix/profiles/system -i ${config.system.build.toplevel}"
ssh $NIX_SSHOPTS root@${cfg.ssh.host} "/nix/var/nix/profiles/system/bin/switch-to-configuration $1"
'';
};
}