aboutsummaryrefslogtreecommitdiff
path: root/nixops
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-02-01 13:25:57 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-02-01 13:25:57 +0100
commit34c5871481ec3d8e8ceaf0b63a006bb5b2d8e8c8 (patch)
treed171c13f011ffe9c8bee0060086e21e8681a5b48 /nixops
parent9f5da6d7e9dbde93330f8c69ccdee9fac643696e (diff)
downloadNix-34c5871481ec3d8e8ceaf0b63a006bb5b2d8e8c8.tar.gz
Nix-34c5871481ec3d8e8ceaf0b63a006bb5b2d8e8c8.tar.zst
Nix-34c5871481ec3d8e8ceaf0b63a006bb5b2d8e8c8.zip
Freeze channel version when deploying.
Diffstat (limited to 'nixops')
-rwxr-xr-xnixops/scripts/nixops_wrap2
-rwxr-xr-xnixops/scripts/setup33
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
18pass show "$NIXOPS_CONFIG_PASS_SUBTREE_PATH/NixConfig" >> $TEMP 18pass show "$NIXOPS_CONFIG_PASS_SUBTREE_PATH/NixConfig" >> $TEMP
19nixops set-args --argstr environment "$TEMP" 19nixops set-args --argstr environment "$TEMP"
20 20
21DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
22export NIX_PATH="ssh-config-file=$(dirname $DIR)/ssh/config:nixpkgs=$HOME/.nix-defexpr/channels/immaeNixpkgs"
21nixops "$@" 23nixops "$@"
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
3RemoteRepo="gitolite@git.immae.eu:perso/Immae/Prive/Password_store/Mes_Sites/Paul" 3RemoteRepo="gitolite@git.immae.eu:perso/Immae/Prive/Password_store/Mes_Sites/Paul"
4NixChannelUrl='https://releases.nixos.org/nixos/18.09/nixos-18.09.1834.9d608a6f592'
5NixChannelName='immaeNixpkgs'
4 6
5if [ -z "$NIXOPS_CONFIG_PASS_SUBTREE_REMOTE" \ 7if [ -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
68fi 70fi
69 71
70DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 72if ! nix-channel --list | grep -q "$NixChannelName $NixChannelUrl"; then
71nix_config="ssh-config-file=$(dirname $DIR)/ssh/config"
72if echo "$NIX_PATH" | grep -q "$nix_config"; then
73 cat <<EOF
74All set up
75EOF
76else
77cat <<EOF 73cat <<EOF
78All set up, please add 74A new nix channel will be installed (or upgraded) to freeze the packages
79ssh-config-file=$(dirname $DIR)/ssh/config 75version:
80to your NIX_PATH environment variable (colon-separated) 76$NixChannelName $NixChannelUrl
77> nix-channel --add $NixChannelUrl $NixChannelName
78> nix-channel --update
79If this step fail, you may have to disable sandboxing in
80/etc/nix/nix.conf and rerun
81> nix-channel --update
82manually.
83Continue? [y/N]
81EOF 84EOF
85 read y
86 if [ "$y" = "y" -o "$y" = "Y" ]; then
87 nix-channel --add $NixChannelUrl $NixChannelName
88 nix-channel --update
89 fi
82fi 90fi
91
92cat <<EOF
93All set up.
94Please make sure you’re using scripts/nixops_wrap when deploying
95EOF