blob: 0cc4f6fc77635daac04e5ef3b1ea0d1007157948 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
{ config, lib, pkgs, ... }:
let
inherit (lib) literalExpression maintainers mdDoc mkEnableOption mkIf mkPackageOptionMD mkOption optionals types;
cfg = config.services.sketchybar;
configFile = pkgs.writeScript "sketchybarrc" cfg.config;
in
{
meta.maintainers = [
maintainers.azuwis or "azuwis"
];
options.services.sketchybar = {
enable = mkEnableOption (mdDoc "sketchybar");
package = mkPackageOptionMD pkgs "sketchybar" { };
extraPackages = mkOption {
type = types.listOf types.package;
default = [ ];
example = literalExpression "[ pkgs.jq ]";
description = mdDoc ''
Extra packages to add to PATH.
'';
};
config = mkOption {
type = types.lines;
default = "";
example = ''
sketchybar --bar height=24
sketchybar --update
echo "sketchybar configuration loaded.."
'';
description = mdDoc ''
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;
};
};
}
|