1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-31 04:04:45 +00:00
This commit is contained in:
Austin Horstman 2025-03-25 03:41:00 +05:00 committed by GitHub
commit 20ec8f5a73
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,15 +1,26 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) literalExpression maintainers mkEnableOption mkIf mkPackageOption mkOption optionals types;
inherit (lib)
literalExpression
maintainers
mkEnableOption
mkIf
mkPackageOption
mkOption
optionals
types
;
cfg = config.services.sketchybar;
configFile = pkgs.writeScript "sketchybarrc" cfg.config;
in
{
meta.maintainers = [
maintainers.azuwis or "azuwis"
];
@ -43,6 +54,20 @@ in
and [example](https://github.com/FelixKratz/SketchyBar/blob/master/sketchybarrc).
'';
};
errorLogFile = mkOption {
type = types.nullOr types.path;
default = "/tmp/sketchybar.err.log";
example = "/Users/khaneliman/Library/Logs/sketchybar.log";
description = "Absolute path to log all stderr output.";
};
outLogFile = mkOption {
type = types.nullOr types.path;
default = "/tmp/sketchybar.out.log";
example = "/Users/khaneliman/Library/Logs/sketchybar.log";
description = "Absolute path to log all stdout output.";
};
};
config = mkIf cfg.enable {
@ -50,10 +75,18 @@ in
launchd.user.agents.sketchybar = {
path = [ cfg.package ] ++ cfg.extraPackages ++ [ config.environment.systemPath ];
serviceConfig.ProgramArguments = [ "${cfg.package}/bin/sketchybar" ]
++ optionals (cfg.config != "") [ "--config" "${configFile}" ];
serviceConfig.KeepAlive = true;
serviceConfig.RunAtLoad = true;
serviceConfig = {
ProgramArguments =
[ "${cfg.package}/bin/sketchybar" ]
++ optionals (cfg.config != "") [
"--config"
"${configFile}"
];
KeepAlive = true;
RunAtLoad = true;
StandardErrorPath = cfg.errorLogFile;
StandardOutPath = cfg.outLogFile;
};
};
};
}