forked from nix-community/home-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.nix
More file actions
79 lines (70 loc) · 1.91 KB
/
default.nix
File metadata and controls
79 lines (70 loc) · 1.91 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
runCommand,
lib,
bash,
callPackage,
coreutils,
findutils,
gettext,
gnused,
jq,
less,
ncurses,
inetutils,
# used for pkgs.path for nixos-option
pkgs,
# Path to use as the Home Manager channel.
path ? null,
}:
let
pathStr = if path == null then "" else path;
nixos-option =
pkgs.nixos-option or (callPackage (pkgs.path + "/nixos/modules/installer/tools/nixos-option") { });
in
runCommand "home-manager"
{
preferLocalBuild = true;
nativeBuildInputs = [ gettext ];
meta = {
mainProgram = "home-manager";
description = "A user environment configurator";
maintainers = [ lib.maintainers.rycee ];
platforms = lib.platforms.unix;
license = lib.licenses.mit;
};
}
''
install -v -D -m755 ${./home-manager} $out/bin/home-manager
substituteInPlace $out/bin/home-manager \
--subst-var-by bash "${bash}" \
--subst-var-by DEP_PATH "${
lib.makeBinPath [
coreutils
findutils
gettext
gnused
jq
less
ncurses
nixos-option
inetutils # for `hostname`
]
}" \
--subst-var-by HOME_MANAGER_LIB '${../lib/bash/home-manager.sh}' \
--subst-var-by HOME_MANAGER_PATH '${pathStr}' \
--subst-var-by OUT "$out"
install -D -m755 ${./completion.bash} \
$out/share/bash-completion/completions/home-manager
install -D -m755 ${./completion.zsh} \
$out/share/zsh/site-functions/_home-manager
install -D -m755 ${./completion.fish} \
$out/share/fish/vendor_completions.d/home-manager.fish
install -D -m755 ${../lib/bash/home-manager.sh} \
"$out/share/bash/home-manager.sh"
for path in ${./po}/*.po; do
lang="''${path##*/}"
lang="''${lang%%.*}"
mkdir -p "$out/share/locale/$lang/LC_MESSAGES"
msgfmt -o "$out/share/locale/$lang/LC_MESSAGES/home-manager.mo" "$path"
done
''