From 26dd014860c0edd89a859d2d8c6dff10275acbad Mon Sep 17 00:00:00 2001 From: Jacob Janzen Date: Mon, 16 Dec 2024 23:28:56 -0600 Subject: system changes --- macos.local/.flake/system/core.nix.org | 76 ++++++--- macos.local/.flake/system/homebrew.nix.org | 242 +++++++++++++++-------------- macos.local/.flake/system/skhd.nix.org | 98 +++++++++++- macos.local/.flake/system/yabai.nix.org | 62 +++++++- 4 files changed, 345 insertions(+), 133 deletions(-) mode change 120000 => 100644 macos.local/.flake/system/skhd.nix.org mode change 120000 => 100644 macos.local/.flake/system/yabai.nix.org (limited to 'macos.local/.flake/system') diff --git a/macos.local/.flake/system/core.nix.org b/macos.local/.flake/system/core.nix.org index c80f3eb..13e3d97 100644 --- a/macos.local/.flake/system/core.nix.org +++ b/macos.local/.flake/system/core.nix.org @@ -1,47 +1,87 @@ #+title: System Core This file imports various system configuration components in addition to enabling flakes and defining the system version. - #+begin_src nix { config, pkgs, ... }: let - inherit (pkgs) aspellWithDicts; +#+end_src - myaspell = aspellWithDicts (d: [d.en d.en-computers d.en-science]); - in { - nixpkgs.config.allowUnfree = true; +Add =aspell= dictionaries. +#+begin_src nix + inherit (pkgs) aspellWithDicts; + myaspell = aspellWithDicts (d: [d.en d.en-computers d.en-science]); +#+end_src + +Import submodules. +#+begin_src nix + in { imports = [ ./homebrew.nix ./skhd.nix ./yabai.nix ]; +#+end_src - environment.systemPackages = with pkgs; [ - gnupg - myaspell - neovim - skhd - ]; +Allow unfree packages. +#+begin_src nix + nixpkgs.config.allowUnfree = true; +#+end_src - security.pam.enableSudoTouchIdAuth = true; +Install system packages. +#+begin_src nix + environment.systemPackages = with pkgs; [ + gnupg + myaspell + neovim + skhd + ]; +#+end_src + +Use Touch ID for =sudo= authentication. +#+begin_src nix + security.pam.enableSudoTouchIdAuth = true; +#+end_src - environment.variables.EDITOR = "nvim"; +Use Neovim as my default editor. +#+begin_src nix + environment.variables.EDITOR = "nvim"; +#+end_src - programs.gnupg.agent.enable = true; +Enable GPG agent. +#+begin_src nix + programs.gnupg.agent.enable = true; +#+end_src - services.nix-daemon.enable = true; - nix.package = pkgs.nix; +Enable =nix= daemon. +#+begin_src nix + services.nix-daemon.enable = true; + nix.package = pkgs.nix; +#+end_src - nix.settings.experimental-features = "nix-command flakes"; +Enable flakes. +#+begin_src nix + nix.settings.experimental-features = "nix-command flakes"; +#+end_src - programs.zsh.enable = true; +Use =zsh= as my shell. +#+begin_src nix + programs.zsh.enable = true; +#+end_src +Necessary boilerplate. +#+begin_src nix system.stateVersion = 5; +#+end_src +Use ARM packages for Darwin. +#+begin_src nix nixpkgs.hostPlatform = "aarch64-darwin"; +#+end_src +Define my users. +#+begin_src nix users.users.jjanzen = { name = "jjanzen"; home = "/Users/jjanzen"; diff --git a/macos.local/.flake/system/homebrew.nix.org b/macos.local/.flake/system/homebrew.nix.org index b92958c..2e92897 100644 --- a/macos.local/.flake/system/homebrew.nix.org +++ b/macos.local/.flake/system/homebrew.nix.org @@ -1,124 +1,140 @@ #+title: Homebrew Configuration +Set up Homebrew. #+begin_src nix { config, pkgs, ... }: { homebrew = { enable = true; - brews = [ - "aescrypt" - "aspell" - "avrdude" - "bash-language-server" - "bear" - "biber" - "binutils" - "bison" - "btop" - "choose-gui" - "clang-format" - "cmake" - "cmake-language-server" - "coreutils" - "curl" - "dos2unix" - "dotnet" - "eza" - "fd" - "gcc" - "gnutls" - "ffmpeg" - "fzf" - "go" - "gpgme" - "grep" - "htop" - "hunspell" - "hyfetch" - "imagemagick" - "ispell" - "jq" - "lesspipe" - "latexdiff" - "libgccjit" - "llvm@18" - "marksman" - "meson" - "mono" - "mpv" - "ninja" - "nmap" - "open-mpi" - "open-ocd" - "openjdk" - "pandoc" - "pinentry-mac" - "ripgrep" - "rsync" - "rust" - "sevenzip" - "shellcheck" - "shfmt" - "telnet" - "texlab" - "tree-sitter" - "typescript-language-server" - "wget" - "yt-dlp" - { - name = "d12frosted/emacs-plus/emacs-plus@29"; - args = [ "with-imagemagick" ]; - } - "felixkratz/formulae/sketchybar" - "osx-cross/avr/avr-binutils" - "osx-cross/avr/avarice" - "osx-cross/avr/avr-gcc@14" - ]; - caskArgs.no_quarantine = true; - casks = [ - "alacritty" - "audacity" - "blender" - "cabal" - "calibre" - "desmume" - "gcc-arm-embedded" - "gimp" - "godot" - "inkscape" - "krita" - "mactex" - "multimc" - "obs" - "openemu" - "pokemon-showdown" - "protonmail-bridge" - "protonvpn" - "qbittorrent" - "rar" - "syncthing" - "thunderbird" - "vlc" - "whisky" - "zen-browser" - "zotero" - ]; - global.autoUpdate = false; - onActivation = { - autoUpdate = false; - cleanup = "zap"; - upgrade = true; - }; - taps = [ - "d12frosted/emacs-plus" - "felixkratz/formulae" - "homebrew/bundle" - "homebrew/cask-fonts" - "homebrew/cask-versions" - "homebrew/services" - "osx-cross/avr" - ]; +#+end_src + +Do not quarantine casks. +#+begin_src nix + caskArgs.no_quarantine = true; +#+end_src + +Don't automatically update except with Nix update and clean up any packages that are not listed. +#+begin_src nix + global.autoUpdate = false; + onActivation = { + autoUpdate = false; + cleanup = "zap"; + upgrade = true; + }; +#+end_src + +List the taps to use on Homebrew. +#+begin_src nix + taps = [ + "felixkratz/formulae" + "homebrew/bundle" + "homebrew/cask-fonts" + "homebrew/cask-versions" + "homebrew/services" + "osx-cross/avr" + ]; +#+end_src + +List packages to install with Homebrew. +#+begin_src nix + brews = [ + "aescrypt" + "avrdude" + "bash-language-server" + "bear" + "binutils" + "bison" + "choose-gui" + "clang-format" + "cmake" + "cmake-language-server" + "coreutils" + "curl" + "dos2unix" + "dotnet" + "eza" + "fd" + "gcc" + "gnutls" + "ffmpeg" + "fzf" + "go" + "gpgme" + "grep" + "htop" + "hunspell" + "hyfetch" + "imagemagick" + "ispell" + "jq" + "lesspipe" + "latexdiff" + "libgccjit" + "llvm@18" + "marksman" + "meson" + "mono" + "mpv" + "ninja" + "nmap" + "open-mpi" + "open-ocd" + "openjdk" + "pandoc" + "pinentry-mac" + "ripgrep" + "rsync" + "rust" + "sevenzip" + "shellcheck" + "shfmt" + "telnet" + "tree-sitter" + "typescript-language-server" + "wget" + "yt-dlp" + "felixkratz/formulae/sketchybar" + "osx-cross/avr/avr-binutils" + "osx-cross/avr/avarice" + "osx-cross/avr/avr-gcc@14" + ]; +#+end_src + +List casks to install with Homebrew. +#+begin_src nix + casks = [ + "alacritty" + "audacity" + "blender" + "cabal" + "calibre" + "desmume" + "gcc-arm-embedded" + "gimp" + "godot" + "inkscape" + "krita" + "mactex" + "multimc" + "obs" + "openemu" + "pokemon-showdown" + "protonmail-bridge" + "protonvpn" + "qbittorrent" + "rar" + "syncthing" + "thunderbird" + "vlc" + "whisky" + "zen-browser" + "zotero" + ]; +#+end_src + +Close Homebrew configuration +#+begin_src nix }; } #+end_src diff --git a/macos.local/.flake/system/skhd.nix.org b/macos.local/.flake/system/skhd.nix.org deleted file mode 120000 index 2e81cc0..0000000 --- a/macos.local/.flake/system/skhd.nix.org +++ /dev/null @@ -1 +0,0 @@ -../../../common/.flake/system/skhd.nix.org \ No newline at end of file diff --git a/macos.local/.flake/system/skhd.nix.org b/macos.local/.flake/system/skhd.nix.org new file mode 100644 index 0000000..086a750 --- /dev/null +++ b/macos.local/.flake/system/skhd.nix.org @@ -0,0 +1,97 @@ +#+title: SKHD Configuration + +I use =skhd= to configure keyboard bindings. +#+begin_src nix + { config, pkgs, ... }: + + { + services.skhd = { + enable = true; + skhdConfig = '' +#+end_src + +Use =⌘-Enter= to open my terminal. +#+begin_src text + cmd - return : /opt/homebrew/bin/alacritty +#+end_src + +Close a window with =⌘-Shift-Q= to close a window. +#+begin_src text + cmd + shift - q : yabai -m window --close +#+end_src + +Launch an application with =⌘-D=. +#+begin_src text + cmd - d : ~/.local/bin/launcher +#+end_src + +Reload the configuration with =⌘-Shift-C=. +#+begin_src text + cmd + shift - c : yabai --restart-service && skhd --restart-service +#+end_src + +Move focus with =⌘-[HJKL]= to move left (H), down (J), up (K), or right (L). +#+begin_src text + cmd - h : yabai -m window --focus west || yabai -m display --focus west + cmd - j : yabai -m window --focus south || yabai -m display --focus south + cmd - k : yabai -m window --focus north || yabai -m display --focus north + cmd - l : yabai -m window --focus east || yabai -m display --focus east +#+end_src + +Move window with =⌘-Shift-[HJKL]= to move left (H), down (J), up (K), or right (L). +#+begin_src text + shift + cmd - h : yabai -m window --warp west + shift + cmd - j : yabai -m window --warp south + shift + cmd - k : yabai -m window --warp north + shift + cmd - l : yabai -m window --warp east +#+end_src + +Move to space =x= with =⌘-x=. +#+begin_src text + cmd - 1 : yabai -m space --focus 1 + 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 + cmd - 6 : yabai -m space --focus 6 + cmd - 7 : yabai -m space --focus 7 + cmd - 8 : yabai -m space --focus 8 + cmd - 9 : yabai -m space --focus 9 + cmd - 0 : yabai -m space --focus 10 +#+end_src + +Move application to space =x= with =⌘-=Shift-x=. +#+begin_src text + cmd + shift - 1 : yabai -m window --space 1 + cmd + shift - 2 : yabai -m window --space 2 + cmd + shift - 3 : yabai -m window --space 3 + cmd + shift - 4 : yabai -m window --space 4 + cmd + shift - 5 : yabai -m window --space 5 + cmd + shift - 6 : yabai -m window --space 6 + cmd + shift - 7 : yabai -m window --space 7 + cmd + shift - 8 : yabai -m window --space 8 + cmd + shift - 9 : yabai -m window --space 9 + cmd + shift - 0 : yabai -m window --space 10 +#+end_src + +Toggle fullscreen with =⌘-Shift-F=. +#+begin_src text + cmd + shift - f : yabai -m window --toggle zoom-fullscreen +#+end_src + +Toggle floating with =⌘-Shift-Space=. +#+begin_src text + cmd + shift - space : yabai -m window --toggle float +#+end_src + +Take a screenshot with =⌘-Shift-S=. +#+begin_src text + cmd + shift - s : open /System/Applications/Utilities/Screenshot.app +#+end_src + +Close the block. +#+begin_src nix + ''; + }; + } +#+end_src diff --git a/macos.local/.flake/system/yabai.nix.org b/macos.local/.flake/system/yabai.nix.org deleted file mode 120000 index 08a3a0b..0000000 --- a/macos.local/.flake/system/yabai.nix.org +++ /dev/null @@ -1 +0,0 @@ -../../../common/.flake/system/yabai.nix.org \ No newline at end of file diff --git a/macos.local/.flake/system/yabai.nix.org b/macos.local/.flake/system/yabai.nix.org new file mode 100644 index 0000000..1c70dcc --- /dev/null +++ b/macos.local/.flake/system/yabai.nix.org @@ -0,0 +1,61 @@ +#+title: Yabai Configuration + +#+begin_src nix + { config, pkgs, ... }: + + { + services.yabai = { + enable = true; +#+end_src + +Use scripting addition features. +#+begin_src nix + enableScriptingAddition = true; + config = { +#+end_src + +Use auto-tiling. +#+begin_src nix + layout = "bsp"; + auto_balance = "on"; +#+end_src + +Do not use padding between windows. +#+begin_src nix + top_padding = 0; + bottom_padding = 0; + left_padding = 0; + right_padding = 0; + window_gap = 0; +#+end_src + +Disable window shadows unless the application is floating. +#+begin_src nix + window_shadow = "float"; +#+end_src + +Mouse moves to focused window and windows are focused on mouse hover. +#+begin_src nix + focus_follows_mouse = "autoraise"; + mouse_follows_focus = "on"; +#+end_src + +Use =⌘= with the mouse to move and resize. +#+begin_src nix + mouse_modifier = "cmd"; + mouse_action1 = "move"; + mouse_action2 = "resize"; + mouse_drop_action = "swap"; +#+end_src + +Add exceptions for some apps. +#+begin_src nix + }; + extraConfig = '' + yabai -m rule --add app="^System Settings$" manage=off + yabai -m rule --add app="^Calculator$" manage=off + yabai -m rule --add app="^mpv" manage=off + ''; + }; + } +#+end_src -- cgit v1.2.3