home-manager: use NIX_PATH to locate modules

This removes the old argument based method that Home Manager used to
find its modules by a `NIX_PATH` based method. Specifically, this adds
a `home-manager` Nix path prefix that can be overridden much like with
the `nixpkgs` path prefix.
This commit is contained in:
Robert Helgesson 2017-05-21 23:54:38 +02:00
parent ff65781b84
commit 67391395ef
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86
2 changed files with 4 additions and 3 deletions

View file

@ -3,10 +3,10 @@
let let
homeManagerExpr = pkgs.writeText "home-manager.nix" '' homeManagerExpr = pkgs.writeText "home-manager.nix" ''
{ pkgs ? import <nixpkgs> {}, confPath, modulesPath }: { pkgs ? import <nixpkgs> {}, confPath }:
let let
env = import modulesPath { env = import <home-manager> {
configuration = import confPath; configuration = import confPath;
pkgs = pkgs; pkgs = pkgs;
}; };

View file

@ -41,6 +41,8 @@ function doBuild() {
exit 1 exit 1
fi fi
export NIX_PATH="$NIX_PATH${NIX_PATH:+:}home-manager=@MODULES_PATH@"
local extraArgs local extraArgs
extraArgs="" extraArgs=""
@ -54,7 +56,6 @@ function doBuild() {
nix-build $extraArgs \ nix-build $extraArgs \
"@HOME_MANAGER_EXPR_PATH@" \ "@HOME_MANAGER_EXPR_PATH@" \
--argstr modulesPath "@MODULES_PATH@" \
--argstr confPath "$confFile" \ --argstr confPath "$confFile" \
-A activation-script \ -A activation-script \
-o "$output" -o "$output"