]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/scripts/with_env
Add environment file instead of hardcoding everything in makefiles
[perso/Immae/Config/Nix.git] / nixops / scripts / with_env
CommitLineData
2caad890 1#!/usr/bin/env bash
5f5efa6f 2
da28a4e2
IB
3if [ -z "$NIXOPS_ENV_LOADED" ]; then
4 echo "Please load the environment with direnv"
4506dbe5
IB
5 exit 1;
6fi
7
9690acd9 8TEMP=$(mktemp -d /tmp/XXXXXX-nixops-files)
5f5efa6f
IB
9chmod go-rwx $TEMP
10
11finish() {
9690acd9 12 rm -rf "$TEMP"
da28a4e2 13 nixops set-args --unset privateFiles
5f5efa6f
IB
14}
15
16trap finish EXIT
17
9690acd9 18# pass cannot "just" list files in a directory without showing a tree :(
1052bfda 19files=$(pass ls Nixops/files | sed -e '1d' -e 's/^.* //')
9690acd9
IB
20
21for file in $files; do
1052bfda 22 pass show "Nixops/files/$file" > $TEMP/$file
9690acd9 23done
da28a4e2 24nixops set-args --argstr privateFiles "$TEMP"
5f5efa6f 25
4506dbe5 26"$@"