aboutsummaryrefslogtreecommitdiff
path: root/home-manager
diff options
context:
space:
mode:
authorRobert Helgesson <robert@rycee.net>2017-07-11 19:50:29 +0200
committerRobert Helgesson <robert@rycee.net>2017-07-11 20:53:42 +0200
commit28d3f746146a66dbd64816b8638deaa83199302f (patch)
treede4fcaa8005df0e359ef7a191b59c91e7c767016 /home-manager
parent98c7b23178df174ee36c6b643d2b865644604ca5 (diff)
home-manager: allow a user-defined third module path
The user-defined path will be used if present, otherwise the two "fallback" defaults (in `.nixpkgs` and `.config/nixpkgs`) will be used.
Diffstat (limited to 'home-manager')
-rw-r--r--home-manager/default.nix12
-rw-r--r--home-manager/home-manager1
2 files changed, 11 insertions, 2 deletions
diff --git a/home-manager/default.nix b/home-manager/default.nix
index 3c4880a0150..b2c137b0684 100644
--- a/home-manager/default.nix
+++ b/home-manager/default.nix
@@ -1,4 +1,10 @@
-{ pkgs, modulesPath ? "$HOME/.config/nixpkgs/home-manager/modules" }:
+{ pkgs
+
+ # Extra path to the Home Manager modules. If set then this path will
+ # be tried before `$HOME/.config/nixpkgs/home-manager/modules` and
+ # `$HOME/.nixpkgs/home-manager/modules`.
+, modulesPath ? null
+}:
let
@@ -16,6 +22,8 @@ let
}
'';
+ modulesPathStr = if modulesPath == null then "" else modulesPath;
+
in
pkgs.stdenv.mkDerivation {
@@ -29,7 +37,7 @@ pkgs.stdenv.mkDerivation {
substituteInPlace $out/bin/home-manager \
--subst-var-by bash "${pkgs.bash}" \
--subst-var-by coreutils "${pkgs.coreutils}" \
- --subst-var-by MODULES_PATH '${modulesPath}' \
+ --subst-var-by MODULES_PATH '${modulesPathStr}' \
--subst-var-by HOME_MANAGER_EXPR_PATH "${homeManagerExpr}"
'';
diff --git a/home-manager/home-manager b/home-manager/home-manager
index cdc68cf2546..6f8e4f60d83 100644
--- a/home-manager/home-manager
+++ b/home-manager/home-manager
@@ -39,6 +39,7 @@ function setConfigFile() {
function setHomeManagerModulesPath() {
local modulesPath
for modulesPath in "@MODULES_PATH@" \
+ "$HOME/.config/nixpkgs/home-manager/modules" \
"$HOME/.nixpkgs/home-manager/modules" ; do
if [[ -e "$modulesPath" ]] ; then
export NIX_PATH="$NIX_PATH${NIX_PATH:+:}home-manager=$modulesPath"