mirror of
https://github.com/nix-community/home-manager
synced 2024-06-02 21:13:33 +02:00
28d3f74614
The user-defined path will be used if present, otherwise the two "fallback" defaults (in `.nixpkgs` and `.config/nixpkgs`) will be used.
50 lines
1.2 KiB
Nix
50 lines
1.2 KiB
Nix
{ 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
|
|
|
|
homeManagerExpr = pkgs.writeText "home-manager.nix" ''
|
|
{ pkgs ? import <nixpkgs> {}, confPath }:
|
|
|
|
let
|
|
env = import <home-manager> {
|
|
configuration = import confPath;
|
|
pkgs = pkgs;
|
|
};
|
|
in
|
|
{
|
|
inherit (env) activation-script;
|
|
}
|
|
'';
|
|
|
|
modulesPathStr = if modulesPath == null then "" else modulesPath;
|
|
|
|
in
|
|
|
|
pkgs.stdenv.mkDerivation {
|
|
name = "home-manager";
|
|
|
|
phases = [ "installPhase" ];
|
|
|
|
installPhase = ''
|
|
install -v -D -m755 ${./home-manager} $out/bin/home-manager
|
|
|
|
substituteInPlace $out/bin/home-manager \
|
|
--subst-var-by bash "${pkgs.bash}" \
|
|
--subst-var-by coreutils "${pkgs.coreutils}" \
|
|
--subst-var-by MODULES_PATH '${modulesPathStr}' \
|
|
--subst-var-by HOME_MANAGER_EXPR_PATH "${homeManagerExpr}"
|
|
'';
|
|
|
|
meta = with pkgs.stdenv.lib; {
|
|
description = "A user environment configurator";
|
|
maintainers = [ maintainers.rycee ];
|
|
platforms = platforms.linux;
|
|
};
|
|
}
|