flake.nix, deploy-flake.sh: replace `nix-copy-closure` with `nix copy`

This commit is contained in:
Astro 2021-10-19 01:27:22 +02:00
parent 2c0eed36a1
commit dce89059e3
2 changed files with 6 additions and 5 deletions

View File

@ -9,7 +9,7 @@ function show_help() {
echo "Usage:"
echo "$0 [--build-local] <host.hq.c3d2.de>"
echo "--help Show this help."
echo "--build-local Build config locally and copy it to the target system via nix-copy-closure"
echo "--build-local Build config locally and copy it to the target system via nix copy"
exit 1
}
@ -38,7 +38,7 @@ done
if [[ -v build_local ]]; then
nix --experimental-features 'nix-command flakes' -Lv build ".#nixosConfigurations.$target.config.system.build.toplevel"
store_path=$(readlink -f result)
nix-copy-closure --to root@"$host" -v "$store_path"
nix --experimental-features 'nix-command flakes' copy --to ssh://root@"$host" -v "$store_path"
ssh root@"$host" "$store_path/bin/switch-to-configuration" switch
else
hostname=$(echo "$target" | cut -d . -f 1)

View File

@ -136,14 +136,15 @@
# Can be run with `nix run c3d2#…-nixos-rebuild switch`
"${name}-nixos-rebuild" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
#!${pkgs.runtimeShell} -e
nix-copy-closure --to ${target} ${secrets}
nix-copy-closure --to ${target} ${self}
nix copy --to ssh://${target} ${secrets}
nix copy --to ssh://${target} ${self}
exec ssh ${target} nixos-rebuild ${rebuildArg} $@
'';
"${name}-nixos-rebuild-local" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
#!${pkgs.runtimeShell} -e
nix-copy-closure --to ${target} --gzip ${profile}
set -x
nix copy --to ssh://${target} ${profile}
exec ssh ${target} "${profile}/bin/switch-to-configuration $@"
'';