From e6edbad14d8255743c7b259a1985db5fb5bd4e91 Mon Sep 17 00:00:00 2001 From: jjanzen Date: Wed, 5 Mar 2025 22:17:31 -0600 Subject: system changes --- macos.local/flake/system/aerospace.nix.org | 96 +++++++++++++++++++++++ macos.local/flake/system/core.nix.org | 61 +++++++++++++++ macos.local/flake/system/homebrew.nix.org | 118 +++++++++++++++++++++++++++++ 3 files changed, 275 insertions(+) create mode 100644 macos.local/flake/system/aerospace.nix.org create mode 100644 macos.local/flake/system/core.nix.org create mode 100644 macos.local/flake/system/homebrew.nix.org (limited to 'macos.local/flake/system') diff --git a/macos.local/flake/system/aerospace.nix.org b/macos.local/flake/system/aerospace.nix.org new file mode 100644 index 0000000..a0c72df --- /dev/null +++ b/macos.local/flake/system/aerospace.nix.org @@ -0,0 +1,96 @@ +#+title: Aerospace Configuration + +Enable Aerospace as a window manager for macOS. I have disabled gaps, move the mouse to follow windows, and an =i3=-like binding configuration. +#+begin_src nix + { config, pkgs, ... }: + + { + services.aerospace = { + enable = true; + settings = { + gaps = { + outer.left = 0; + outer.bottom = 0; + outer.top = 0; + outer.right = 0; + }; + on-focus-changed = [ + "move-mouse window-lazy-center" + ]; + on-window-detected = [ + { + "if".app-name-regex-substring = "mpv"; + run = [ + "layout floating" + ]; + } + ]; + workspace-to-monitor-force-assignment = { + "1" = "main"; + "2" = "main"; + "3" = "main"; + "4" = "main"; + "5" = "main"; + "6" = "main"; + "7" = "main"; + "8" = "main"; + "9" = [ + "secondary" + "dell" + ]; + "10" = [ + "secondary" + "built-in" + ]; + }; + mode.main.binding = { + cmd-enter = "exec-and-forget open -n /Applications/Ghostty.app/"; + cmd-shift-enter = "exec-and-forget /opt/homebrew/bin/emacs"; + cmd-d = "exec-and-forget ~/.local/bin/launcher"; + cmd-shift-f = "fullscreen"; + cmd-shift-space = "layout floating tiling"; + + cmd-h = "focus --boundaries-action wrap-around-the-workspace left"; + cmd-j = "focus --boundaries-action wrap-around-the-workspace down"; + cmd-k = "focus --boundaries-action wrap-around-the-workspace up"; + cmd-l = "focus --boundaries-action wrap-around-the-workspace right"; + + cmd-shift-h = "move left"; + cmd-shift-j = "move down"; + cmd-shift-k = "move up"; + cmd-shift-l = "move right"; + + cmd-shift-minus = "resize smart -50"; + cmd-shift-equal = "resize smart +50"; + + cmd-1 = "workspace 1"; + cmd-2 = "workspace 2"; + cmd-3 = "workspace 3"; + cmd-4 = "workspace 4"; + cmd-5 = "workspace 5"; + cmd-6 = "workspace 6"; + cmd-7 = "workspace 7"; + cmd-8 = "workspace 8"; + cmd-9 = "workspace 9"; + cmd-0 = "workspace 10"; + + cmd-shift-1 = "move-node-to-workspace 1"; + cmd-shift-2 = "move-node-to-workspace 2"; + cmd-shift-3 = "move-node-to-workspace 3"; + cmd-shift-4 = "move-node-to-workspace 4"; + cmd-shift-5 = "move-node-to-workspace 5"; + cmd-shift-6 = "move-node-to-workspace 6"; + cmd-shift-7 = "move-node-to-workspace 7"; + cmd-shift-8 = "move-node-to-workspace 8"; + cmd-shift-9 = "move-node-to-workspace 9"; + cmd-shift-0 = "move-node-to-workspace 10"; + + cmd-ctrl-shift-h = "join-with left"; + cmd-ctrl-shift-j = "join-with down"; + cmd-ctrl-shift-k = "join-with up"; + cmd-ctrl-shift-l = "join-with right"; + }; + }; + }; + } +#+end_src diff --git a/macos.local/flake/system/core.nix.org b/macos.local/flake/system/core.nix.org new file mode 100644 index 0000000..18ca960 --- /dev/null +++ b/macos.local/flake/system/core.nix.org @@ -0,0 +1,61 @@ +#+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; + myaspell = aspellWithDicts (d: [d.en d.en-computers d.en-science]); + in { + imports = [ + ./aerospace.nix + ./homebrew.nix + ]; + + # Unfortunately, I sometimes need unfree packages + nixpkgs.config.allowUnfree = true; + + # Install a small number of packages for root + environment.systemPackages = with pkgs; [ + gnupg + myaspell + neovim + ]; + + # Use TouchID for sudo + security.pam.services.sudo_local.touchIdAuth = true; + + # Open text files in neovim by default + environment.variables.EDITOR = "nvim"; + + # Enable nix packages + nix.package = pkgs.nix; + + programs.gnupg.agent.enable = false; + + # Use flakes + nix.settings.experimental-features = "nix-command flakes"; + + # Use zsh as my shell + programs.zsh.enable = true; + + # Enable documentation and make + documentation = { + enable = true; + info.enable = true; + man.enable = true; + }; + + system.stateVersion = 5; + + # Use ARM64 packages + nixpkgs.hostPlatform = "aarch64-darwin"; + + # Define my user + users.users.jjanzen = { + name = "jjanzen"; + home = "/Users/jjanzen"; + }; + } +#+end_src diff --git a/macos.local/flake/system/homebrew.nix.org b/macos.local/flake/system/homebrew.nix.org new file mode 100644 index 0000000..6a65114 --- /dev/null +++ b/macos.local/flake/system/homebrew.nix.org @@ -0,0 +1,118 @@ +#+title: Homebrew Configuration + +Set up Homebrew. I disable the quarantine automatically and ensure that the state of Homebrew is exactly as specified here. +#+begin_src nix + { config, pkgs, ... }: + + { + homebrew = { + enable = true; + + caskArgs.no_quarantine = true; + + global.autoUpdate = false; + onActivation = { + autoUpdate = true; + cleanup = "zap"; + upgrade = true; + }; + + taps = [ + "camillescholtz/formulae" + "d12frosted/emacs-plus" + "homebrew/bundle" + "homebrew/cask-fonts" + "homebrew/cask-versions" + "homebrew/services" + "jorgelbg/tap" + "osx-cross/avr" + ]; + + brews = [ + # emacs is handled better by homebrew on mac + { + name = "emacs-plus@30"; + args = [ + "with-native-comp" + "with-imagemagick" + "with-xwidgets" + "with-mailutils" + "with-ctags" + "with-retro-emacs-logo-icon" + ]; + } + + # problematic nix builds + "choose-gui" # nix version fails to build + "clang-format" # nix version screws up clang setup + "openjdk" # there's really no jdk for mac from nix? + "pinentry-touchid" # no nix version + + # need for grading purposes + "avrdude" + "open-mpi" + "open-ocd" + "osx-cross/avr/avr-binutils" + "osx-cross/avr/avarice" + "osx-cross/avr/avr-gcc@14" + + # needed for pdf-tools for emacs + "autoconf" + "automake" + "pkg-config" + "poppler" + + # required by emacs-plus@30 + "imagemagick" + "jansson" + "jpeg" + "libgccjit" + "librsvg" + "zlib" + + "mailutils" + "tree-sitter" + + # required by pinentry-touchid + "libassuan@2" + "gnupg" + "pinentry-mac" + ]; + + # homebrew handles graphical applications better than nix + casks = [ + "audacity" + "blender" + "cabal" + "calibre" + "desmume" + "discord" + "dwarf-fortress-lmp" + "firefox" + "gcc-arm-embedded" + "ghostty" + "gimp" + "godot" + "gzdoom" + "inkscape" + "krita" + "librewolf" + "multimc" + "obs" + "openemu" + "openmw" + "pokemon-showdown" + "proton-mail-bridge" + "protonvpn" + "qbittorrent" + "rar" + "syncthing" + "thunderbird" + "tor-browser" + "vlc" + "whisky" + "zotero" + ]; + }; + } +#+end_src -- cgit v1.2.3