]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/scripts/nixops_wrap
Make the use of nixpkgs more homogeneous for env
[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
5f5efa6f
IB
15}
16
17trap finish EXIT
18
568d4240
IB
19DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
20export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops"
21export NIXOPS_DEPLOYMENT="$DeploymentUuid"
22
9690acd9
IB
23# pass cannot "just" list files in a directory without showing a tree :(
24files=$(pass ls $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/files | sed -e '1d' -e 's/^.* //')
25
26for file in $files; do
27 pass show "$NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/files/$file" > $TEMP/$file
28done
29nixops set-args --argstr privateFiles "$TEMP"
5f5efa6f 30
a542de11
IB
31# This will automatically upgrade to latest version at each build
32# nixpkgsNext="https://nixos.org/channels/nixos-19.03/nixexprs.tar.xz"
3afed4fc 33nixpkgsNext="https://releases.nixos.org/nixos/19.03/nixos-19.03beta171840.23fd1394dc6/nixexprs.tar.xz"
587b9e34 34nixpkgsPrevious="https://releases.nixos.org/nixos/18.09/nixos-18.09.1834.9d608a6f592/nixexprs.tar.xz"
3afed4fc 35nixpkgs="$nixpkgsNext"
587b9e34 36export NIX_PATH="ssh-config-file=$(dirname $DIR)/ssh/config:nixpkgs=$nixpkgs:nixpkgsNext=$nixpkgsNext:nixpkgsPrevious=$nixpkgsPrevious"
5f5efa6f 37nixops "$@"