nix/README.md

Paneru Nix Flake

Add the paneru flake to your inputs:

nix
1# flake.nix
2inputs.paneru = {
3 url = "github:karinushka/paneru";
4 inputs.nixpkgs.follows = "nixpkgs";
5}

Usage

nix-darwin or Home Manager

Instead of manually installing and configuring paneru, you can use either nix-darwin or Home Manager to configure paneru and setup a launchd agent entirely with nix.

Which one you use is entirely up to preference, but do not use both at the same time.

If you are unsure which one to use, prefer using the darwin module.

Options

Both the nix-darwin module (darwinModules.paneru) and Home Manager module (homeModules.paneru) expose the same following options:

OptionTypeDefaultDescription
services.paneru.enablebooleanfalseGenerate and enable the launchd agent
services.paneru.packagepackageself.packages.<system>.paneruPackage to use
services.paneru.confignull, lines, or pathnullPaneru's init.lua (Lua source or a file). Written to $XDG_CONFIG_HOME/paneru/init.lua (or ~/.paneru.lua). Mirrors Home Manager's services.sketchybar.config. A paneru.setup{...} here takes precedence over settings. Requires luaConfig.enable.
services.paneru.settingsnull or attribute setnullPaneru TOML configuration (See CONFIGURATION.md)
services.paneru.extraPackageslist of package[ ]Extra packages on paneru's PATH at runtime (e.g. sketchybar).
services.paneru.luaConfig.enablebooleantrueWhether package is built with the embedded Lua scripting runtime (init.lua) compiled in. Only takes effect when package is left at its default.
services.paneru.luapackagepackage.luaModule.luaThe Lua interpreter extraLuaPackages are resolved against.
services.paneru.extraLuaPackagesfunctionluaPs: [ ]Extra Lua packages available to init.lua via require(...) (e.g. sbarlua). Same shape as Home Manager's programs.sketchybar.extraLuaPackages — a function from a Lua package set to a list of derivations.

Example

nix
1# configuration.nix (nix-darwin) or
2# home.nix (Home Manager)
3{ inputs, ... }:
4
5{
6 imports = [
7 inputs.paneru.darwinModules.paneru # nix-darwin
8 inputs.paneru.homeModules.paneru # home-manager
9 ];
10
11 services.paneru = {
12 enable = true;
13 # Paneru configuration
14 # See CONFIGURATION.md for a list of all options
15 settings = {
16 options = {
17 focus_follows_mouse = true;
18 mouse_follows_focus = true;
19 preset_column_widths = [0.25 0.33 0.5 0.66 0.75];
20 };
21 bindings = {
22 window_focus_west = "cmd - h";
23 window_focus_east = "cmd - l";
24 window_resize = "alt - r";
25 window_center = "alt - c";
26 window_balance = "alt - b";
27 quit = "ctrl + alt - q";
28 };
29 };
30 };
31}

Alternatively, configure paneru entirely from Lua with config (the init.lua), the same way Home Manager's services.sketchybar.config works. A paneru.setup{...} call is authoritative and makes settings unnecessary — see CONFIGURATION.md:

nix
1services.paneru = {
2 enable = true;
3 config = ''
4 paneru.setup {
5 options = { focus_follows_mouse = true, mouse_follows_focus = true },
6 bindings = {
7 ["window focus west"] = "cmd - h",
8 ["window focus east"] = "cmd - l",
9 ["quit"] = "ctrl + alt - q",
10 },
11 }
12
13 paneru.bind("alt - j", function(state) paneru.run("window focus south") end)
14 '';
15};

To make extra Lua modules available to init.lua (e.g. to call SketchyBar's Lua bridge directly from a paneru.on handler, see CONFIGURATION.md):

nix
1services.paneru.extraLuaPackages = luaPs: [ (luaPs.callPackage ./sbarlua.nix { }) ];

Note

After installing/updating paneru, macOS will prompt you to grant accessibility permissions in System Settings. You may have to manually restart the paneru service using launchctl:

shell
1launchctl start com.github.karinushka.paneru

Other

If neither nix-darwin nor Home Manager suits your use case, the flake provides the following packages:

  • packages.<system>.paneru
  • packages.<system>.default (alias for packages.<system>.paneru)

Run without installing

Note

Running paneru requires a configuration to be present (See CONFIGURATION.md)

shell
1nix run github:karinushka/paneru

Troubleshooting

Here are some tips for debugging when using either the nix-darwin or home-manager module.

1. Check if the launchd agent exists

shell
1launchctl list | grep paneru
1PID Status Label
212345 0 com.github.karinushka.paneru

2. Check the logs

Logs can be found at /tmp/paneru.log and /tmp/paneru.err.log.

3. Try manually starting the launchd agent

shell
1launchctl start com.github.karinushka.paneru