{ config, pkgs, ... }: { nixpkgs.config.allowUnfree = true; # List packages installed in system profile. To search by name, run: # $ nix-env -qaP | grep wget environment.systemPackages = [ pkgs.git-lfs pkgs.vim pkgs.iterm2 pkgs.obsidian pkgs.syncthing pkgs.slack pkgs._1password pkgs.tailscale # wishlist # LICEcap # keycastr # todo (unsupported on aarch64-darwin): # pkgs.spotify # pkgs.firefox # pkgs.google-chrome ]; services.tailscale.enable = true; # Use a custom configuration.nix location. # $ darwin-rebuild switch -I darwin-config=$HOME/.config/nixpkgs/darwin/configuration.nix # environment.darwinConfig = "$HOME/.config/nixpkgs/darwin/configuration.nix"; # Auto upgrade nix package and the daemon service. services.nix-daemon.enable = true; # nix.package = pkgs.nix; # Create /etc/bashrc that loads the nix-darwin environment. programs.zsh.enable = true; # default shell on catalina # programs.fish.enable = true; # We need this snippet to allow spotlight to find the applications installed # by nix-darwin system.activationScripts.applications.text = pkgs.lib.mkForce ( '' rm -rf ~/Applications/Nix\ Apps mkdir -p ~/Applications/Nix\ Apps for app in $(find ${config.system.build.applications}/Applications -maxdepth 1 -type l); do src="$(/usr/bin/stat -f%Y "$app")" cp -r "$src" ~/Applications/Nix\ Apps done '' ); services.yabai = { enable = true; package = pkgs.yabai; config = { # layout layout = "bsp"; auto_balance = "off"; split_ratio = "0.50"; window_placement = "second_child"; # Gaps window_gap = 5; top_padding = 5; bottom_padding = 5; left_padding = 5; right_padding = 5; # appearance, shadows, and borders window_shadow = "float"; active_window_opacity = "1.0"; normal_window_opacity = "0.90"; active_window_border_color = "0xE0808080"; normal_window_border_color = "0x00010101"; window_border = "on"; window_border_width = "2"; # mouse mouse_follows_focus = "off"; focus_follows_mouse = "off"; mouse_modifier = "fn"; mouse_action1 = "move"; mouse_action2 = "resize"; mouse_drop_action = "swap"; }; extraConfig = '' # Unload the macOS WindowManager process launchctl unload -F /System/Library/LaunchAgents/com.apple.WindowManager.plist > /dev/null 2>&1 & # Don't bother tiling certain low-info app windows yabai -m rule --add label="Finder" app="^Finder$" title="(Co(py|nnect)|Move|Info|Pref)" manage=off yabai -m rule --add label="System Preferences" app="^System Preferences$" title=".*" manage=off yabai -m rule --add label="System Settings" app="^System Settings$" title=".*" manage=off yabai -m rule --add label="App Store" app="^App Store$" manage=off yabai -m rule --add label="Activity Monitor" app="^Activity Monitor$" manage=off yabai -m rule --add label="Software Update" title="Software Update" manage=off yabai -m rule --add label="About This Mac" app="System Information" title="About This Mac" manage=off yabai -m rule --add label="Slack" app="^Slack$" title=".*" manage=off ''; }; services.skhd = { enable = true; package = pkgs.skhd; skhdConfig = '' # Float / Unfloat window lalt - space : yabai -m window --toggle float # Make window zoom to fullscreen shift + lalt - f : yabai -m window --toggle zoom-fullscreen # Window Navigation (through display borders) lalt - h : yabai -m window --focus west || yabai -m display --focus west lalt - j : yabai -m window --focus south || yabai -m display --focus south lalt - k : yabai -m window --focus north || yabai -m display --focus north lalt - l : yabai -m window --focus east || yabai -m display --focus east # Moving windows between spaces: (Assumes 3 Spaces Max per Display) shift + lalt - 1 : DISPLAY="$(yabai -m query --displays --display | jq '.index')";\ yabai -m window --space $((1+4*($DISPLAY - 1))) shift + lalt - 2 : DISPLAY="$(yabai -m query --displays --display | jq '.index')";\ yabai -m window --space $((2+4*($DISPLAY - 1))) shift + lalt - 3 : DISPLAY="$(yabai -m query --displays --display | jq '.index')";\ yabai -m window --space $((3+4*($DISPLAY - 1))) ## Stacks # Add the active window to the window or stack to the {direction} shift + ctrl - h : yabai -m window west --stack $(yabai -m query --windows --window | jq -r '.id') shift + ctrl - j : yabai -m window south --stack $(yabai -m query --windows --window | jq -r '.id') shift + ctrl - k : yabai -m window north --stack $(yabai -m query --windows --window | jq -r '.id') shift + ctrl - l : yabai -m window east --stack $(yabai -m query --windows --window | jq -r '.id') # Stack Navigation: shift + ctrl - {n, p} shift + ctrl - n : yabai -m window --focus stack.next shift + ctrl - p : yabai -m window --focus stack.prev ## Misc # Equalize size of windows ctrl + lalt - e : yabai -m space --balance ''; }; launchd.user.agents.syncthing = { path = [ pkgs.syncthing ]; command = "syncthing serve"; serviceConfig = { ProcessType = "Background"; KeepAlive = true; }; }; system.keyboard = { enableKeyMapping = true; remapCapsLockToEscape = true; }; system.defaults = { finder.AppleShowAllExtensions = true; dock = { autohide = true; mru-spaces = false; showhidden = true; }; }; # Used for backwards compatibility, please read the changelog before changing. # $ darwin-rebuild changelog system.stateVersion = 4; }