]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/scripts/with_env
Upgrade syden peertube to flake
[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
34abd6af 8umask 0077
9690acd9 9TEMP=$(mktemp -d /tmp/XXXXXX-nixops-files)
5f5efa6f
IB
10chmod go-rwx $TEMP
11
12finish() {
9690acd9 13 rm -rf "$TEMP"
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
34abd6af
IB
24
25export NIX_PATH="privateFiles=$TEMP:$NIX_PATH"
26export SSH_IDENTITY_FILE="$TEMP/id_ed25519"
5f5efa6f 27
4506dbe5 28"$@"