1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-09 03:56:04 +01:00

pueue: enable darwin configuration (#7519)

This commit enables configuring pueue for darwin. pueue already builds fine for darwin and all that was needed was a `launchd` agent.
This commit is contained in:
David Strawn 2025-07-23 13:12:46 -05:00 committed by GitHub
parent 3641df95be
commit fe38a5e028
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,11 +5,10 @@
... ...
}: }:
let let
cfg = config.services.pueue; cfg = config.services.pueue;
yamlFormat = pkgs.formats.yaml { }; yamlFormat = pkgs.formats.yaml { };
configFile = yamlFormat.generate "pueue.yaml" ({ shared = { }; } // cfg.settings); configFile = yamlFormat.generate "pueue.yaml" ({ shared = { }; } // cfg.settings);
pueuedBin = "${cfg.package}/bin/pueued";
in in
{ {
meta.maintainers = [ lib.maintainers.AndersonTorres ]; meta.maintainers = [ lib.maintainers.AndersonTorres ];
@ -36,15 +35,13 @@ in
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable (
assertions = [ lib.mkMerge [
(lib.hm.assertions.assertPlatform "services.pueue" pkgs lib.platforms.linux) {
];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
}
(lib.mkIf pkgs.stdenv.isLinux {
xdg.configFile."pueue/pueue.yml".source = configFile; xdg.configFile."pueue/pueue.yml".source = configFile;
systemd.user = lib.mkIf (cfg.package != null) { systemd.user = lib.mkIf (cfg.package != null) {
services.pueued = { services.pueued = {
Unit = { Unit = {
@ -53,11 +50,36 @@ in
Service = { Service = {
Restart = "on-failure"; Restart = "on-failure";
ExecStart = "${cfg.package}/bin/pueued -v -c ${configFile}"; ExecStart = "${pueuedBin} -v -c ${configFile}";
}; };
Install.WantedBy = [ "default.target" ]; Install.WantedBy = [ "default.target" ];
}; };
}; };
})
(lib.mkIf pkgs.stdenv.isDarwin {
# 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".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;
};
};
})
]
);
} }