2023-09-06 21:04:41 +02:00
|
|
|
# TODO: AppleSelectedInputSourcesChangedNotification
|
2024-09-08 15:45:11 +02:00
|
|
|
{ lib, darwin, writeShellApplication, sketchybar, babashka, clj-kondo, ... }:
|
2023-09-06 21:04:41 +02:00
|
|
|
|
2023-07-29 16:45:58 +02:00
|
|
|
let
|
2024-09-08 15:45:11 +02:00
|
|
|
plugin-dir = ./plugins;
|
|
|
|
util-dir = ./utils;
|
|
|
|
get-menu-bar-height = darwin.apple_sdk.stdenv.mkDerivation {
|
2023-09-06 21:04:41 +02:00
|
|
|
name = "get_menu_bar_height";
|
|
|
|
version = "0.0.1";
|
|
|
|
src = lib.cleanSource ./get_menu_bar_height;
|
|
|
|
buildInputs = with darwin.apple_sdk.frameworks; [
|
|
|
|
Cocoa
|
|
|
|
];
|
|
|
|
buildPhase = ''
|
|
|
|
clang -framework cocoa get_menu_bar_height.m -o get_menu_bar_height
|
|
|
|
'';
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
mv get_menu_bar_height $out/bin/get_menu_bar_height
|
|
|
|
'';
|
2024-09-08 15:45:11 +02:00
|
|
|
meta.mainProgram = "get_menu_bar_height";
|
2023-09-06 21:04:41 +02:00
|
|
|
};
|
2024-09-08 15:45:11 +02:00
|
|
|
sketchybar-config-script = ./config.clj;
|
2023-07-29 16:45:58 +02:00
|
|
|
in
|
2024-09-08 15:45:11 +02:00
|
|
|
writeShellApplication {
|
|
|
|
name = "sketchybar-config";
|
|
|
|
text = ''
|
|
|
|
export PLUGIN_DIR="${plugin-dir}"
|
|
|
|
export UTIL_DIR="${util-dir}"
|
|
|
|
|
|
|
|
exec ${lib.getExe babashka} \
|
|
|
|
--file ${sketchybar-config-script} \
|
|
|
|
--plugin-dir ${plugin-dir} \
|
|
|
|
--util-dir ${util-dir} \
|
|
|
|
--get-menu-bar-height ${lib.getExe get-menu-bar-height}
|
|
|
|
'';
|
|
|
|
runtimeInputs = [
|
|
|
|
sketchybar
|
|
|
|
];
|
|
|
|
checkPhase = ''
|
|
|
|
${lib.getExe clj-kondo} \
|
|
|
|
--config '{:linters {:namespace-name-mismatch {:level :off}}}' \
|
|
|
|
--lint ${sketchybar-config-script}
|
|
|
|
'';
|
|
|
|
}
|