fork/home-manager
git clone https://git.julia.blue/fork/home-manager
4fa1ba72
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . services . nextcloud-client ; 8 9in { 10options = { 11services . nextcloud-client = { 12enable = mkEnableOption "Nextcloud Client" ; 13 14package = mkOption { 15type = types . package ; 16default = pkgs . nextcloud-client ; 17defaultText = literalExpression "pkgs.nextcloud-client" ; 18description = "The package to use for the nextcloud client binary." ; 19}; 20 21startInBackground = mkOption { 22type = types . bool ; 23default = false ; 24description = 25"Whether to start the Nextcloud client in the background." ; 26}; 27}; 28}; 29 30config = mkIf cfg . enable { 31assertions = [ 32( lib . hm . assertions . assertPlatform "services.nextcloud-client" pkgs 33lib . platforms . linux ) 34]; 35 36systemd . user . services . nextcloud-client = { 37Unit = { 38Description = "Nextcloud Client" ; 39After = [ "graphical-session-pre.target" ]; 40PartOf = [ "graphical-session.target" ]; 41}; 42 43Service = { 44Environment = "PATH= ${ config . home . profileDirectory } /bin" ; 45ExecStart = " ${ cfg . package } /bin/nextcloud" 46+ ( optionalString cfg . startInBackground " --background" ); 47}; 48 49Install = { WantedBy = [ "graphical-session.target" ]; }; 50}; 51}; 52}