]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/scripts/nixops_wrap
Add caldance buildbot and optimize a bit the drivations
[perso/Immae/Config/Nix.git] / nixops / scripts / nixops_wrap
CommitLineData
5f5efa6f
IB
1#!/bin/bash
2
568d4240 3DeploymentUuid="cef694f3-081d-11e9-b31f-0242ec186adf"
9f5da6d7
IB
4if [ -z "$NIXOPS_CONFIG_PASS_SUBTREE_PATH" ]; then
5 echo "Please set NIXOPS_CONFIG_PASS_SUBTREE_PATH to the password-store subtree path"
5f5efa6f
IB
6 exit 1;
7fi
8
9690acd9 9TEMP=$(mktemp -d /tmp/XXXXXX-nixops-files)
5f5efa6f
IB
10chmod go-rwx $TEMP
11
12finish() {
9690acd9
IB
13 rm -rf "$TEMP"
14 nixops set-args --unset privateFiles
9fb4205e 15 nixops set-args --unset nixpkgsNext
5f5efa6f
IB
16}
17
18trap finish EXIT
19
568d4240
IB
20DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
21export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops"
22export NIXOPS_DEPLOYMENT="$DeploymentUuid"
23
9690acd9
IB
24# pass cannot "just" list files in a directory without showing a tree :(
25files=$(pass ls $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/files | sed -e '1d' -e 's/^.* //')
26
27for file in $files; do
28 pass show "$NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/files/$file" > $TEMP/$file
29done
30nixops set-args --argstr privateFiles "$TEMP"
9fb4205e 31nixops set-args --argstr nixpkgsNext "$HOME/.nix-defexpr/channels/immaeNixpkgsNext"
5f5efa6f 32
9fb4205e 33export NIX_PATH="ssh-config-file=$(dirname $DIR)/ssh/config:nixpkgs=$HOME/.nix-defexpr/channels/immaeNixpkgs"
5f5efa6f 34nixops "$@"