home-environment: use nix-env from PATH

It is safest to use the system install of Nix since that will be
compatible with the running nix-daemon and/or databases.

Also add a printout of the used Nix version in the activation script
when running in verbose mode.

Fixes #218.

(cherry picked from commit 19b4002f25)
This commit is contained in:
Robert Helgesson 2018-02-27 20:31:03 +01:00
parent 467ba9cafd
commit f7628e2996
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86
2 changed files with 7 additions and 1 deletions

View file

@ -313,7 +313,6 @@ in
pkgs.gnugrep pkgs.gnugrep
pkgs.gnused pkgs.gnused
pkgs.ncurses # For `tput`. pkgs.ncurses # For `tput`.
pkgs.nix
] ]
+ optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH"; + optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH";

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
function setupVars() { function setupVars() {
local profilesPath="/nix/var/nix/profiles/per-user/$USER" local profilesPath="/nix/var/nix/profiles/per-user/$USER"
local gcPath="/nix/var/nix/gcroots/per-user/$USER" local gcPath="/nix/var/nix/gcroots/per-user/$USER"
@ -46,6 +48,11 @@ else
export DRY_RUN_CMD="" export DRY_RUN_CMD=""
fi fi
if [[ -v VERBOSE ]]; then
echo -n "Using Nix version: "
nix-env --version
fi
$VERBOSE_ECHO "Activation variables:" $VERBOSE_ECHO "Activation variables:"
if [[ -v oldGenNum ]] ; then if [[ -v oldGenNum ]] ; then
$VERBOSE_ECHO " oldGenNum=$oldGenNum" $VERBOSE_ECHO " oldGenNum=$oldGenNum"