pueue: deduplicate platform-dependent files

This commit is contained in:
Benedikt Rips
2026-01-05 23:00:14 +01:00
committed by Austin Horstman
parent a1a11393d9
commit f7b2bdf042

View File

@@ -7,6 +7,8 @@
let let
cfg = config.services.pueue; cfg = config.services.pueue;
yamlFormat = pkgs.formats.yaml { }; yamlFormat = pkgs.formats.yaml { };
configDir =
if pkgs.stdenv.hostPlatform.isDarwin then "Library/Application Support" else config.xdg.configHome;
configFile = yamlFormat.generate "pueue.yaml" ({ shared = { }; } // cfg.settings); configFile = yamlFormat.generate "pueue.yaml" ({ shared = { }; } // cfg.settings);
pueuedBin = "${cfg.package}/bin/pueued"; pueuedBin = "${cfg.package}/bin/pueued";
in in
@@ -38,7 +40,7 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."pueue/pueue.yml" = lib.mkIf pkgs.stdenv.isLinux { source = configFile; }; home.file."${configDir}/pueue/pueue.yml".source = configFile;
systemd.user = lib.mkIf (cfg.package != null) { systemd.user = lib.mkIf (cfg.package != null) {
services.pueued = { services.pueued = {
@@ -55,12 +57,6 @@ in
}; };
}; };
# 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) { launchd.agents.pueued = lib.mkIf (cfg.package != null) {
enable = true; enable = true;