-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphoenix.nix
101 lines (101 loc) · 3.07 KB
/
phoenix.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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
{
pkgs,
userSettings,
...
}:
# TODO make this work on nix-on-droid!
let
myScript =
''
if [ "$1" = "sync" ]; then
if [ "$#" = 1 ]; then
''
+ userSettings.dotfilesDir
+ '' /sync.sh;
exit 0;
elif [ "$2" = "user" ]; then
''
+ userSettings.dotfilesDir
+ '' /sync-user.sh;
exit 0;
elif [ "$2" = "system" ]; then
''
+ userSettings.dotfilesDir
+ '' /sync-system.sh;
exit 0;
else
echo "Please pass 'system' or 'user' if supplying a second argument"
fi
elif [ "$1" = "refresh" ]; then
if [ "$#" -gt 1 ]; then
echo "Warning: The 'refresh' command has no subcommands (no $2 subcommand)";
fi
''
+ userSettings.dotfilesDir
+ '' /sync-posthook.sh;
exit 0;
elif [ "$1" = "update" ]; then
if [ "$#" -gt 1 ]; then
echo "Warning: The 'update' command has no subcommands (no $2 subcommand)";
fi
''
+ userSettings.dotfilesDir
+ '' /update.sh;
exit 0;
elif [ "$1" = "upgrade" ]; then
if [ "$#" -gt 1 ]; then
echo "Warning: The 'update' command has no subcommands (no $2 subcommand)";
fi
''
+ userSettings.dotfilesDir
+ '' /upgrade.sh;
exit 0;
elif [ "$1" = "pull" ]; then
if [ "$#" -gt 1 ]; then
echo "Warning: The 'upgrade' command has no subcommands (no $2 subcommand)";
fi
''
+ userSettings.dotfilesDir
+ '' /pull.sh;
exit 0;
elif [ "$1" = "harden" ]; then
if [ "$#" -gt 1 ]; then
echo "Warning: The 'harden' command has no subcommands (no $2 subcommand)";
fi
''
+ userSettings.dotfilesDir
+ '' /harden.sh;
exit 0;
elif [ "$1" = "soften" ]; then
if [ "$#" -gt 1 ]; then
echo "Warning: The 'soften' command has no subcommands (no $2 subcommand)";
fi
''
+ userSettings.dotfilesDir
+ '' /soften.sh;
exit 0;
elif [ "$1" = "gc" ]; then
if [ "$#" -gt 2 ]; then
echo "Warning: The 'gc' command only accepts one argument (collect_older_than)";
fi
if [ "$2" = "full" ]; then
sudo nix-collect-garbage --delete-old;
nix-collect-garbage --delete-old;
elif [ "$2" ]; then
sudo nix-collect-garbage --delete-older-than $2;
nix-collect-garbage --delete-older-than $2;
else
sudo nix-collect-garbage --delete-older-than 30d;
nix-collect-garbage --delete-older-than 30d;
fi
fi
'';
in {
environment.systemPackages = [
pkgs.nix-output-monitor
pkgs.nvd
pkgs.nvdtools
pkgs.nh
(pkgs.writeScriptBin "phoenix" myScript)
];
}