blob: 550cc69b449c7391fdf527b543dbd91fb4fbb3ff (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
{ self, home-manager, ... } @ inputs:
{ username, hostname, pkgs, version, extraModules ? null }:
let
entrypoint = "${self}/home/${hostname}/${username}.nix";
defaultModule = { lib, config, ... }: {
_module.args.inputs = self.inputs;
_module.args.self = self;
manual = {
html.enable = false;
manpages.enable = false;
json.enable = false;
};
home = {
inherit username;
homeDirectory = if pkgs.stdenv.isDarwin then "/Users/${username}" else "/home/${username}";
stateVersion = version;
};
# Make applications pop up in finder/spotlight
disabledModules = [ "targets/darwin/linkapps.nix" ];
home.activation = lib.mkIf pkgs.stdenv.isDarwin {
copyApplications =
let
apps = pkgs.buildEnv {
name = "home-manager-applications";
paths = config.home.packages;
pathsToLink = "/Applications";
};
in
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
baseDir="$HOME/Applications/Home Manager Apps"
if [ -d "$baseDir" ]; then
rm -rf "$baseDir"
fi
mkdir -p "$baseDir"
for appFile in ${apps}/Applications/*; do
target="$baseDir/$(basename "$appFile")"
$DRY_RUN_CMD cp ''${VERBOSE_ARG:+-v} -fHRL "$appFile" "$baseDir"
$DRY_RUN_CMD chmod ''${VERBOSE_ARG:+-v} -R +w "$target"
done
'';
};
};
in
home-manager.lib.homeManagerConfiguration {
pkgs = pkgs;
modules = [
defaultModule
entrypoint
] ++ pkgs.lib.optionals (extraModules != null) extraModules;
}
|