1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-27 12:19:48 +01:00
home-manager/modules/services/nextcloud-client.nix

53 lines
1.3 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
with lib;
2021-01-15 11:57:58 +01:00
let
cfg = config.services.nextcloud-client;
in {
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;
defaultText = literalExpression "pkgs.nextcloud-client";
2021-01-15 11:57:58 +01: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.";
};
2021-01-15 11:57:58 +01:00
};
};
2021-01-15 11:57:58 +01:00
config = 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-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Environment = [ "PATH=${config.home.profileDirectory}/bin" ];
ExecStart = "${cfg.package}/bin/nextcloud"
+ (optionalString cfg.startInBackground " --background");
};
2020-02-02 00:39:17 +01:00
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
}