2018-11-23 10:43:13 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2021-01-15 11:57:58 +01:00
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.nextcloud-client;
|
|
|
|
|
|
|
|
in {
|
2018-11-23 10:43:13 +01:00
|
|
|
options = {
|
2021-01-15 11:57:58 +01:00
|
|
|
services.nextcloud-client = {
|
|
|
|
enable = mkEnableOption "Nextcloud Client";
|
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.nextcloud-client;
|
2021-10-09 11:14:08 +02:00
|
|
|
defaultText = literalExpression "pkgs.nextcloud-client";
|
2021-01-15 11:57:58 +01:00
|
|
|
description = "The package to use for the nextcloud client binary.";
|
|
|
|
};
|
2021-05-27 18:54:20 +02:00
|
|
|
|
|
|
|
startInBackground = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description =
|
|
|
|
"Whether to start the Nextcloud client in the background.";
|
|
|
|
};
|
2021-01-15 11:57:58 +01:00
|
|
|
};
|
2018-11-23 10:43:13 +01:00
|
|
|
};
|
|
|
|
|
2021-01-15 11:57:58 +01:00
|
|
|
config = mkIf cfg.enable {
|
2021-07-07 23:24:27 +02:00
|
|
|
assertions = [
|
|
|
|
(lib.hm.assertions.assertPlatform "services.nextcloud-client" pkgs
|
|
|
|
lib.platforms.linux)
|
|
|
|
];
|
|
|
|
|
2018-11-23 10:43:13 +01:00
|
|
|
systemd.user.services.nextcloud-client = {
|
|
|
|
Unit = {
|
|
|
|
Description = "Nextcloud Client";
|
|
|
|
After = [ "graphical-session-pre.target" ];
|
|
|
|
PartOf = [ "graphical-session.target" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
Service = {
|
2024-09-19 18:18:08 +02:00
|
|
|
Environment = [ "PATH=${config.home.profileDirectory}/bin" ];
|
2021-05-27 18:54:20 +02:00
|
|
|
ExecStart = "${cfg.package}/bin/nextcloud"
|
|
|
|
+ (optionalString cfg.startInBackground " --background");
|
2018-11-23 10:43:13 +01:00
|
|
|
};
|
|
|
|
|
2020-02-02 00:39:17 +01:00
|
|
|
Install = { WantedBy = [ "graphical-session.target" ]; };
|
2018-11-23 10:43:13 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|