Files
home-manager/modules/services/pueue.nix
Robert Helgesson 9bfca5b3a7 tree-wide: remove redundant platform checks
In the code base, there are lots of configurations locally guarded by
`stdenv.hostPlatform.is(Darwin|Linux)` despite the targeted options
already being guarded. Examples for these targeted options are:

- `systemd.user.*`: globally guarded by `systemd.user.enable`.
- `launchd.*`: globally guarded by `launchd.enable`.
- `lib.hm.darwin.assertInterval`: only effective on Darwin.

These local guards are an antipattern since they weaken the global
guards. Furthermore, they hamper readability. This series of commits
remove instances of these local guards.
2026-01-06 13:13:38 +01:00

84 lines
2.0 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.pueue;
yamlFormat = pkgs.formats.yaml { };
configFile = yamlFormat.generate "pueue.yaml" ({ shared = { }; } // cfg.settings);
pueuedBin = "${cfg.package}/bin/pueued";
in
{
meta.maintainers = [ ];
options.services.pueue = {
enable = lib.mkEnableOption "Pueue, CLI process scheduler and manager";
package = lib.mkPackageOption pkgs "pueue" { nullable = true; };
settings = lib.mkOption {
type = yamlFormat.type;
default = { };
example = lib.literalExpression ''
{
daemon = {
default_parallel_tasks = 2;
};
}
'';
description = ''
Configuration written to
{file}`$XDG_CONFIG_HOME/pueue/pueue.yml`.
'';
};
};
config = lib.mkIf cfg.enable {
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."pueue/pueue.yml" = lib.mkIf pkgs.stdenv.isLinux { 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 = "${pueuedBin} -v -c ${configFile}";
};
Install.WantedBy = [ "default.target" ];
};
};
# This is the default configuration file location for pueue on
# darwin (https://github.com/Nukesor/pueue/wiki/Configuration)
home.file."Library/Application Support/pueue/pueue.yml" = lib.mkIf pkgs.stdenv.isDarwin {
source = configFile;
};
launchd.agents.pueued = lib.mkIf (cfg.package != null) {
enable = true;
config = {
ProgramArguments = [
pueuedBin
"-v"
"-c"
"${configFile}"
];
KeepAlive = {
Crashed = true;
SuccessfulExit = false;
};
ProcessType = "Background";
RunAtLoad = true;
};
};
};
}