2.home-manager/modules/services/nextcloud-client/default.nix
Austin Horstman 4fca600cb1 treewide: implement auto importing for modules
Reduce maintenance burden and increase efficiency by automatically
importing modules following a specific convention.

Co-authored-by: awwpotato <awwpotato@voidq.com>
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-06-22 23:58:37 -05:00

50 lines
1.1 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.nextcloud-client;
in
{
options = {
services.nextcloud-client = {
enable = lib.mkEnableOption "Nextcloud Client";
package = lib.mkPackageOption pkgs "nextcloud-client" { };
startInBackground = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether to start the Nextcloud client in the background.";
};
};
};
config = lib.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.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Environment = [ "PATH=${config.home.profileDirectory}/bin" ];
ExecStart =
"${cfg.package}/bin/nextcloud" + (lib.optionalString cfg.startInBackground " --background");
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
};
}