blob: 9dd8766579daa5dbbb4250369fc4c0ad27f670df (
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
|
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.system;
in
{
options = {
};
config = {
system.build.applications = pkgs.buildEnv {
name = "system-applications";
paths = config.environment.systemPackages;
pathsToLink = "/Applications";
};
system.activationScripts.applications.text = ''
# Set up applications.
echo "setting up /Applications/Nix Apps..." >&2
ourLink () {
local link
link=$(readlink "$1")
[ -L "$1" ] && [ "''${link#*-}" = 'system-applications/Applications' ]
}
# Clean up for links created at the old location in HOME
if ourLink ~/Applications; then
rm ~/Applications
elif ourLink ~/Applications/'Nix Apps'; then
rm ~/Applications/'Nix Apps'
fi
if [ ! -e '/Applications/Nix Apps' ] \
|| ourLink '/Applications/Nix Apps'; then
ln -sfn ${cfg.build.applications}/Applications '/Applications/Nix Apps'
else
echo "warning: /Applications/Nix Apps is not owned by nix-darwin, skipping App linking..." >&2
fi
'';
};
}
|