aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--default.nix16
-rw-r--r--home-manager/default.nix13
-rw-r--r--home-manager/home-manager18
-rw-r--r--home-manager/home-manager.nix2
-rw-r--r--modules/misc/news.nix40
-rw-r--r--modules/programs/home-manager.nix28
6 files changed, 96 insertions, 21 deletions
diff --git a/default.nix b/default.nix
index d9024779c74..b9eedd47041 100644
--- a/default.nix
+++ b/default.nix
@@ -1,2 +1,14 @@
-# Simply defer to the home-manager script derivation.
-import ./home-manager
+{ pkgs ? import <nixpkgs> {} }:
+
+rec {
+ home-manager = import ./home-manager {
+ inherit pkgs;
+ path = ./.;
+ };
+
+ install =
+ pkgs.runCommand
+ "home-manager-install"
+ { propagatedBuildInputs = [ home-manager ]; }
+ "";
+}
diff --git a/home-manager/default.nix b/home-manager/default.nix
index 5fed40554f7..943d61e81b2 100644
--- a/home-manager/default.nix
+++ b/home-manager/default.nix
@@ -1,14 +1,14 @@
{ 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
+ # Extra path to Home Manager. If set then this path will be tried
+ # before `$HOME/.config/nixpkgs/home-manager` and
+ # `$HOME/.nixpkgs/home-manager`.
+, path ? null
}:
let
- modulesPathStr = if modulesPath == null then "" else modulesPath;
+ pathStr = if path == null then "" else path;
in
@@ -24,8 +24,7 @@ pkgs.stdenv.mkDerivation {
--subst-var-by bash "${pkgs.bash}" \
--subst-var-by coreutils "${pkgs.coreutils}" \
--subst-var-by less "${pkgs.less}" \
- --subst-var-by MODULES_PATH '${modulesPathStr}' \
- --subst-var-by HOME_MANAGER_EXPR_PATH "${./home-manager.nix}"
+ --subst-var-by HOME_MANAGER_PATH '${pathStr}'
'';
meta = with pkgs.stdenv.lib; {
diff --git a/home-manager/home-manager b/home-manager/home-manager
index 55c717eea1e..6bfc46e6606 100644
--- a/home-manager/home-manager
+++ b/home-manager/home-manager
@@ -40,13 +40,13 @@ function setConfigFile() {
exit 1
}
-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"
+function setHomeManagerNixPath() {
+ local path
+ for path in "@HOME_MANAGER_PATH@" \
+ "$HOME/.config/nixpkgs/home-manager" \
+ "$HOME/.nixpkgs/home-manager" ; do
+ if [[ -e "$path" || "$path" =~ ^https?:// ]] ; then
+ export NIX_PATH="$NIX_PATH${NIX_PATH:+:}home-manager=$path"
return
fi
done
@@ -54,7 +54,7 @@ function setHomeManagerModulesPath() {
function doBuildAttr() {
setConfigFile
- setHomeManagerModulesPath
+ setHomeManagerNixPath
local extraArgs="$*"
@@ -67,7 +67,7 @@ function doBuildAttr() {
fi
nix-build \
- "@HOME_MANAGER_EXPR_PATH@" \
+ "<home-manager/home-manager/home-manager.nix>" \
$extraArgs \
--argstr confPath "$HOME_MANAGER_CONFIG" \
--argstr confAttr "$HOME_MANAGER_CONFIG_ATTRIBUTE"
diff --git a/home-manager/home-manager.nix b/home-manager/home-manager.nix
index a6c9259f874..206a1bcefa3 100644
--- a/home-manager/home-manager.nix
+++ b/home-manager/home-manager.nix
@@ -9,7 +9,7 @@ with pkgs.lib;
let
- env = import <home-manager> {
+ env = import <home-manager/modules> {
configuration =
let
conf = import confPath;
diff --git a/modules/misc/news.nix b/modules/misc/news.nix
index f14248ecb87..b17b0454257 100644
--- a/modules/misc/news.nix
+++ b/modules/misc/news.nix
@@ -370,6 +370,46 @@ in
chosen version.
'';
}
+
+ {
+ time = "2017-10-23T22:54:33+00:00";
+ condition = config.programs.home-manager.modulesPath != null;
+ message = ''
+ The 'programs.home-manager.modulesPath' option is now
+ deprecated and will be removed on November 24, 2017. Please
+ use the option 'programs.home-manager.path' instead.
+ '';
+ }
+
+ {
+ time = "2017-10-23T23:10:29+00:00";
+ condition = !config.programs.home-manager.enable;
+ message = ''
+ Unfortunately, due to some internal restructuring it is no
+ longer possible to install the home-manager command when
+ having
+
+ home-manager = import ./home-manager { inherit pkgs; };
+
+ in the '~/.config/nixpkgs/config.nix' package override
+ section. Attempting to use the above override will now
+ result in the error "cannot coerce a set to a string".
+
+ To resolve this please delete the override from the
+ 'config.nix' file and either link the Home Manager overlay
+
+ $ ln -s ~/.config/nixpkgs/home-manager/overlay.nix \
+ ~/.config/nixpkgs/overlays/home-manager.nix
+
+ or add
+
+ programs.home-manager.enable = true;
+
+ to your Home Manager configuration. The latter is
+ recommended as the home-manager tool then is updated
+ automatically whenever you do a switch.
+ '';
+ }
];
};
}
diff --git a/modules/programs/home-manager.nix b/modules/programs/home-manager.nix
index ad7278a12f0..2fac0bce353 100644
--- a/modules/programs/home-manager.nix
+++ b/modules/programs/home-manager.nix
@@ -16,6 +16,19 @@ in
programs.home-manager = {
enable = mkEnableOption "Home Manager";
+ path = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ example = "$HOME/devel/home-manager";
+ description = ''
+ The default path to use for Home Manager. If this path does
+ not exist then
+ <filename>$HOME/.config/nixpkgs/home-manager</filename> and
+ <filename>$HOME/.nixpkgs/home-manager</filename> will be
+ attempted.
+ '';
+ };
+
modulesPath = mkOption {
type = types.nullOr types.str;
default = null;
@@ -25,17 +38,28 @@ in
path does not exist then
<filename>$HOME/.config/nixpkgs/home-manager/modules</filename>
and <filename>$HOME/.nixpkgs/home-manager/modules</filename>
- will be attempted.
+ will be attempted. DEPRECATED: Use
+ <varname>programs.home-manager.path</varname> instead.
'';
};
};
};
config = mkIf cfg.enable {
+ assertions = [{
+ assertion = cfg.path == null || cfg.modulesPath == null;
+ message = "Cannot simultaneously use "
+ + "'programs.home-manager.path' and "
+ + "'programs.home-manager.modulesPath'.";
+ }];
+
home.packages = [
(import ../../home-manager {
inherit pkgs;
- inherit (cfg) modulesPath;
+ path =
+ if cfg.modulesPath != null
+ then "$(dirname ${cfg.modulesPath})"
+ else cfg.path;
})
];