diff options
Diffstat (limited to 'nixops')
-rwxr-xr-x | nixops/scripts/nixops_wrap | 2 | ||||
-rwxr-xr-x | nixops/scripts/setup | 33 |
2 files changed, 25 insertions, 10 deletions
diff --git a/nixops/scripts/nixops_wrap b/nixops/scripts/nixops_wrap index 1efe8a9..1de38f5 100755 --- a/nixops/scripts/nixops_wrap +++ b/nixops/scripts/nixops_wrap | |||
@@ -18,4 +18,6 @@ trap finish EXIT | |||
18 | pass show "$NIXOPS_CONFIG_PASS_SUBTREE_PATH/NixConfig" >> $TEMP | 18 | pass show "$NIXOPS_CONFIG_PASS_SUBTREE_PATH/NixConfig" >> $TEMP |
19 | nixops set-args --argstr environment "$TEMP" | 19 | nixops set-args --argstr environment "$TEMP" |
20 | 20 | ||
21 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
22 | export NIX_PATH="ssh-config-file=$(dirname $DIR)/ssh/config:nixpkgs=$HOME/.nix-defexpr/channels/immaeNixpkgs" | ||
21 | nixops "$@" | 23 | nixops "$@" |
diff --git a/nixops/scripts/setup b/nixops/scripts/setup index ff20fc9..d9d4258 100755 --- a/nixops/scripts/setup +++ b/nixops/scripts/setup | |||
@@ -1,6 +1,8 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | RemoteRepo="gitolite@git.immae.eu:perso/Immae/Prive/Password_store/Mes_Sites/Paul" | 3 | RemoteRepo="gitolite@git.immae.eu:perso/Immae/Prive/Password_store/Mes_Sites/Paul" |
4 | NixChannelUrl='https://releases.nixos.org/nixos/18.09/nixos-18.09.1834.9d608a6f592' | ||
5 | NixChannelName='immaeNixpkgs' | ||
4 | 6 | ||
5 | if [ -z "$NIXOPS_CONFIG_PASS_SUBTREE_REMOTE" \ | 7 | if [ -z "$NIXOPS_CONFIG_PASS_SUBTREE_REMOTE" \ |
6 | -o -z "$NIXOPS_CONFIG_PASS_SUBTREE_PATH" ]; then | 8 | -o -z "$NIXOPS_CONFIG_PASS_SUBTREE_PATH" ]; then |
@@ -67,16 +69,27 @@ EOF | |||
67 | fi | 69 | fi |
68 | fi | 70 | fi |
69 | 71 | ||
70 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | 72 | if ! nix-channel --list | grep -q "$NixChannelName $NixChannelUrl"; then |
71 | nix_config="ssh-config-file=$(dirname $DIR)/ssh/config" | ||
72 | if echo "$NIX_PATH" | grep -q "$nix_config"; then | ||
73 | cat <<EOF | ||
74 | All set up | ||
75 | EOF | ||
76 | else | ||
77 | cat <<EOF | 73 | cat <<EOF |
78 | All set up, please add | 74 | A new nix channel will be installed (or upgraded) to freeze the packages |
79 | ssh-config-file=$(dirname $DIR)/ssh/config | 75 | version: |
80 | to your NIX_PATH environment variable (colon-separated) | 76 | $NixChannelName $NixChannelUrl |
77 | > nix-channel --add $NixChannelUrl $NixChannelName | ||
78 | > nix-channel --update | ||
79 | If this step fail, you may have to disable sandboxing in | ||
80 | /etc/nix/nix.conf and rerun | ||
81 | > nix-channel --update | ||
82 | manually. | ||
83 | Continue? [y/N] | ||
81 | EOF | 84 | EOF |
85 | read y | ||
86 | if [ "$y" = "y" -o "$y" = "Y" ]; then | ||
87 | nix-channel --add $NixChannelUrl $NixChannelName | ||
88 | nix-channel --update | ||
89 | fi | ||
82 | fi | 90 | fi |
91 | |||
92 | cat <<EOF | ||
93 | All set up. | ||
94 | Please make sure you’re using scripts/nixops_wrap when deploying | ||
95 | EOF | ||