]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - nixops/scripts/with_env
26e74b5f6d77b2f1851c9159f249344ad7f17b6c
[perso/Immae/Config/Nix.git] / nixops / scripts / with_env
1 #!/usr/bin/env bash
2
3 if [ -z "$NIXOPS" ]; then
4 echo "Please set NIXOPS to the nixops command"
5 exit 1;
6 fi
7
8 TEMP=$(mktemp -d /tmp/XXXXXX-nixops-files)
9 chmod go-rwx $TEMP
10
11 finish() {
12 rm -rf "$TEMP"
13 $NIXOPS set-args --unset privateFiles
14 }
15
16 trap finish EXIT
17
18 # pass cannot "just" list files in a directory without showing a tree :(
19 files=$(pass ls Nixops/files | sed -e '1d' -e 's/^.* //')
20
21 for file in $files; do
22 pass show "Nixops/files/$file" > $TEMP/$file
23 done
24 $NIXOPS set-args --argstr privateFiles "$TEMP"
25
26 "$@"