nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 bash,
4 coreutils,
5 fetchFromGitHub,
6 findutils,
7 gettext,
8 gnused,
9 inetutils,
10 installShellFiles,
11 jq,
12 less,
13 ncurses,
14 nixos-option,
15 stdenvNoCC,
16 unixtools,
17 unstableGitUpdater,
18}:
19
20stdenvNoCC.mkDerivation (finalAttrs: {
21 pname = "home-manager";
22 version = "0-unstable-2025-07-28";
23
24 src = fetchFromGitHub {
25 name = "home-manager-source";
26 owner = "nix-community";
27 repo = "home-manager";
28 rev = "f49e872f55e36e67ebcb906ff65f86c7a1538f7c";
29 hash = "sha256-vojVM0SgFP8crFh1LDDXkzaI9/er/1cuRfbNPhfBHyc=";
30 };
31
32 nativeBuildInputs = [
33 gettext
34 installShellFiles
35 ];
36
37 dontConfigure = true;
38 dontBuild = true;
39
40 installPhase = ''
41 runHook preInstall
42
43 install -D -m755 home-manager/home-manager $out/bin/home-manager
44 install -D -m755 lib/bash/home-manager.sh $out/share/bash/home-manager.sh
45
46 installShellCompletion --cmd home-manager \
47 --bash home-manager/completion.bash \
48 --fish home-manager/completion.fish \
49 --zsh home-manager/completion.zsh
50
51 for pofile in home-manager/po/*.po; do
52 lang="''${pofile##*/}"
53 lang="''${lang%%.*}"
54 mkdir -p "$out/share/locale/$lang/LC_MESSAGES"
55 msgfmt -o "$out/share/locale/$lang/LC_MESSAGES/home-manager.mo" "$pofile"
56 done
57
58 runHook postInstall
59 '';
60
61 postFixup = ''
62 substituteInPlace $out/bin/home-manager \
63 --subst-var-by bash "${bash}" \
64 --subst-var-by DEP_PATH "${
65 lib.makeBinPath [
66 coreutils
67 findutils
68 gettext
69 gnused
70 jq
71 less
72 ncurses
73 nixos-option
74 inetutils # for `hostname`
75 ]
76 }" \
77 --subst-var-by HOME_MANAGER_LIB "$out/share/bash/home-manager.sh" \
78 --subst-var-by HOME_MANAGER_PATH "${finalAttrs.src}" \
79 --subst-var-by OUT "$out"
80 '';
81
82 passthru.updateScript = unstableGitUpdater {
83 url = "https://github.com/nix-community/home-manager/";
84 };
85
86 meta = {
87 homepage = "https://nix-community.github.io/home-manager/";
88 description = "Nix-based user environment configurator";
89 longDescription = ''
90 The Home-Manager project provides a basic system for managing a user
91 environment using the Nix package manager together with the Nix libraries
92 found in Nixpkgs. It allows declarative configuration of user specific
93 (non global) packages and dotfiles.
94 '';
95 license = lib.licenses.mit;
96 mainProgram = "home-manager";
97 maintainers = with lib.maintainers; [ bryango ];
98 platforms = lib.platforms.unix;
99 };
100})