dotfiles
0

Configure Feed

Select the types of activity you want to include in your feed.

dot / nix / darwin.nix
7.9 kB 254 lines
1{ self, lib, pkgs, pkgs-unstable, ... }: { 2 # List packages installed in system profile. To search by name, run: 3 # $ nix-env -qaP | grep wget 4 environment.systemPackages = 5 [ 6 pkgs.fzf 7 pkgs.tmux 8 pkgs.tree 9 pkgs.vim 10 pkgs.git 11 pkgs-unstable.ollama 12 # used for remote linux deployment 13 pkgs.nixos-rebuild 14 # I don't want to touch this due to current neovim settings. 15 # remove it when lux.nvim is out 16 (pkgs-unstable.lua5_1.withPackages (ps: with ps; [luarocks])) 17 # (let 18 # prSrc = pkgs.fetchFromGitHub { 19 # owner = "Other-Open-Source-Projects"; 20 # repo = "opencode"; 21 # rev = "feat/custom-provider-compat"; 22 # hash = "sha256-2Ji+/4RCPdj9qfLGKw01DRjLzU7hFk3+Je5TUEFWclQ="; 23 # }; 24 # in pkgs-unstable.opencode.overrideAttrs (old: prev: { 25 # src = prSrc; 26 # node_modules = prev.node_modules.overrideAttrs (old: { 27 # src = prSrc; 28 # outputHash = ""; 29 # }); 30 # })) 31 ]; 32 33 launchd.user.agents = { 34 # reference: 35 # - https://www.danielcorin.com/til/nix-darwin/launch-agents/ 36 # - https://medium.com/@anand34577/setting-up-ollama-as-a-background-service-on-macos-66f7492b5cc8 37 ollama-serve = { 38 environment = { 39 OLLAMA_HOST = "0.0.0.0"; 40 OLLAMA_CONTEXT_LENGTH = "64000"; 41 }; 42 serviceConfig = { 43 Label = "com.ollama.serve"; 44 ProgramArguments = [ "${pkgs-unstable.ollama}/bin/ollama" "serve" ]; 45 KeepAlive = true; 46 RunAtLoad = true; 47 # TODO: ensure /var/log/ollama exist 48 # StandardOutPath = "/var/log/ollama/stdout.log"; 49 # StandardErrorPath = "/var/log/ollama/stderr.log"; 50 StandardOutPath = "/tmp/ollama_boltless.log"; 51 StandardErrorPath = "/tmp/ollama_boltless.err"; 52 }; 53 }; 54 # reference: https://gist.github.com/echo-dave/0d1ee6951c4e3bf00d738e84868e7d59 55 # FIXME: not working 56 ssh-use-keychain = { 57 serviceConfig = { 58 Label = "me.boltless.usekeychain"; 59 # ProgramArguments = [ "bash" "-c" "ssh-add" "--apple-load-keychain" ]; 60 ProgramArguments = [ "/bin/echo" "hello" ]; 61 RunAtLoad = true; 62 KeepAlive = false; 63 StandardOutPath = "/var/log/usekeychain.log"; 64 StandardErrorPath = "/var/log/usekeychain.err"; 65 }; 66 }; 67 }; 68 69 # Necessary for using flakes on this system. 70 nix.settings.experimental-features = "nix-command flakes"; 71 # Enable rosetta binaries 72 nix.settings.extra-platforms = "x86_64-darwin aarch64-darwin"; 73 74 nix.settings.trusted-users = [ "@admin" ]; 75 nix.settings.extra-trusted-users = [ "boltless" ]; 76 77 nix.linux-builder = { 78 enable = true; 79 maxJobs = lib.mkDefault 4; 80 config.virtualisation = { 81 cores = lib.mkDefault 6; 82 }; 83 }; 84 85 # Enable alternative shell support in nix-darwin. 86 # programs.fish.enable = true; 87 88 system.primaryUser = "boltless"; 89 90 # Set Git commit hash for darwin-version. 91 system.configurationRevision = self.rev or self.dirtyRev or null; 92 93 # Used for backwards compatibility, please read the changelog before changing. 94 # $ darwin-rebuild changelog 95 system.stateVersion = 5; 96 97 # The platform the configuration will be used on. 98 nixpkgs.hostPlatform = "aarch64-darwin"; 99 100 system.defaults.finder = { 101 FXRemoveOldTrashItems = true; 102 ShowPathbar = true; 103 ShowStatusBar = true; 104 }; 105 106 system.defaults.dock = { 107 autohide = true; 108 autohide-delay = 0.0; 109 autohide-time-modifier = 0.6; 110 mru-spaces = false; 111 show-recents = false; 112 orientation = "left"; 113 # Disable bottom-right corner action 114 wvous-br-corner = 1; 115 # persistent-apps = []; 116 }; 117 118 system.defaults.NSGlobalDomain = { 119 AppleShowAllExtensions = true; 120 # default minimum is 15 (225ms) 121 InitialKeyRepeat = 10; 122 # default minimum is 2 (30ms) 123 KeyRepeat = 1; 124 # Use f1, f2, etc. keys as standard function keys. 125 "com.apple.keyboard.fnState" = true; 126 }; 127 128 system.defaults.controlcenter = { 129 NowPlaying = false; 130 Sound = true; 131 }; 132 133 # reference https://medium.com/@zmre/nix-darwin-quick-tip-activate-your-preferences-f69942a93236 134 # for more 135 # https://gist.github.com/ChristopherA/98628f8cd00c94f11ee6035d53b0d3c6 136 # is also cool 137 system.defaults.CustomUserPreferences = { 138 # see https://apple.stackexchange.com/a/429820 139 "com.apple.Safari.SandboxBroker" = { 140 ShowDevelopMenu = true; 141 }; 142 "com.apple.Safari" = { 143 IncludeDevelopMenu = true; 144 IncludeInternalDebugMenu = true; 145 SearchProviderIdentifier = "com.duckduckgo"; 146 ShowFullURLInSmartSearchField = true; 147 # preview url on bottom left corner when hover links 148 ShowOverlayStatusBar = true; 149 WebAutomaticSpellingCorrectionEnabled = false; 150 WebContinuousSpellCheckingEnabled = true; 151 WebKitDeveloperExtrasEnabledPreferenceKey = true; 152 }; 153 # Tried to set Mission Control keyboard shortcuts... but failed 154 # "com.apple.symbolichotkeys" = { 155 # AppleSymbolicHotKeys = { 156 # "79" = { 157 # enabled = 1; 158 # value = { 159 # parameters = [65535 123 8650752]; 160 # type = "standard"; 161 # }; 162 # }; 163 # "80" = { 164 # enabled = 1; 165 # value = { 166 # parameters = [65535 123 8781824]; 167 # type = "standard"; 168 # }; 169 # }; 170 # "81" = { 171 # enabled = 1; 172 # value = { 173 # parameters = [65535 124 8650752]; 174 # type = "standard"; 175 # }; 176 # }; 177 # "82" = { 178 # enabled = 1; 179 # value = { 180 # parameters = [65535 124 8781824]; 181 # type = "standard"; 182 # }; 183 # }; 184 # "118" = { 185 # enabled = 1; 186 # value = { 187 # parameters = [65535 18 262144]; 188 # type = "standard"; 189 # }; 190 # }; 191 # # 119 = { 192 # # enabled = 1; 193 # # value = { 194 # # parameters = [65535, 19, 262144]; 195 # # type = "standard"; 196 # # }; 197 # # }; 198 # # 120 = { 199 # # enabled = 1; 200 # # value = { 201 # # parameters = [65535, 20, 262144]; 202 # # type = "standard"; 203 # # }; 204 # # }; 205 # # 121 = { 206 # # enabled = 1; 207 # # value = { 208 # # parameters = [65535, 21, 262144]; 209 # # type = "standard"; 210 # # }; 211 # # }; 212 # # 122 = { 213 # # enabled = 1; 214 # # value = { 215 # # parameters = [65535, 23, 262144]; 216 # # type = "standard"; 217 # # }; 218 # # }; 219 # }; 220 # }; 221 }; 222 223 # NOTE: put SaneSideButtons (installed via homebrew cask) to Login Items 224 # reference: https://discourse.nixos.org/t/automatically-launching-macos-applications-on-login/19823/2 225 # TODO: package this into single nix package with SaneSideButtons itself. See pkgs.sensible-side-buttons as a reference 226 system.activationScripts.extraActivation.text = '' 227 osascript -e 'tell application "System Events" to make login item at end with properties {path:"/Applications/SaneSideButtons.app", hidden:false}' 228 softwareupdate --install-rosetta --agree-to-license 229 ''; 230 231 # # Enable Touch ID support 232 # security.pam.enableSudoTouchIdAuth = true; 233 234 homebrew = { 235 enable = true; 236 casks = [ 237 "discord" 238 "docker" 239 "ghostty" 240 "raycast" 241 # there are also pkgs.sensible-side-buttons (original version) which is unfree license 242 # this one is foked version of it: "SaneSideButtons" 243 # NOTE: I should put this on Login Items manually. See: https://github.com/thealpa/SaneSideButtons 244 "sanesidebuttons" 245 ]; 246 masApps = { 247 # Numbers = 409203825; 248 # Pages = 409201541; 249 # Tampermonkey = 6738342400; 250 # Things3 = 904280696; 251 # Xcode = 497799835; 252 }; 253 }; 254}