1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-15 23:59:45 +01:00
home-manager/modules/services/nextcloud-client.nix
Ilan Joselevich ddf35436b7
nextcloud-client: add startInBackground option (#2038)
* nextcloud-client: add runInBackground option

* nextcloud-client: Change runInBackground description

Co-authored-by: Sumner Evans <me@sumnerevans.com>

* nextcloud-client: Use optionalString for the runInBackground option

Co-authored-by: Sumner Evans <me@sumnerevans.com>

* nextcloud-client: Remove "defaultText" in the runInBackground option

* nextcloud-client: Fixed formatting

* nextcloud-client: Rename runInBackground to startInBackground

Co-authored-by: Sumner Evans <me@sumnerevans.com>
2021-05-27 10:54:20 -06:00

47 lines
1.1 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.nextcloud-client;
in {
options = {
services.nextcloud-client = {
enable = mkEnableOption "Nextcloud Client";
package = mkOption {
type = types.package;
default = pkgs.nextcloud-client;
defaultText = literalExample "pkgs.nextcloud-client";
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.";
};
};
};
config = mkIf cfg.enable {
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");
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
}