2022-08-13 02:37:04 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.pueue;
|
|
|
|
yamlFormat = pkgs.formats.yaml { };
|
2024-03-01 08:07:06 +00:00
|
|
|
configFile =
|
|
|
|
yamlFormat.generate "pueue.yaml" ({ shared = { }; } // cfg.settings);
|
2022-08-13 02:37:04 +00:00
|
|
|
|
|
|
|
in {
|
|
|
|
meta.maintainers = [ maintainers.AndersonTorres ];
|
|
|
|
|
|
|
|
options.services.pueue = {
|
2023-07-01 23:45:18 +00:00
|
|
|
enable = mkEnableOption "Pueue, CLI process scheduler and manager";
|
2022-08-13 02:37:04 +00:00
|
|
|
|
2023-07-01 23:45:18 +00:00
|
|
|
package = mkPackageOption pkgs "pueue" { };
|
2022-08-13 02:37:04 +00:00
|
|
|
|
|
|
|
settings = mkOption {
|
|
|
|
type = yamlFormat.type;
|
|
|
|
default = { };
|
|
|
|
example = literalExpression ''
|
|
|
|
{
|
|
|
|
daemon = {
|
|
|
|
default_parallel_tasks = 2;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
'';
|
2023-07-01 23:45:18 +00:00
|
|
|
description = ''
|
2022-08-13 02:37:04 +00:00
|
|
|
Configuration written to
|
2023-06-30 23:30:13 +00:00
|
|
|
{file}`$XDG_CONFIG_HOME/pueue/pueue.yml`.
|
2022-08-13 02:37:04 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
assertions =
|
|
|
|
[ (hm.assertions.assertPlatform "services.pueue" pkgs platforms.linux) ];
|
|
|
|
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
|
2024-03-01 08:07:06 +00:00
|
|
|
xdg.configFile."pueue/pueue.yml".source = configFile;
|
2022-08-13 02:37:04 +00:00
|
|
|
|
|
|
|
systemd.user = {
|
|
|
|
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" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|