From 63e1191b5be8805c410204acb71ab0387310c401 Mon Sep 17 00:00:00 2001 From: Tobias Happ Date: Fri, 24 Nov 2023 16:04:49 +0100 Subject: [PATCH] hosts.R2026: clean up config --- hosts/R2026/configuration.nix | 235 ++++++++++++++++++---------------- 1 file changed, 128 insertions(+), 107 deletions(-) diff --git a/hosts/R2026/configuration.nix b/hosts/R2026/configuration.nix index 3128b23b..aa70ced5 100644 --- a/hosts/R2026/configuration.nix +++ b/hosts/R2026/configuration.nix @@ -1,4 +1,5 @@ -{ pkgs, lib, config, inputs, ... }@configArgs: +{ config, lib, pkgs, inputs, ... }@configArgs: + let commonConfig = config.lib.custom.commonConfig configArgs; in @@ -6,19 +7,11 @@ in { imports = [ inputs.home-manager.darwinModules.home-manager ]; - users.users.tobiashapp.home = "/Users/tobiashapp"; - services.nix-daemon.enable = true; - - programs.zsh.enable = true; - programs.zsh.enableCompletion = false; - programs.zsh.enableBashCompletion = false; + fonts = { + fontDir.enable = true; - # Set Git commit hash for darwin-version. - system.configurationRevision = inputs.self.rev or inputs.self.dirtyRev or null; - - # Used for backwards compatibility, please read the changelog before changing. - # $ darwin-rebuild changelog - system.stateVersion = 4; + fonts = [ (pkgs.nerdfonts.override { fonts = [ "UbuntuMono" ]; }) ]; + }; home-manager = { inherit (commonConfig.homeManager.baseConfig) @@ -32,11 +25,6 @@ in users.tobiashapp = commonConfig.homeManager.userConfig "R2026" "tobiashapp"; }; - fonts.fontDir.enable = true; - fonts.fonts = [ - (pkgs.nerdfonts.override { fonts = [ "UbuntuMono" ]; }) - ]; - nix = { settings = { inherit (commonConfig.nix.settings) @@ -57,104 +45,150 @@ in ; }; + programs.zsh = { + enable = true; + enableCompletion = false; + }; + security.pam.enableSudoTouchIdAuth = true; - services.yabai.enable = true; - services.yabai.config = { - layout = "bsp"; # binary spaced partition - focus_follows_mouse = "autoraise"; - window_placement = "second_child"; - - # modifier for clicking and dragging with mouse - mouse_modifier = "alt"; - # set modifier + left-click drag to move window - mouse_action1 = "move"; - # set modifier + right-click drag to resize window - mouse_action2 = "resize"; - - # when window is dropped in center of another window, swap them (on edges it will split it) - mouse_drop_action = "swap"; - }; - services.yabai.extraConfig = '' - yabai -m rule --add app='Calculator' manage=off - yabai -m rule --add app='System Settings' manage=off - ''; - services.skhd.enable = true; - services.skhd.skhdConfig = '' - # -- Changing Window Focus -- + services = { + nix-daemon.enable = true; + + yabai = { + enable = true; + config = { + layout = "bsp"; # binary spaced partition + focus_follows_mouse = "autoraise"; + window_placement = "second_child"; + + # modifier for clicking and dragging with mouse + mouse_modifier = "alt"; + # set modifier + left-click drag to move window + mouse_action1 = "move"; + # set modifier + right-click drag to resize window + mouse_action2 = "resize"; + + # when window is dropped in center of another window, swap them (on edges it will split it) + mouse_drop_action = "swap"; + }; + extraConfig = '' + yabai -m rule --add app='Calculator' manage=off + yabai -m rule --add app='System Settings' manage=off + ''; + }; - # change window focus within space - ctrl - j : yabai -m window --focus south - ctrl - k : yabai -m window --focus north - ctrl - h : yabai -m window --focus west - ctrl - l : yabai -m window --focus east + skhd = { + enable = true; + skhdConfig = '' + # -- Changing Window Focus -- - #change focus between external displays (left and right) - ctrl - s: yabai -m display --focus west - ctrl - g: yabai -m display --focus east + # change window focus within space + ctrl - j : yabai -m window --focus south + ctrl - k : yabai -m window --focus north + ctrl - h : yabai -m window --focus west + ctrl - l : yabai -m window --focus east - # -- Modifying the Layout -- + #change focus between external displays (left and right) + ctrl - s: yabai -m display --focus west + ctrl - g: yabai -m display --focus east - # rotate layout clockwise - ctrl + shift - r : yabai -m space --rotate 270 + # -- Modifying the Layout -- - # flip along y-axis - ctrl + shift - y : yabai -m space --mirror y-axis + # rotate layout clockwise + ctrl + shift - r : yabai -m space --rotate 270 - # flip along x-axis - ctrl + shift - x : yabai -m space --mirror x-axis + # flip along y-axis + ctrl + shift - y : yabai -m space --mirror y-axis - # toggle window float - ctrl + shift - t : yabai -m window --toggle float --grid 4:4:1:1:2:2 + # flip along x-axis + ctrl + shift - x : yabai -m space --mirror x-axis + # toggle window float + ctrl + shift - t : yabai -m window --toggle float --grid 4:4:1:1:2:2 - # -- Modifying Window Size -- - # maximize a window - ctrl + shift - m : yabai -m window --toggle zoom-fullscreen + # -- Modifying Window Size -- - # balance out tree of windows (resize to occupy same area) - ctrl + shift - e : yabai -m space --balance + # maximize a window + ctrl + shift - m : yabai -m window --toggle zoom-fullscreen - # -- Moving Windows Around -- + # balance out tree of windows (resize to occupy same area) + ctrl + shift - e : yabai -m space --balance - # swap windows - ctrl + shift - j : yabai -m window --swap south - ctrl + shift - k : yabai -m window --swap north - ctrl + shift - h : yabai -m window --swap west - ctrl + shift - l : yabai -m window --swap east + # -- Moving Windows Around -- - # move window and split - ctrl + alt - j : yabai -m window --warp south - ctrl + alt - k : yabai -m window --warp north - ctrl + alt - h : yabai -m window --warp west - ctrl + alt - l : yabai -m window --warp east + # swap windows + ctrl + shift - j : yabai -m window --swap south + ctrl + shift - k : yabai -m window --swap north + ctrl + shift - h : yabai -m window --swap west + ctrl + shift - l : yabai -m window --swap east - # move window to display left and right - ctrl + shift - s : yabai -m window --display west; yabai -m display --focus west; - ctrl + shift - g : yabai -m window --display east; yabai -m display --focus east; + # move window and split + ctrl + alt - j : yabai -m window --warp south + ctrl + alt - k : yabai -m window --warp north + ctrl + alt - h : yabai -m window --warp west + ctrl + alt - l : yabai -m window --warp east + # move window to display left and right + ctrl + shift - s : yabai -m window --display west; yabai -m display --focus west; + ctrl + shift - g : yabai -m window --display east; yabai -m display --focus east; - # move window to prev and next space - ctrl + shift - p : yabai -m window --space prev; - ctrl + shift - n : yabai -m window --space next; - # move window to space # - ctrl + shift - 1 : yabai -m window --space 1; - ctrl + shift - 2 : yabai -m window --space 2; - ctrl + shift - 3 : yabai -m window --space 3; - ctrl + shift - 4 : yabai -m window --space 4; - ctrl + shift - 5 : yabai -m window --space 5; - ctrl + shift - 6 : yabai -m window --space 6; - ctrl + shift - 7 : yabai -m window --space 7; + # move window to prev and next space + ctrl + shift - p : yabai -m window --space prev; + ctrl + shift - n : yabai -m window --space next; - # -- Starting/Stopping/Restarting Yabai -- + # move window to space # + ctrl + shift - 1 : yabai -m window --space 1; + ctrl + shift - 2 : yabai -m window --space 2; + ctrl + shift - 3 : yabai -m window --space 3; + ctrl + shift - 4 : yabai -m window --space 4; + ctrl + shift - 5 : yabai -m window --space 5; + ctrl + shift - 6 : yabai -m window --space 6; + ctrl + shift - 7 : yabai -m window --space 7; - # stop/start/restart yabai - ctrl + alt - q : launchctl stop org.nixos.yabai - ctrl + alt - s : launchctl start org.nixos.yabai - ctrl + alt - r : launchctl stop org.nixos.yabai; launchctl start org.nixos.yabai - ''; + # -- Starting/Stopping/Restarting Yabai -- + + # stop/start/restart yabai + ctrl + alt - q : launchctl stop org.nixos.yabai + ctrl + alt - s : launchctl start org.nixos.yabai + ctrl + alt - r : launchctl stop org.nixos.yabai; launchctl start org.nixos.yabai + ''; + }; + }; + + system = { + # Set Git commit hash for darwin-version. + configurationRevision = inputs.self.rev or inputs.self.dirtyRev or null; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + stateVersion = 4; + + defaults = { + NSGlobalDomain = { + AppleInterfaceStyle = "Dark"; + AppleShowAllExtensions = true; + InitialKeyRepeat = 25; + KeyRepeat = 3; + "com.apple.mouse.tapBehavior" = 1; + "com.apple.swipescrolldirection" = false; # disable natural scrolling + NSScrollAnimationEnabled = false; + }; + dock = { + autohide = true; + tilesize = 48; + }; + finder = { + FXPreferredViewStyle = "Nlsv"; # list view + ShowPathbar = true; + ShowStatusBar = true; + }; + }; + }; + + users.users.tobiashapp.home = "/Users/tobiashapp"; # TODO # cachix-agent @@ -163,19 +197,6 @@ in # Hidden bar # Alttab - system.defaults.NSGlobalDomain.AppleInterfaceStyle = "Dark"; - system.defaults.NSGlobalDomain.AppleShowAllExtensions = true; - system.defaults.NSGlobalDomain.InitialKeyRepeat = 25; - system.defaults.NSGlobalDomain.KeyRepeat = 3; - system.defaults.NSGlobalDomain."com.apple.mouse.tapBehavior" = 1; - system.defaults.NSGlobalDomain."com.apple.swipescrolldirection" = false; # disable natural scrolling - system.defaults.NSGlobalDomain.NSScrollAnimationEnabled = false; - system.defaults.dock.autohide = true; - system.defaults.dock.tilesize = 48; - system.defaults.finder.FXPreferredViewStyle = "Nlsv"; # list view - system.defaults.finder.ShowPathbar = true; - system.defaults.finder.ShowStatusBar = true; - # manually # install chrome, intellij, iterm2, docker, vscode # iterm2 set UbuntuMono font, size 13, h 85, v 115, solarized dark, window size