X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=nixops%2Fscripts%2Fwith_env;h=9882f787f120c855a8b291bdf534d24356c143b1;hb=da28a4e2afef21710f73860b26893fa18dd32858;hp=a442ced2091ed8fe1c643f8fccd85cd930188c8a;hpb=4506dbe51901f66406a02042b2097b3b3856e8a6;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/nixops/scripts/with_env b/nixops/scripts/with_env index a442ced..9882f78 100755 --- a/nixops/scripts/with_env +++ b/nixops/scripts/with_env @@ -1,12 +1,7 @@ -#!/bin/bash +#!/usr/bin/env bash -if [ -z "$NIXOPS" ]; then - echo "Please set NIXOPS to the nixops command" - exit 1; -fi - -if [ -z "$NIXOPS_CONFIG_PASS_SUBTREE_PATH" ]; then - echo "Please set NIXOPS_CONFIG_PASS_SUBTREE_PATH to the password-store subtree path" +if [ -z "$NIXOPS_ENV_LOADED" ]; then + echo "Please load the environment with direnv" exit 1; fi @@ -15,17 +10,17 @@ chmod go-rwx $TEMP finish() { rm -rf "$TEMP" - $NIXOPS set-args --unset privateFiles + nixops set-args --unset privateFiles } trap finish EXIT # 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/^.* //') +files=$(pass ls Nixops/files | sed -e '1d' -e 's/^.* //') for file in $files; do - pass show "$NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/files/$file" > $TEMP/$file + pass show "Nixops/files/$file" > $TEMP/$file done -$NIXOPS set-args --argstr privateFiles "$TEMP" +nixops set-args --argstr privateFiles "$TEMP" "$@"