-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Expand file tree
/
Copy pathnextcloud-client.nix
More file actions
56 lines (48 loc) · 1.32 KB
/
nextcloud-client.nix
File metadata and controls
56 lines (48 loc) · 1.32 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
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.nextcloud-client;
in
{
options = {
services.nextcloud-client = {
enable = lib.mkEnableOption "Nextcloud Client";
package = lib.mkPackageOption pkgs "nextcloud-client" { };
startInBackground = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether to start the Nextcloud client in the background.";
};
};
};
config = lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.nextcloud-client" pkgs lib.platforms.linux)
];
systemd.user.services.nextcloud-client = {
Unit = {
Description = "Nextcloud Client";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Environment = [ "PATH=${config.home.profileDirectory}/bin" ];
ExecStart =
"${cfg.package}/bin/nextcloud" + (lib.optionalString cfg.startInBackground " --background");
ExecStop = "${cfg.package}/bin/nextcloud --quit";
KillMode = "process";
Restart = "on-failure";
RestartSec = "5s";
NoNewPrivileges = true;
RestrictRealtime = true;
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
};
}