summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2015-06-14 20:57:19 +0200
committerlassulus <lass@aidsballs.de>2015-06-14 20:57:19 +0200
commitcb70769a04166a7c7a0d8e92a23f9ae76f768259 (patch)
tree27572e3f2fa4f7e715c64c36619b7a96a223078e /bin
parente59d4f45c04431605a2c2f2988d3127e8982fda7 (diff)
deploy: take target as optional argument
Diffstat (limited to 'bin')
-rwxr-xr-xbin/copy-secrets20
-rwxr-xr-xbin/nixos-deploy10
2 files changed, 16 insertions, 14 deletions
diff --git a/bin/copy-secrets b/bin/copy-secrets
index 36854eaf..5ef94b09 100755
--- a/bin/copy-secrets
+++ b/bin/copy-secrets
@@ -1,23 +1,25 @@
#! /bin/sh
+#
+# copy-secrets system_name target
+#
set -euf
-host=$1
+system_name=$1
+target=$2
-target=root@$host
-
-nixos_config=$config_root/modules/$host
-secrets_nix=$secrets_root/$host/nix
-secrets_rsync=$secrets_root/$host/rsync
+nixos_config=$config_root/modules/$system_name
+secrets_nix=$secrets_root/$system_name/nix
+secrets_rsync=$secrets_root/$system_name/rsync
if ! test -e "$secrets_rsync"; then
exit # nothing to do
fi
-retiolum_secret=$(nixos-query $host services.retiolum.privateKeyFile)
-retiolum_uid=$(nixos-query $host users.extraUsers.retiolum-tinc.uid)
+retiolum_secret=$(nixos-query $system_name services.retiolum.privateKeyFile)
+retiolum_uid=$(nixos-query $system_name users.extraUsers.retiolum-tinc.uid)
ejabberd_secret=/etc/ejabberd/ejabberd.pem
-ejabberd_uid=$(nixos-query $host users.extraUsers.ejabberd.uid)
+ejabberd_uid=$(nixos-query $system_name users.extraUsers.ejabberd.uid)
rsync -cz --chown=0:0 -vr "$secrets_rsync/" "$target:/"
diff --git a/bin/nixos-deploy b/bin/nixos-deploy
index 6b841869..fa86a8c8 100755
--- a/bin/nixos-deploy
+++ b/bin/nixos-deploy
@@ -1,16 +1,16 @@
#! /bin/sh
#
-# deploy
+# nixos-deploy system_name target
#
set -euf
-host=$1
-system=${2-$(nixos-build "$host")}
+system_name=$1
+target=$2
-target=root@$host
+system=$(nixos-build "$system_name")
nix-copy-closure --gzip --to "$target" "$system"
-copy-secrets "$host"
+copy-secrets "$system_name" "$target"
ssh ${NIX_SSHOPTS-} "$target" "$system/bin/switch-to-configuration" switch