-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
47 lines (44 loc) · 1.34 KB
/
default.nix
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
{ sources ? import ./npins
, nixpkgs ? sources."nixos-23.11"
, home-manager ? sources.home-manager
, ...
}:
let
nixpkgs-path = nixpkgs;
home-manager-path = home-manager;
in
{
mkHomeScriptWrapper =
{
# Path to user defined home-manager specific configuration
home-config-path,
# Name of attribute in the attribute set in home-config-path to use as the
# root attribute set for home-manager configuration
# When empty string - uses attribute set in home-config-path as root
home-attribute ? "",
# Path to nixpkgs used by home-manager modules
nixpkgs ? nixpkgs-path,
# Package set for building the home-manager cli and this wrapper
pkgs ? import nixpkgs { },
home-manager ? home-manager-path,
home-manager-tool ? "$HOME/.nix-profile/bin/home-manager",
fallback-tool ?
(pkgs.callPackage
(home-manager + "/home-manager")
{ path = null; }
) + "/bin/home-manager",
}:
pkgs.writeShellScriptBin "home-manager" ''
home_tool="${fallback-tool}"
primary_home_tool="${home-manager-tool}"
if [[ -x $primary_home_tool ]] ; then
home_tool="$primary_home_tool"
fi
exec $home_tool \
-A "${home-attribute}" \
-I nixpkgs=${nixpkgs} \
-I home-manager=${home-manager} \
--file ${home-config-path} \
"$@"
'';
}