X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=nixops%2Fscripts%2Fnixops_wrap;h=28aa917fca212d8b9e12008e03ba10dee0327c75;hb=dbcba2ea2b7301aaa7e6487c2589b09ef09ba066;hp=c23d3088f0f269af41f10913e1a1200b3a2665ef;hpb=5f5efa6fa5a5b7d299998be410a278a7ff396504;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/nixops/scripts/nixops_wrap b/nixops/scripts/nixops_wrap index c23d308..28aa917 100755 --- a/nixops/scripts/nixops_wrap +++ b/nixops/scripts/nixops_wrap @@ -1,21 +1,31 @@ #!/bin/bash -if [ -z "$NIXOPS_CONFIG_PASS_PATH" ]; then - echo "Please set NIXOPS_CONFIG_PASS_PATH to the password-store environment file path" +DeploymentUuid="cef694f3-081d-11e9-b31f-0242ec186adf" +if [ -z "$NIXOPS_CONFIG_PASS_SUBTREE_PATH" ]; then + echo "Please set NIXOPS_CONFIG_PASS_SUBTREE_PATH to the password-store subtree path" exit 1; fi +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops" +export NIXOPS_DEPLOYMENT="$DeploymentUuid" +source $(dirname $(dirname $DIR))/scripts/nix_env -TEMP=$(mktemp /tmp/XXXXXX-environment.nix) +TEMP=$(mktemp -d /tmp/XXXXXX-nixops-files) chmod go-rwx $TEMP finish() { - rm -f "$TEMP" - nixops set-args --unset environment + rm -rf "$TEMP" + nixops_custom set-args --unset privateFiles } trap finish EXIT -pass show "$NIXOPS_CONFIG_PASS_PATH" >> $TEMP -nixops set-args --argstr environment "$TEMP" +# pass cannot "just" list files in a directory without showing a tree :( +files=$(pass ls $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/files | sed -e '1d' -e 's/^.* //') -nixops "$@" +for file in $files; do + pass show "$NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/files/$file" > $TEMP/$file +done +nixops_custom set-args --argstr privateFiles "$TEMP" + +nixops_custom "$@"