aboutsummaryrefslogtreecommitdiff
path: root/home-manager/default.nix
blob: a5853961792ef5d5a7a644c4b6929254c72b9993 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ 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

  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 "${./home-manager.nix}"
  '';

  meta = with pkgs.stdenv.lib; {
    description = "A user environment configurator";
    maintainers = [ maintainers.rycee ];
    platforms = platforms.linux;
  };
}