1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-06 00:51:04 +01:00
home-manager/modules/services/pueue.nix
Austin Horstman cba2f9ce95 treewide: reformat nixfmt-rfc-style
Reformat repository using new nixfmt-rfc-style.
2025-04-08 08:50:05 -07:00

64 lines
1.4 KiB
Nix

{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.services.pueue;
yamlFormat = pkgs.formats.yaml { };
configFile = yamlFormat.generate "pueue.yaml" ({ shared = { }; } // cfg.settings);
in
{
meta.maintainers = [ maintainers.AndersonTorres ];
options.services.pueue = {
enable = mkEnableOption "Pueue, CLI process scheduler and manager";
package = mkPackageOption pkgs "pueue" { nullable = true; };
settings = mkOption {
type = yamlFormat.type;
default = { };
example = literalExpression ''
{
daemon = {
default_parallel_tasks = 2;
};
}
'';
description = ''
Configuration written to
{file}`$XDG_CONFIG_HOME/pueue/pueue.yml`.
'';
};
};
config = mkIf cfg.enable {
assertions = [ (hm.assertions.assertPlatform "services.pueue" pkgs platforms.linux) ];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."pueue/pueue.yml".source = configFile;
systemd.user = lib.mkIf (cfg.package != null) {
services.pueued = {
Unit = {
Description = "Pueue Daemon - CLI process scheduler and manager";
};
Service = {
Restart = "on-failure";
ExecStart = "${cfg.package}/bin/pueued -v -c ${configFile}";
};
Install.WantedBy = [ "default.target" ];
};
};
};
}