diff --git a/darwin/default.nix b/darwin/default.nix index 160a79f..6ddbd6f 100644 --- a/darwin/default.nix +++ b/darwin/default.nix @@ -3,9 +3,8 @@ { imports = [ ./networking - ./packages - ./main.nix - ./input.nix ./nix + ./packages + ./system ]; } \ No newline at end of file diff --git a/darwin/input.nix b/darwin/input.nix deleted file mode 100644 index 12bceea..0000000 --- a/darwin/input.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: - -{ - system.defaults = { - ".GlobalPreferences"."com.apple.mouse.scaling" = "-1"; # Disable mouse acceleration - trackpad = { - Clicking = true; - TrackpadRightClick = true; - }; - }; -} \ No newline at end of file diff --git a/darwin/nix/nix.nix b/darwin/nix/nix.nix index 2978ac7..2352813 100755 --- a/darwin/nix/nix.nix +++ b/darwin/nix/nix.nix @@ -23,6 +23,9 @@ services.nix-daemon.enable = true; nix.package = pkgs.nix; + # Set Git commit hash for darwin-version. + #system.configurationRevision = self.rev or self.dirtyRev or null; + # Used for backwards compatibility, please read the changelog before changing. # $ darwin-rebuild changelog system.stateVersion = 4; diff --git a/darwin/packages/core.nix b/darwin/packages/core.nix new file mode 100644 index 0000000..b03fb68 --- /dev/null +++ b/darwin/packages/core.nix @@ -0,0 +1,53 @@ +{ pkgs, ... }: + +{ + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + #environment.systemPackages = with pkgs; [ + # neovim + # vscode + #]; + + # Create /etc/zshrc that loads the nix-darwin environment. + programs.zsh.enable = true; # default shell on catalina + programs.fish.enable = true; + + services = { + yabai = { + enable = true; + enableScriptingAddition = true; + config = { + layout = "bsp"; + mouse_modifier = "fn"; + + # very broken on slow cpu + #focus_follows_mouse = "autoraise"; + #mouse_follows_focus = "on"; + + top_padding = 10; + bottom_padding = 10; + left_padding = 10; + right_padding = 10; + window_gap = 4; + }; + }; + skhd = { + enable = true; + skhdConfig = '' + cmd - return : open -n ${pkgs.alacritty}/Applications/Alacritty.app + + cmd - 1 : yabai -m space --focus 1 # Focus space + cmd - 2 : yabai -m space --focus 2 + cmd - 3 : yabai -m space --focus 3 + cmd - 4 : yabai -m space --focus 4 + cmd - 5 : yabai -m space --focus 5 + + shift + cmd - 1 : yabai -m window --space 1 # Send to space + shift + cmd - 2 : yabai -m window --space 2 + shift + cmd - 3 : yabai -m window --space 3 + shift + cmd - 4 : yabai -m window --space 4 + shift + cmd - 5 : yabai -m window --space 5 + ''; + }; + }; +} \ No newline at end of file diff --git a/darwin/packages/default.nix b/darwin/packages/default.nix index 3d76458..e291741 100644 --- a/darwin/packages/default.nix +++ b/darwin/packages/default.nix @@ -2,6 +2,9 @@ { imports = [ + ./core.nix + ./fonts.nix ./homebrew.nix + ./unfree.nix ]; } \ No newline at end of file diff --git a/darwin/packages/fonts.nix b/darwin/packages/fonts.nix new file mode 100644 index 0000000..42387c6 --- /dev/null +++ b/darwin/packages/fonts.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: + +{ + fonts.fonts = with pkgs; [ + (nerdfonts.override { fonts = [ "FiraCode" "JetBrainsMono" ]; }) + ]; +} \ No newline at end of file diff --git a/darwin/packages/unfree.nix b/darwin/packages/unfree.nix new file mode 100644 index 0000000..cf6e2e5 --- /dev/null +++ b/darwin/packages/unfree.nix @@ -0,0 +1,9 @@ +{ lib, ... }: + +{ + # Allow unfree applications + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "spotify" + "keka" + ]; +} \ No newline at end of file diff --git a/darwin/system/default.nix b/darwin/system/default.nix new file mode 100644 index 0000000..baa959b --- /dev/null +++ b/darwin/system/default.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + imports = [ + ./system.nix + ]; +} \ No newline at end of file diff --git a/darwin/main.nix b/darwin/system/system.nix similarity index 67% rename from darwin/main.nix rename to darwin/system/system.nix index a366d5a..3889dc6 100644 --- a/darwin/main.nix +++ b/darwin/system/system.nix @@ -1,68 +1,6 @@ -{ lib, pkgs, ... }: +{ ... }: { - fonts.fonts = with pkgs; [ - (nerdfonts.override { fonts = [ "FiraCode" "JetBrainsMono" ]; }) - ]; - - # Allow unfree applications - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ - #"vscode" - "spotify" - "keka" # i thought it was opensource - ]; - - # List packages installed in system profile. To search by name, run: - # $ nix-env -qaP | grep wget - #environment.systemPackages = with pkgs; [ - # neovim - # vscode - #]; - - # Create /etc/zshrc that loads the nix-darwin environment. - programs.zsh.enable = true; # default shell on catalina - programs.fish.enable = true; - - services = { - yabai = { - enable = true; - enableScriptingAddition = true; - config = { - layout = "bsp"; - - mouse_modifier = "fn"; - - # very broken on slow cpu - #focus_follows_mouse = "autoraise"; - #mouse_follows_focus = "on"; - - top_padding = 10; - bottom_padding = 10; - left_padding = 10; - right_padding = 10; - window_gap = 4; - }; - }; - skhd = { - enable = true; - skhdConfig = '' - cmd - return : open -n ${pkgs.alacritty}/Applications/Alacritty.app - - cmd - 1 : yabai -m space --focus 1 # Focus space - cmd - 2 : yabai -m space --focus 2 - cmd - 3 : yabai -m space --focus 3 - cmd - 4 : yabai -m space --focus 4 - cmd - 5 : yabai -m space --focus 5 - - shift + cmd - 1 : yabai -m window --space 1 # Send to space - shift + cmd - 2 : yabai -m window --space 2 - shift + cmd - 3 : yabai -m window --space 3 - shift + cmd - 4 : yabai -m window --space 4 - shift + cmd - 5 : yabai -m window --space 5 - ''; - }; - }; - system.defaults = { # Apple... Do I really have to change literally # every setting in macOS to make it actually usable. @@ -71,6 +9,15 @@ # # NOTE: default of those options is `null` (unmanaged) # https://github.com/mathiasbynens/dotfiles/blob/main/.macos for references + + ### Inputs + ".GlobalPreferences"."com.apple.mouse.scaling" = "-1"; # Disable mouse acceleration + trackpad = { + Clicking = true; + TrackpadRightClick = true; + }; + + ### Finder finder = { _FXShowPosixPathInTitle = false; AppleShowAllExtensions = true; @@ -83,11 +30,15 @@ ShowPathbar = true; ShowStatusBar = false; }; + + ### Login window loginwindow = { autoLoginUser = "Off"; DisableConsoleAccess = true; GuestEnabled = false; }; + + ### Finder menu menuExtraClock = { IsAnalog = false; Show24Hour = false; @@ -97,6 +48,8 @@ ShowDayOfWeek = true; ShowSeconds = false; }; + + ### Misc NSGlobalDomain = { "com.apple.keyboard.fnState" = true; "com.apple.mouse.tapBehavior" = 1; @@ -143,7 +96,4 @@ PMPrintingExpandedStateForPrint2 = true; }; }; - - # Set Git commit hash for darwin-version. - #system.configurationRevision = self.rev or self.dirtyRev or null; } \ No newline at end of file