]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - nixops/scripts/with_env
Upgrade syden peertube to flake
[perso/Immae/Config/Nix.git] / nixops / scripts / with_env
1 #!/usr/bin/env bash
2
3 if [ -z "$NIXOPS_ENV_LOADED" ]; then
4 echo "Please load the environment with direnv"
5 exit 1;
6 fi
7
8 umask 0077
9 TEMP=$(mktemp -d /tmp/XXXXXX-nixops-files)
10 chmod go-rwx $TEMP
11
12 finish() {
13 rm -rf "$TEMP"
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
25 export NIX_PATH="privateFiles=$TEMP:$NIX_PATH"
26 export SSH_IDENTITY_FILE="$TEMP/id_ed25519"
27
28 "$@"