pass show "$NIXOPS_CONFIG_PASS_SUBTREE_PATH/NixConfig" >> $TEMP
nixops set-args --argstr environment "$TEMP"
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+export NIX_PATH="ssh-config-file=$(dirname $DIR)/ssh/config:nixpkgs=$HOME/.nix-defexpr/channels/immaeNixpkgs"
nixops "$@"
#!/bin/bash
RemoteRepo="gitolite@git.immae.eu:perso/Immae/Prive/Password_store/Mes_Sites/Paul"
+NixChannelUrl='https://releases.nixos.org/nixos/18.09/nixos-18.09.1834.9d608a6f592'
+NixChannelName='immaeNixpkgs'
if [ -z "$NIXOPS_CONFIG_PASS_SUBTREE_REMOTE" \
-o -z "$NIXOPS_CONFIG_PASS_SUBTREE_PATH" ]; then
fi
fi
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
-nix_config="ssh-config-file=$(dirname $DIR)/ssh/config"
-if echo "$NIX_PATH" | grep -q "$nix_config"; then
- cat <<EOF
-All set up
-EOF
-else
+if ! nix-channel --list | grep -q "$NixChannelName $NixChannelUrl"; then
cat <<EOF
-All set up, please add
-ssh-config-file=$(dirname $DIR)/ssh/config
-to your NIX_PATH environment variable (colon-separated)
+A new nix channel will be installed (or upgraded) to freeze the packages
+version:
+$NixChannelName $NixChannelUrl
+> nix-channel --add $NixChannelUrl $NixChannelName
+> nix-channel --update
+If this step fail, you may have to disable sandboxing in
+/etc/nix/nix.conf and rerun
+> nix-channel --update
+manually.
+Continue? [y/N]
EOF
+ read y
+ if [ "$y" = "y" -o "$y" = "Y" ]; then
+ nix-channel --add $NixChannelUrl $NixChannelName
+ nix-channel --update
+ fi
fi
+
+cat <<EOF
+All set up.
+Please make sure you’re using scripts/nixops_wrap when deploying
+EOF