2020-10-12 00:22:58 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2021-07-02 22:36:30 +00:00
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.nextcloud-client;
|
|
|
|
|
|
|
|
in {
|
2020-10-12 00:22:58 +00:00
|
|
|
options = {
|
2021-07-02 22:36:30 +00:00
|
|
|
services.nextcloud-client = {
|
|
|
|
enable = mkEnableOption "Nextcloud Client";
|
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.nextcloud-client;
|
2021-11-04 16:42:44 +00:00
|
|
|
defaultText = literalExpression "pkgs.nextcloud-client";
|
2021-07-02 22:36:30 +00:00
|
|
|
description = "The package to use for the nextcloud client binary.";
|
|
|
|
};
|
|
|
|
|
|
|
|
startInBackground = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description =
|
|
|
|
"Whether to start the Nextcloud client in the background.";
|
|
|
|
};
|
|
|
|
};
|
2020-10-12 00:22:58 +00:00
|
|
|
};
|
|
|
|
|
2021-07-02 22:36:30 +00:00
|
|
|
config = mkIf cfg.enable {
|
2021-11-04 16:42:44 +00:00
|
|
|
assertions = [
|
|
|
|
(lib.hm.assertions.assertPlatform "services.nextcloud-client" pkgs
|
|
|
|
lib.platforms.linux)
|
|
|
|
];
|
|
|
|
|
2020-10-12 00:22:58 +00:00
|
|
|
systemd.user.services.nextcloud-client = {
|
|
|
|
Unit = {
|
|
|
|
Description = "Nextcloud Client";
|
|
|
|
After = [ "graphical-session-pre.target" ];
|
|
|
|
PartOf = [ "graphical-session.target" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
Service = {
|
|
|
|
Environment = "PATH=${config.home.profileDirectory}/bin";
|
2021-07-02 22:36:30 +00:00
|
|
|
ExecStart = "${cfg.package}/bin/nextcloud"
|
|
|
|
+ (optionalString cfg.startInBackground " --background");
|
2020-10-12 00:22:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Install = { WantedBy = [ "graphical-session.target" ]; };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|