home-manager: respect NIX_STATE_DIR

This allows to install home-manager on a system without root access.

PR #1196
This commit is contained in:
Dmitry Kalinkin
2020-04-25 12:24:13 -04:00
committed by Robert Helgesson
parent 7682eb88c4
commit dc227b579d
2 changed files with 10 additions and 7 deletions

View File

@@ -1,8 +1,9 @@
#!/usr/bin/env bash
function setupVars() {
local profilesPath="/nix/var/nix/profiles/per-user/$USER"
local gcPath="/nix/var/nix/gcroots/per-user/$USER"
local nixStateDir="${NIX_STATE_DIR:-/nix/var/nix}"
local profilesPath="$nixStateDir/profiles/per-user/$USER"
local gcPath="$nixStateDir/gcroots/per-user/$USER"
genProfilePath="$profilesPath/home-manager"
newGenPath="@GENERATION_DIR@";