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