-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.nix
More file actions
74 lines (63 loc) · 2.61 KB
/
Copy pathmodule.nix
File metadata and controls
74 lines (63 loc) · 2.61 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
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.services.sunshine;
in
{
options = {
services.sunshine = {
enable = mkEnableOption "sunshine";
extraConfig = mkOption {
type = types.lines;
default = "";
example = ''
gc:
onInterval: true # true=daily, false=never or string containing cron interval
onLowSpace: 2147483648 # 2gb, 0 to disable, will trigger every minute and check threshold on /nix/store partition
keepDays: 7 # how many days to keep old, unused stuff arround for rollbacks
maxFree: 0 # _only_ free _up to_ this much space, 0=ignore
system:
upgrade: # affects nixos-rebuild
silentFetch: true # fetch channels silently, true=daily false=never or string in cron interval
silentPrepare: true # prefetch already built derivations from cache but don't build anything just yet, will not run on paid networks (e.g. mobile)
forceSilentPrepare: false # always run silentPrepare
silentApplyForNextBoot: true # build with nixos-rebuild boot so update gets applied on next boot
notifyUpdateAvailable: true # make a notification to apply update during current boot
rollback:
checks:
sanityCheck: true # perform checks while the system is running
grubFlag: false # add settings to grub to auto-rollback
allowAuto: critical # never, critical, always - change when auto-rollbacks are done
user:
upgrade: # affects nix-env
silentFetch: true # fetch channels silently, true=daily false=never or string in cron interval
silentPrepare: true # prefetch already built derivations from cache but don't build anything just yet, will not run on paid networks (e.g. mobile)
forceSilentPrepare: false # always run silentPrepare
cooldownMsAfterBoot: 18000000 # 5 min
'';
};
};
};
config = mkIf cfg.enable {
systemd.services.sunshine = {
description = "System update daemon";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
environment = {
SUNSHINE_SYSTEMD = "1";
};
path = [ pkgs.sunshine config.nix.package ];
script = ''
export HOME=/root
source /etc/set-environment
${pkgs.sunshine}/bin/sunshine
'';
serviceConfig = {
Restart = "on-failure";
LimitNOFILE = 500000;
LimitNPROC = 500000;
};
};
environment.etc."sunshine.yaml".text = cfg.extraConfig;
};
}