summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hosts/RyanMac/configuration.nix94
-rw-r--r--modules/darwin/random-wallpaper.nix5
-rw-r--r--users/ryan/home.nix7
3 files changed, 93 insertions, 13 deletions
diff --git a/hosts/RyanMac/configuration.nix b/hosts/RyanMac/configuration.nix
index 51d181b..66ad874 100644
--- a/hosts/RyanMac/configuration.nix
+++ b/hosts/RyanMac/configuration.nix
@@ -1,4 +1,4 @@
1{ pkgs, inputs, ... }: 1{ pkgs, inputs, lib, ... }:
2let 2let
3 username = "ryan"; 3 username = "ryan";
4 4
@@ -19,9 +19,30 @@ let
19 ]; 19 ];
20 }); 20 });
21 21
22 mkSpace = i: {
23 name = toString (117+i);
24 value = {
25 enabled = true;
26 value = {
27 type = "standard";
28 parameters = [ (48 + i) (builtins.elemAt [ 18 19 20 21 22 23 25 26 28 ] (i - 1)) 524288 ];
29 };
30 };
31 };
32
33 spaceHotkeys = builtins.listToAttrs (map mkSpace (lib.range 1 9));
34
35 manualHotkeys = {
36 "64" = {
37 enabled = true;
38 };
39 };
40
22in { 41in {
23 # Modules 42 # Modules
24 imports = [ ../../modules/darwin/random-wallpaper.nix ]; 43 imports = [
44 ../../modules/darwin/random-wallpaper.nix
45 ];
25 46
26 # Define the system's user and home dir location 47 # Define the system's user and home dir location
27 users.users."${username}" = { 48 users.users."${username}" = {
@@ -37,6 +58,31 @@ in {
37 directory = "${../../files/Wallpapers}"; 58 directory = "${../../files/Wallpapers}";
38 }; 59 };
39 60
61 # Configure yabai
62 services.yabai = {
63 enable = true;
64 enableScriptingAddition = false;
65 config = {
66 mouse_follows_focus = "on";
67 layout = "bsp";
68 window_placement = "second_child";
69 top_padding = "10";
70 bottom_padding = "10";
71 left_padding = "10";
72 right_padding = "10";
73 window_gap = "5";
74 mouse_modifier = "alt";
75 mouse_drop_action = "swap";
76 mouse_action1 = "move";
77 mouse_action2 = "resize";
78 focus_follows_mouse = "autofocus";
79 };
80 extraConfig = ''
81 yabai -m rule --add app='System Settings' manage=off
82 borders style=round active_color='gradient(top_left=0xee33ccff,bottom_right=0xee00ff99)' inactive_color=0xaa595959 width=6.0
83 '';
84 };
85
40 # Install the /etc/nix/flake-registry.json file we made above 86 # Install the /etc/nix/flake-registry.json file we made above
41 environment.etc."nix/flake-registry.json".source = pinnedNixpkgs; 87 environment.etc."nix/flake-registry.json".source = pinnedNixpkgs;
42 88
@@ -72,13 +118,14 @@ in {
72 118
73 taps = [ 119 taps = [
74 "netbirdio/tap" 120 "netbirdio/tap"
121 "FelixKratz/formulae"
75 ]; 122 ];
76 123
77 brews = [ 124 brews = [
125 "borders"
78 ]; 126 ];
79 127
80 casks = [ 128 casks = [
81 "glide"
82 "utm" 129 "utm"
83 "ghostty" 130 "ghostty"
84 "zen" 131 "zen"
@@ -92,7 +139,28 @@ in {
92 enable = true; 139 enable = true;
93 skhdConfig = '' 140 skhdConfig = ''
94 alt - d : osascript -e 'tell application "System Events" to key code 49 using {command down}' 141 alt - d : osascript -e 'tell application "System Events" to key code 49 using {command down}'
95 alt - return : open -na /Applications/Ghostty.app 142 alt - return : osascript -e 'tell application "Ghostty"' -e 'new window' -e 'activate' -e 'end tell'
143
144 alt - up : ${pkgs.yabai}/bin/yabai -m window --focus north
145 shift + alt - up : ${pkgs.yabai}/bin/yabai -m window --swap north
146 alt - down : ${pkgs.yabai}/bin/yabai -m window --focus south
147 shift + alt - down : ${pkgs.yabai}/bin/yabai -m window --swap south
148 alt - right : ${pkgs.yabai}/bin/yabai -m window --focus east
149 shift + alt - right : ${pkgs.yabai}/bin/yabai -m window --swap east
150 alt - left : ${pkgs.yabai}/bin/yabai -m window --focus west
151 shift + alt - left: ${pkgs.yabai}/bin/yabai -m window --swap west
152
153 shift + alt - 1 : ${pkgs.yabai}/bin/yabai -m window --space 1
154 shift + alt - 2 : ${pkgs.yabai}/bin/yabai -m window --space 2
155 shift + alt - 3 : ${pkgs.yabai}/bin/yabai -m window --space 3
156 shift + alt - 4 : ${pkgs.yabai}/bin/yabai -m window --space 4
157 shift + alt - 5 : ${pkgs.yabai}/bin/yabai -m window --space 5
158 shift + alt - 6 : ${pkgs.yabai}/bin/yabai -m window --space 6
159 shift + alt - 7 : ${pkgs.yabai}/bin/yabai -m window --space 7
160 shift + alt - 8 : ${pkgs.yabai}/bin/yabai -m window --space 8
161 shift + alt - 9 : ${pkgs.yabai}/bin/yabai -m window --space 9
162
163 alt - f : ${pkgs.yabai}/bin/yabai -m window --toggle zoom-fullscreen
96 ''; 164 '';
97 }; 165 };
98 166
@@ -137,6 +205,7 @@ in {
137 # Control center stuff 205 # Control center stuff
138 controlcenter = { 206 controlcenter = {
139 BatteryShowPercentage = true; 207 BatteryShowPercentage = true;
208 Bluetooth = true;
140 }; 209 };
141 210
142 # Clock settings 211 # Clock settings
@@ -182,6 +251,7 @@ in {
182 minimize-to-application = false; 251 minimize-to-application = false;
183 orientation = "bottom"; 252 orientation = "bottom";
184 autohide = true; 253 autohide = true;
254 mru-spaces = false; # Disable auto-rearrange spaces
185 persistent-apps = [ 255 persistent-apps = [
186 { app = "/Applications/Zen.app"; } 256 { app = "/Applications/Zen.app"; }
187 #{ app = "/System/Applications/Launchpad.app"; } 257 #{ app = "/System/Applications/Launchpad.app"; }
@@ -206,14 +276,15 @@ in {
206 AppleMenuBarVisibleInFullscreen = true; 276 AppleMenuBarVisibleInFullscreen = true;
207 }; 277 };
208 278
279 "com.apple.Accessibility" = {
280 ReduceMotionEnabled = 1;
281 };
282
209 "com.apple.symbolichotkeys" = { 283 "com.apple.symbolichotkeys" = {
210 AppleSymbolicHotKeys = { 284 AppleSymbolicHotKeys = manualHotkeys // spaceHotkeys;
211 "64" = {
212 enabled = true; # skhd needs this for its shortcut
213 };
214 };
215 }; 285 };
216 }; 286 };
287 universalaccess.reduceMotion = true;
217 }; 288 };
218 289
219 # Post-Activation scripts 290 # Post-Activation scripts
@@ -229,11 +300,14 @@ in {
229 fi 300 fi
230 301
231 echo "Reloading Preferences DB..." 302 echo "Reloading Preferences DB..."
232 /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u 303 sudo -iu ${username} /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
233 304
234 echo "Setting default browser" 305 echo "Setting default browser"
235 ${pkgs.defaultbrowser}/bin/defaultbrowser ${defaultBrowser} 306 ${pkgs.defaultbrowser}/bin/defaultbrowser ${defaultBrowser}
236 307
308 echo "Adding Keyboard brightness controls to Control Center..."
309 sudo -iu ${username} defaults -currentHost write com.apple.controlcenter KeyboardBrightness -int 25
310
237 # this is fragile so it goes at the bottom 311 # this is fragile so it goes at the bottom
238 echo "Reloading skhd..." 312 echo "Reloading skhd..."
239 sudo -iu ${username} ${pkgs.skhd}/bin/skhd -r 313 sudo -iu ${username} ${pkgs.skhd}/bin/skhd -r
diff --git a/modules/darwin/random-wallpaper.nix b/modules/darwin/random-wallpaper.nix
index 6b17c0f..75248b7 100644
--- a/modules/darwin/random-wallpaper.nix
+++ b/modules/darwin/random-wallpaper.nix
@@ -3,14 +3,15 @@ let
3 cfg = config.local.randomWallpaper; 3 cfg = config.local.randomWallpaper;
4 script = pkgs.writeShellApplication { 4 script = pkgs.writeShellApplication {
5 name = "set-random-wallpaper"; 5 name = "set-random-wallpaper";
6 runtimeInputs = [ pkgs.coreutils pkgs.findutils ]; 6 runtimeInputs = [ pkgs.coreutils pkgs.findutils pkgs.desktoppr];
7 text = '' 7 text = ''
8 set -euo pipefail 8 set -euo pipefail
9 img=$(find "${cfg.directory}" \ 9 img=$(find "${cfg.directory}" \
10 -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' \) \ 10 -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' \) \
11 | shuf -n1) 11 | shuf -n1)
12 [ -n "$img" ] || exit 0 12 [ -n "$img" ] || exit 0
13 /usr/bin/osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"$img\"" 13 #/usr/bin/osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"$img\""
14 desktoppr "$img"
14 ''; 15 '';
15 }; 16 };
16in 17in
diff --git a/users/ryan/home.nix b/users/ryan/home.nix
index af8770b..9ff5870 100644
--- a/users/ryan/home.nix
+++ b/users/ryan/home.nix
@@ -95,11 +95,16 @@
95 95
96 programs.zsh = { 96 programs.zsh = {
97 enable = true; 97 enable = true;
98 initContent = '' 98 initContent = let
99 brewPath = if pkgs.stdenv.isDarwin && pkgs.stdenv.isAarch64 then ''
100 eval "$(/opt/homebrew/bin/brew shellenv)"
101 '' else "";
102 in ''
99 export GPG_TTY="$(tty)" 103 export GPG_TTY="$(tty)"
100 export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" 104 export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
101 gpgconf --launch gpg-agent 105 gpgconf --launch gpg-agent
102 gpg-connect-agent updatestartuptty /bye > /dev/null 106 gpg-connect-agent updatestartuptty /bye > /dev/null
107 ${brewPath}
103 ''; 108 '';
104 shellAliases = { 109 shellAliases = {
105 cat = "bat --paging=never"; 110 cat = "bat --paging=never";