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