1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-21 17:59:39 +01:00
home-manager/tests/modules/programs/sketchybar/sketchybar-lua-config.nix
Austin Horstman c096c39afc sketchybar: config sourceFileOrLines
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-05-24 19:54:43 -05:00

72 lines
1.5 KiB
Nix

{ config, pkgs, ... }:
let
pkgsSbarlua = pkgs.writeTextFile {
name = "sbarlua";
destination = "/bin/sbarlua";
executable = true;
text = ''
#!/bin/sh
echo "SbarLua mock"
'';
};
in
{
programs.sketchybar = {
enable = true;
package = config.lib.test.mkStubPackage {
name = "sketchybar";
buildScript = ''
mkdir -p $out/bin
touch $out/bin/sketchybar
chmod 755 $out/bin/sketchybar
'';
};
configType = "lua";
sbarLuaPackage = pkgsSbarlua;
config = ''
-- This is a test Lua configuration
local sbar = require("sbarlua")
-- Configure bar
sbar.bar:set({
height = 30,
position = "top",
padding_left = 10,
padding_right = 10,
blur_radius = 20,
corner_radius = 9,
})
-- Configure defaults
sbar.defaults:set({
["icon.font"] = "SF Pro",
["icon.color"] = "0xff0000ff",
["background.height"] = 24,
["popup.background.border_width"] = 2,
["popup.background.corner_radius"] = 9,
})
-- Add items
sbar:add("item", "cpu", {
position = "right",
update_freq = 1,
script = "./scripts/cpu.lua",
})
-- Subscribe to events
sbar:subscribe("cpu", "system_woke")
-- Update the bar
sbar:update()'';
};
nmt.script = ''
assertFileContent \
home-files/.config/sketchybar/sketchybarrc \
${./sketchybarrc.lua}
'';
}