1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-05 16:27:03 +00:00
nix-darwin/modules/services/sketchybar/default.nix

60 lines
1.6 KiB
Nix
Raw Normal View History

2023-01-09 19:01:54 +08:00
{ config, lib, pkgs, ... }:
let
2024-04-14 23:02:32 +02:00
inherit (lib) literalExpression maintainers mkEnableOption mkIf mkPackageOptionMD mkOption optionals types;
2023-01-09 19:01:54 +08:00
cfg = config.services.sketchybar;
configFile = pkgs.writeScript "sketchybarrc" cfg.config;
in
{
meta.maintainers = [
maintainers.azuwis or "azuwis"
];
options.services.sketchybar = {
2024-04-14 23:02:32 +02:00
enable = mkEnableOption "sketchybar";
2023-01-09 19:01:54 +08:00
package = mkPackageOptionMD pkgs "sketchybar" { };
extraPackages = mkOption {
type = types.listOf types.package;
default = [ ];
example = literalExpression "[ pkgs.jq ]";
2024-04-14 23:02:32 +02:00
description = ''
2023-01-09 19:01:54 +08:00
Extra packages to add to PATH.
'';
};
config = mkOption {
type = types.lines;
default = "";
example = ''
sketchybar --bar height=24
sketchybar --update
echo "sketchybar configuration loaded.."
'';
2024-04-14 23:02:32 +02:00
description = ''
2023-01-09 19:01:54 +08:00
Contents of sketchybar's configuration file. If empty (the default), the configuration file won't be managed.
See [documentation](https://felixkratz.github.io/SketchyBar/)
and [example](https://github.com/FelixKratz/SketchyBar/blob/master/sketchybarrc).
'';
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
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;
};
};
}