diff --git a/.gitignore b/.gitignore index 17735df..56aba49 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store home/.config/lazygit/state.yml neomuttrc.local +karabiner/automatic_backups/ result diff --git a/aerospace/aerospace.toml b/aerospace/aerospace.toml index dab46cd..1d398c1 100644 --- a/aerospace/aerospace.toml +++ b/aerospace/aerospace.toml @@ -70,7 +70,7 @@ cmd-alt-h = [] # Disable "hide others" # All possible commands: https://nikitabobko.github.io/AeroSpace/commands cmd-enter = 'exec-and-forget open -n /Applications/Ghostty.app' -cmd-b = 'exec-and-forget open -n /Applications/qutebrowser.app' +cmd-b = 'exec-and-forget open -n ~/Applications/Nix/Firefox.app' # See: https://nikitabobko.github.io/AeroSpace/commands#layout # alt-slash = 'layout tiles horizontal vertical' @@ -120,9 +120,8 @@ cmd-shift-c = 'reload-config' cmd-shift-f = 'fullscreen' cmd-shift-v = 'layout h_tiles' -cmd-shift-h = 'layout v_tiles' +cmd-shift-s = 'layout v_tiles' cmd-shift-t = 'layout h_accordion' -cmd-shift-s = 'layout v_accordion' [[on-window-detected]] if.app-id = 'org.qutebrowser.qutebrowser' diff --git a/flake.lock b/flake.lock index 824b7ec..f2480a2 100644 --- a/flake.lock +++ b/flake.lock @@ -22,16 +22,16 @@ "brew-src": { "flake": false, "locked": { - "lastModified": 1749511373, - "narHash": "sha256-7u1TdHQaUCzzgf/n8T3bQosuYXyNBEPU/3WQQqozE5o=", + "lastModified": 1751910772, + "narHash": "sha256-jQNdIkq2iRDNWskd5f8kX6q9BO/CBSXhMH41WNRft8E=", "owner": "Homebrew", "repo": "brew", - "rev": "7b4ef99fed96966269ee35994407fa4c06097a4d", + "rev": "700d67a85e0129ab8a893ff69246943479e33df1", "type": "github" }, "original": { "owner": "Homebrew", - "ref": "4.5.6", + "ref": "4.5.9", "repo": "brew", "type": "github" } @@ -151,11 +151,11 @@ "zon2nix": "zon2nix" }, "locked": { - "lastModified": 1751840395, - "narHash": "sha256-g93h5xxNUDZha8ppkNbYKYOem9aPJc0IqdwpHNyKMzo=", + "lastModified": 1752328988, + "narHash": "sha256-07BUaMjLkaSjUgVhlSrbODF+OZHCck5PeGvbtq6wQaA=", "owner": "ghostty-org", "repo": "ghostty", - "rev": "78e861b50ea88aa7e9cfb5362364f40f47943088", + "rev": "b5000dcd94b75d745dacbcd3d4bfaf181d288671", "type": "github" }, "original": { @@ -171,11 +171,11 @@ ] }, "locked": { - "lastModified": 1751824240, - "narHash": "sha256-aDDC0CHTlL7QDKWWhdbEgVPK6KwWt+ca0QkmHYZxMzI=", + "lastModified": 1752402455, + "narHash": "sha256-mCHfZhQKdTj2JhCFcqfOfa3uKZbwUkPQbd0/zPnhOE8=", "owner": "nix-community", "repo": "home-manager", - "rev": "fd9e55f5fac45a26f6169310afca64d56b681935", + "rev": "bf893ad4cbf46610dd1b620c974f824e266cd1df", "type": "github" }, "original": { @@ -203,11 +203,11 @@ "homebrew-cask": { "flake": false, "locked": { - "lastModified": 1751821182, - "narHash": "sha256-E5YKU/HJLstUz1T2aQhjVpGnh5xr7KbQ/FyKq1HPoVM=", + "lastModified": 1752406759, + "narHash": "sha256-p7b4Ip0wKFS6YacLjrzri2h6p52blGHOzylb+Cg0sRg=", "owner": "homebrew", "repo": "homebrew-cask", - "rev": "b96f8b9b46ba3f49b82767dc469b459a92a080fc", + "rev": "baf53b769e2febbe32f62ac3754cf5898be997fc", "type": "github" }, "original": { @@ -219,11 +219,11 @@ "homebrew-core": { "flake": false, "locked": { - "lastModified": 1751824569, - "narHash": "sha256-FnecbUxCRzxfq6BfHJbY72/TIsoiJLqySTBT80OvdWU=", + "lastModified": 1752402389, + "narHash": "sha256-OYgOxxtJE/eK7I3HJj5N9kUXlASyij+l80hbohDxeAs=", "owner": "homebrew", "repo": "homebrew-core", - "rev": "1d376783e883c6d15239fec91faba7ffcd289794", + "rev": "9c488c37fe89cb176e9a1dff5835baf214fcffb5", "type": "github" }, "original": { @@ -232,22 +232,6 @@ "type": "github" } }, - "homebrew-nikitabobko": { - "flake": false, - "locked": { - "lastModified": 1746359410, - "narHash": "sha256-hXcquTkyfKZw2p8bAE4Yh6we8xeAZbwNHhQtoK6SMU4=", - "owner": "nikitabobko", - "repo": "homebrew-tap", - "rev": "6714dd2c19455643dbe754e6ec8454a86b3000d1", - "type": "github" - }, - "original": { - "owner": "nikitabobko", - "repo": "homebrew-tap", - "type": "github" - } - }, "neovim": { "inputs": { "flake-utils": "flake-utils_2", @@ -293,11 +277,11 @@ "brew-src": "brew-src" }, "locked": { - "lastModified": 1749952250, - "narHash": "sha256-V2ix0knpdJXirQ+4pjbnggjdSALTsFWGIP/NDpaQkdU=", + "lastModified": 1752160973, + "narHash": "sha256-BCC8KB7TEtwv7vZN1WDu870tRbXtzUcmF9xNr6ws5Wc=", "owner": "zhaofengli-wip", "repo": "nix-homebrew", - "rev": "37126f06f4890f019af3d7606ce5d30a457afcd0", + "rev": "69c1aa2f136f3c3326d9b6770e0eb54f12832971", "type": "github" }, "original": { @@ -312,11 +296,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1749574455, - "narHash": "sha256-fm2/8KPOYvvIAnNVtjDlTt/My00lIbZQ+LMrfQIWVzs=", + "lastModified": 1752199438, + "narHash": "sha256-xSBMmGtq8K4Qv80TMqREmESCAsRLJRHAbFH2T/2Bf1Y=", "owner": "nix-community", "repo": "NixOS-WSL", - "rev": "917af390377c573932d84b5e31dd9f2c1b5c0f09", + "rev": "d34d9412556d3a896e294534ccd25f53b6822e80", "type": "github" }, "original": { @@ -360,27 +344,27 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1749173751, - "narHash": "sha256-ENY3y3v6S9ZmLDDLI3LUT8MXmfXg/fSt2eA4GCnMVCE=", + "lastModified": 1751792365, + "narHash": "sha256-J1kI6oAj25IG4EdVlg2hQz8NZTBNYvIS0l4wpr9KcUo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ed29f002b6d6e5e7e32590deb065c34a31dc3e91", + "rev": "1fd8bada0b6117e6c7eb54aad5813023eed37ccb", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-24.11", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_4": { "locked": { - "lastModified": 1751637120, - "narHash": "sha256-xVNy/XopSfIG9c46nRmPaKfH1Gn/56vQ8++xWA8itO4=", + "lastModified": 1751984180, + "narHash": "sha256-LwWRsENAZJKUdD3SpLluwDmdXY9F45ZEgCb0X+xgOL0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5c724ed1388e53cc231ed98330a60eb2f7be4be3", + "rev": "9807714d6944a957c2e036f84b0ff8caf9930bc0", "type": "github" }, "original": { @@ -398,11 +382,11 @@ ] }, "locked": { - "lastModified": 1751824066, - "narHash": "sha256-bh/3BURJLJHUT0gpsR3NDkLVSme/dfoqv7EdXnxlAJo=", + "lastModified": 1752402434, + "narHash": "sha256-lC/l4YJckdmYm5AbT82Z6tZdhlha3LVupR463Bp5P+I=", "owner": "nix-community", "repo": "NUR", - "rev": "c6a24385d1e517bb1d901d63148828c8cfdff3dd", + "rev": "b8f1b91334cb6ab7a5c6edd9a15068cdd6a91d04", "type": "github" }, "original": { @@ -419,7 +403,6 @@ "homebrew-bundle": "homebrew-bundle", "homebrew-cask": "homebrew-cask", "homebrew-core": "homebrew-core", - "homebrew-nikitabobko": "homebrew-nikitabobko", "neovim": "neovim", "nix-darwin": "nix-darwin", "nix-homebrew": "nix-homebrew", diff --git a/flake.nix b/flake.nix index ba871fa..f421b00 100644 --- a/flake.nix +++ b/flake.nix @@ -42,10 +42,6 @@ url = "github:homebrew/homebrew-bundle"; flake = false; }; - homebrew-nikitabobko = { - url = "github:nikitabobko/homebrew-tap"; - flake = false; - }; }; outputs = @@ -63,7 +59,6 @@ homebrew-core, homebrew-cask, homebrew-bundle, - homebrew-nikitabobko, ... }: let @@ -197,7 +192,6 @@ "homebrew/core" = homebrew-core; "homebrew/cask" = homebrew-cask; "homebrew/bundle" = homebrew-bundle; - "nikitabobko/tap" = homebrew-nikitabobko; }; mutableTaps = true; }; diff --git a/karabiner/karabiner.json b/karabiner/karabiner.json new file mode 100644 index 0000000..341ef4f --- /dev/null +++ b/karabiner/karabiner.json @@ -0,0 +1,231 @@ +{ + "global": { "check_for_updates_on_startup": false }, + "profiles": [ + { + "complex_modifications": { + "rules": [ + { + "description": "Map Cmd+h/j/k/l to Cmd+ArrowKeys and Ctrl+h/j/k/l to original Cmd+h/j/k/l", + "manipulators": [ + { + "from": { + "key_code": "h", + "modifiers": { + "mandatory": ["command"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "left_arrow", + "modifiers": ["command"] + } + ], + "type": "basic" + }, + { + "from": { + "key_code": "h", + "modifiers": { + "mandatory": ["fn"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "h", + "modifiers": ["command"] + } + ], + "type": "basic" + }, + { + "from": { + "key_code": "j", + "modifiers": { + "mandatory": ["command"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "down_arrow", + "modifiers": ["command"] + } + ], + "type": "basic" + }, + { + "from": { + "key_code": "j", + "modifiers": { + "mandatory": ["fn"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "j", + "modifiers": ["command"] + } + ], + "type": "basic" + }, + { + "from": { + "key_code": "k", + "modifiers": { + "mandatory": ["command"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "up_arrow", + "modifiers": ["command"] + } + ], + "type": "basic" + }, + { + "from": { + "key_code": "k", + "modifiers": { + "mandatory": ["fn"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "k", + "modifiers": ["command"] + } + ], + "type": "basic" + }, + { + "from": { + "key_code": "l", + "modifiers": { + "mandatory": ["command"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "right_arrow", + "modifiers": ["command"] + } + ], + "type": "basic" + }, + { + "from": { + "key_code": "l", + "modifiers": { + "mandatory": ["fn"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "l", + "modifiers": ["command"] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Caps Lock → Control when held, Escape when tapped", + "manipulators": [ + { + "from": { + "key_code": "caps_lock", + "modifiers": { "optional": ["any"] } + }, + "to": [{ "key_code": "left_control" }], + "to_if_alone": [{ "key_code": "escape" }], + "type": "basic" + } + ] + }, + { + "description": "Escape ↔ Caps Lock toggle", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "escape", + "modifiers": { + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "caps_lock" + } + ] + }, + { + "type": "basic", + "from": { + "key_code": "escape", + "modifiers": { + "mandatory": ["shift"] + } + }, + "to": [ + { + "key_code": "caps_lock" + } + ] + } + ] + }, + { + "description": "Control+Backspace → Option+Backspace (word deletion)", + "manipulators": [ + { + "from": { + "key_code": "delete_or_backspace", + "modifiers": { + "mandatory": ["control"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "delete_or_backspace", + "modifiers": ["option"] + } + ], + "type": "basic" + }, + { + "from": { + "key_code": "delete_or_backspace", + "modifiers": { + "mandatory": ["control", "shift"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "delete_or_backspace", + "modifiers": ["option", "shift"] + } + ], + "type": "basic" + } + ] + } + ] + }, + "name": "Default profile", + "selected": true, + "virtual_hid_keyboard": { "keyboard_type_v2": "iso" } + } + ] +} diff --git a/nix/home/darwin.nix b/nix/home/darwin.nix index bed8372..b2b08b1 100644 --- a/nix/home/darwin.nix +++ b/nix/home/darwin.nix @@ -1,5 +1,6 @@ { pkgs, + lib, config, ... }: @@ -10,15 +11,33 @@ let ".config/aerospace" "aerospace" ] + [ + ".config/karabiner" + "karabiner" + ] ]; in { + imports = [ + ./common/firefox.nix + ]; + home = { packages = with pkgs; [ gawk discord - bitwarden-cli + aerospace + mas + raycast ]; file = utils.mk_symlinks { inherit config dotfiles; }; + + activation.applications = utils.mkAppAliasHome { + derivationName = "home-applications"; + appsPath = config.home.packages; + outputDir = "${config.home.homeDirectory}/Applications/Nix"; + pkgs = pkgs; + lib = lib; + }; }; } diff --git a/nix/home/linux.nix b/nix/home/linux.nix index d7a7b5d..0f077fc 100644 --- a/nix/home/linux.nix +++ b/nix/home/linux.nix @@ -53,7 +53,6 @@ in mako bitwarden-cli sway-audio-idle-inhibit - qutebrowser ffmpeg imv ]; diff --git a/nix/system/darwin.nix b/nix/system/darwin.nix index ab5a647..13b334e 100644 --- a/nix/system/darwin.nix +++ b/nix/system/darwin.nix @@ -1,9 +1,13 @@ { pkgs, config, + lib, self, ... }: +let + utils = import ../utils.nix; +in { environment.systemPackages = with pkgs; [ @@ -15,12 +19,10 @@ enable = true; casks = [ "ghostty" - "nikitabobko/tap/aerospace" - "qutebrowser" - "shortcat" + "karabiner-elements" ]; brews = [ - "mas" + "bitwarden-cli" ]; masApps = { }; onActivation.cleanup = "zap"; @@ -62,31 +64,13 @@ }; hitoolbox.AppleFnUsageType = "Show Emoji & Symbols"; }; - keyboard = { - enableKeyMapping = true; - nonUS.remapTilde = true; - remapCapsLockToEscape = true; - swapLeftCtrlAndFn = false; + + activationScripts.applications.text = utils.mkAppAliasSystem { + derivationName = "system-applications"; + appsPath = config.environment.systemPackages; + outputDir = "/Applications/Nix"; + pkgs = pkgs; + lib = lib; }; - activationScripts.applications.text = - let - env = pkgs.buildEnv { - name = "system-applications"; - paths = config.environment.systemPackages; - pathsToLink = "/Applications"; - }; - in - pkgs.lib.mkForce '' - # Set up applications - echo "setting up /Applications..." >&2 - rm -rf /Applications/Nix\ Apps - mkdir -p /Applications/Nix\ Apps - find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + | - while read -r src; do - app_name=$(basename "$src") - echo "copying $src" >&2 - ${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name" - done - ''; }; } diff --git a/nix/utils.nix b/nix/utils.nix index a70c4a9..8a0a3c9 100644 --- a/nix/utils.nix +++ b/nix/utils.nix @@ -1,4 +1,4 @@ -{ +rec { mk_symlinks = { config, @@ -13,4 +13,37 @@ }; }) dotfiles ); + + mkAppAliasSystem = args: args.pkgs.lib.mkForce (mkAppAliasScriptContent args); + mkAppAliasHome = + args: args.lib.hm.dag.entryAfter [ "writeBoundary" ] (mkAppAliasScriptContent args); + + # Darwin System / Home Manager expects activation scripts in different formats + # This only return the script body, use the other two functions in the config. + mkAppAliasScriptContent = + { + derivationName, + appsPath, + outputDir, + pkgs, + lib, + }: + let + env = pkgs.buildEnv { + name = derivationName; + paths = appsPath; + pathsToLink = "/Applications"; + }; + in + '' + echo "Setting up macOS .app aliases..." >&2 + rm -rf "${outputDir}" + mkdir -p "${outputDir}" + + find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + | + while read -r src; do + app_name=$(basename "$src") + ${pkgs.mkalias}/bin/mkalias "$src" "${outputDir}/$app_name" + done + ''; } diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 0bb6785..6e6bc44 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,12 +1,12 @@ { "arrow.nvim": { "branch": "master", "commit": "6e0f726f55f99332dd726a53effd6813786b6d49" }, "blink.cmp": { "branch": "main", "commit": "cb5e346d9e0efa7a3eee7fd4da0b690c48d2a98e" }, - "codecompanion-spinner.nvim": { "branch": "main", "commit": "ce2bb2d73b34c25f356d10343d1cf27b0ba37a40" }, - "codecompanion.nvim": { "branch": "main", "commit": "17f7cbb6cabdc12195f164acf4c59c7c7c205b64" }, + "codecompanion-spinner.nvim": { "branch": "main", "commit": "af0dd1af48052c9e6ea0927ed9e5418438b62d84" }, + "codecompanion.nvim": { "branch": "main", "commit": "28eab4386b04dc222de6c27349ea5ae0d1a92866" }, "codesnap.nvim": { "branch": "main", "commit": "be6d6b9a3b5e6999edbda76b16dace03d9bfcd3d" }, - "copilot.vim": { "branch": "release", "commit": "3955014c503b0cd7b30bc56c86c56c0736ca0951" }, + "copilot.vim": { "branch": "release", "commit": "12995dffe10282b29b8335650bf3e7457f4870e7" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "gitsigns.nvim": { "branch": "main", "commit": "362fe61f9f19e9bceff178792780df5cce118a7d" }, + "gitsigns.nvim": { "branch": "main", "commit": "4666d040b60d1dc0e474ccd9a3fd3c4d67b4767c" }, "goto-preview": { "branch": "main", "commit": "d1faf6ea992b5bcaaaf2c682e1aba3131a01143e" }, "inc-rename.nvim": { "branch": "main", "commit": "a3e31af13844534c66041ce92f29af7745883875" }, "incline.nvim": { "branch": "main", "commit": "0fd2d5a27504dba7fdc507a53275f22c081fe640" }, @@ -22,10 +22,10 @@ "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, "nvim-dap": { "branch": "master", "commit": "cc77338e6e34c79f1c638f51ae4160dc9bfb05de" }, - "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, + "nvim-dap-go": { "branch": "main", "commit": "b4421153ead5d726603b02743ea40cf26a51ed5f" }, "nvim-dap-python": { "branch": "master", "commit": "261ce649d05bc455a29f9636dc03f8cdaa7e0e2c" }, "nvim-dap-repl-highlights": { "branch": "master", "commit": "c6d5dfb8e9ce55f60d5fe2a950d3b8f484237226" }, - "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, + "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, "nvim-lightbulb": { "branch": "master", "commit": "aa3a8b0f4305b25cfe368f6c9be9923a7c9d0805" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, @@ -33,7 +33,7 @@ "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-treesitter-context": { "branch": "master", "commit": "59f318a65d42a5c4037796886a8874fd57f774fc" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "89ebe73cd2836db80a22d9748999ace0241917a5" }, - "nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" }, + "nvim-web-devicons": { "branch": "master", "commit": "a1366758b3a232036dc97be8ca41184aa3f50506" }, "persistence.nvim": { "branch": "main", "commit": "166a79a55bfa7a4db3e26fc031b4d92af71d0b51" }, "persistent-breakpoints.nvim": { "branch": "main", "commit": "d1656221836207787b8a7969cc2dc72668c4742a" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, diff --git a/nvim/lsp/clangd.lua b/nvim/lsp/clangd.lua index 67d7144..a8db7aa 100644 --- a/nvim/lsp/clangd.lua +++ b/nvim/lsp/clangd.lua @@ -31,9 +31,7 @@ return { "--completion-style=bundled", -- Simpler completions for faster performance "--rename-file-limit=0", -- No limit on renaming files "--header-insertion=iwyu", -- Suggest missing includes based on IWYU - "--inlay-hints", -- Enable inlay hints for parameter and type information "--limit-results=70", -- Limit autocompletion and symbol results - "--suggest-missing-includes", -- Still show missing includes suggestions "--pch-storage=disk", -- Stores precompiled headers on disk (fixes the issue where system ran out of memory when indexing large projects, not a huge performance hit on fast m2 ssds) "--log=error", -- Log only errors },