馃憢 Hope you don't mind an issue being opened for this, but I figured it was a good way to notify you and an easy way for people to discover if they were looking for Nix support:
I submitted a package for yabai to the nixpkgs repository the other day. I'm happy to say, following the merge, it is now generally available on the nixpkgs-unstable channel 馃帀
$ nix-channel --list
darwin https://github.com/LnL7/nix-darwin/archive/master.tar.gz
nixpkgs https://nixos.org/channels/nixpkgs-unstable
$ nix-env -qaP --description yabai
nixpkgs.yabai yabai-3.0.0 A tiling window manager for macOS based on binary space partitioning
I'll aslo be submitting a Nix service module I've been using personally for a while to the LnL7/nix-darwin project. It lets you configure yabai like so:
{
services.yabai = {
enable = true;
enableScriptingAddition = true;
config = {
focus_follows_mouse = "autoraise";
mouse_follows_focus = "off";
window_placement = "second_child";
window_opacity = "off";
window_opacity_duration = "0.0";
window_border = "on";
window_border_placement = "inset";
window_border_width = 2;
window_border_radius = 3;
active_window_border_topmost = "off";
window_topmost = "on";
window_shadow = "float";
active_window_border_color = "0xff5c7e81";
normal_window_border_color = "0xff505050";
insert_window_border_color = "0xffd75f5f";
active_window_opacity = "1.0";
normal_window_opacity = "1.0";
split_ratio = "0.50";
auto_balance = "on";
mouse_modifier = "fn";
mouse_action1 = "move";
mouse_action2 = "resize";
layout = "bsp";
top_padding = 36;
bottom_padding = 10;
left_padding = 10;
right_padding = 10;
window_gap = 10;
};
extraConfig = ''
# rules
yabai -m rule --add app='System Preferences' manage=off
# Any other arbitrary config here
'';
};
}
Finally, I'm sure others here may be interested to know I also submitted a PR for spacebar and have a similar module ready to go, too. Once the package is generally available in the channels, I'll submit a PR for the module.
@koekeishiya @dominiklohmann Please feel free to simply close this issue - but if you'd like, I can update the documentation regarding the package (and perhaps, subsequently, the module - at a later date)
I think this would make a really good addition to the wiki.
Mind creating a draft of what you think needs to be mentioned? This can just be a rough outline / bullet points and I'll write a section from that.
Sure, I'll gladly draft something up :) Do you think it's perhaps worth waiting until I've got the module merged upstream (if it's accepted) in nix-darwin?
That's the more comprehensive part (in terms of use) of these contributions. I think if we updated the documentation to simply state a Nix package is available, it may leave some users wondering where an acompanying service is
Do you think it's perhaps worth waiting until I've got the module merged upstream (if it's accepted) in nix-darwin?
People here are generally open to the idea of living on the edge and running nightly/unstable software, so I don't think it's a blocker.
Cool, thanks for weighing in here :) I'll take some time to draft something for the wiki a little later - I imagine it'll be fairly minimal
I've just submitted the service module PR to nix-darwin. LnL can be pretty snappy on this stuff, so we might even see a merge on this before I sit down and write the docs for the package anyway 馃
https://github.com/LnL7/nix-darwin/pull/196
It's now merged and generally available, short post on it here:
https://cmacr.ae/post/2020-05-13-yabai-module-in-nix-darwin-now-generally-available/
I'll write up a draft for docs tomorrow, as I should have some time :)
Wiki Draft/Outline
nixpkgs-unstable channelnix-darwin{
services.yabai = {
enable = true;
package = pkgs.yabai;
enableScriptingAddition = true;
config = {
focus_follows_mouse = "autoraise";
mouse_follows_focus = "off";
window_placement = "second_child";
window_opacity = "off";
window_opacity_duration = "0.0";
window_topmost = "on";
window_shadow = "float";
active_window_opacity = "1.0";
normal_window_opacity = "1.0";
split_ratio = "0.50";
auto_balance = "on";
mouse_modifier = "fn";
mouse_action1 = "move";
mouse_action2 = "resize";
layout = "bsp";
top_padding = 36;
bottom_padding = 10;
left_padding = 10;
right_padding = 10;
window_gap = 10;
};
extraConfig = ''
# rules
yabai -m rule --add app='System Preferences' manage=off
# Any other arbitrary config here
'';
};
}
services.yabai.package option must be specified and can simply be set to pkgs.yabai. There is no default option as it is currently distributed via the unstable channelservices.yabai.enableScriptingAddition option only works is SIP is disabledThere you go @dominiklohmann :) Hopefully that's enough to go off, but please do let me know if there's stuff you feel I need to expand on
Most helpful comment
It's now merged and generally available, short post on it here:
https://cmacr.ae/post/2020-05-13-yabai-module-in-nix-darwin-now-generally-available/
I'll write up a draft for docs tomorrow, as I should have some time :)