diff --git a/README.md b/README.md index d555cb33..8be7f337 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,10 @@ Watch the walkthrough: https://youtu.be/5N-okeDdIuI My personal Mac setup, managed with nix-darwin and home-manager. One repo, one command, and a fresh Mac ends up configured the same way every time. +nix-darwin manages macOS level packages. home-manager manages home folder settings. + +> This is a fork of https://github.com/kunchenguid/dotfiles to add my own tooling around vscode, language servers, local models, and other development needs. + ## Contributing / Using This Repo These are my personal dotfiles, shared publicly so people can read them, learn from them, and fork them freely. diff --git a/configuration.nix b/configuration.nix index 74baa399..5f3d3781 100644 --- a/configuration.nix +++ b/configuration.nix @@ -17,7 +17,7 @@ AppleInterfaceStyle = "Dark"; KeyRepeat = 2; # fast key repeat InitialKeyRepeat = 15; # short delay before repeat - _HIHideMenuBar = true; # auto-hide the menu bar + # _HIHideMenuBar = true; # auto-hide the top menu AppleShowAllExtensions = true; }; dock.autohide = true; @@ -35,11 +35,27 @@ onActivation.autoUpdate = true; onActivation.extraFlags = [ "--force" ]; brews = [ - "herdr" + "herdr" # tmux for agents + "gh" # GitHub CLI + "ca-certificates" # required for node + "node" + "go" + + # Common shell / systems tools + "wget" + "curl" + "cloc" # lines of code and other metadata for a repo + "ncdu" # disk space usage cli scanner + "jq" # json parsing ]; casks = [ - "wezterm" + "wezterm" # replaces zsh as our terminal of choice "claude-code" + "lm-studio" # run local models + "sublime-text" # default text editor + "rectangle" # window management + "handy" # local speech-to-text using Whisper or Parakeet models + "stats" # CPU / Memory / swap usage while runing local models ]; }; } diff --git a/flake.nix b/flake.nix index 96b6b8dd..b17ed4ac 100644 --- a/flake.nix +++ b/flake.nix @@ -12,13 +12,18 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; nix-homebrew.url = "github:zhaofengli/nix-homebrew"; + + treehouse = { + url = "github:kunchenguid/treehouse"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = inputs@{ self, nix-darwin, nix-homebrew, home-manager, nixpkgs }: + outputs = inputs@{ self, nix-darwin, nix-homebrew, home-manager, nixpkgs, treehouse }: let # The one username line to change if this isn't your machine. # bootstrap.sh offers to rewrite this for you if your macOS username differs. - user = "kunchen"; + user = "owner"; in { darwinConfigurations."mac" = nix-darwin.lib.darwinSystem { @@ -30,7 +35,7 @@ { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = { inherit user; }; + home-manager.extraSpecialArgs = { inherit user treehouse; }; home-manager.users.${user} = import ./home.nix; } ]; diff --git a/home.nix b/home.nix index 540dc972..7f8d894d 100644 --- a/home.nix +++ b/home.nix @@ -1,10 +1,12 @@ -{ config, pkgs, user, ... }: +{ config, pkgs, user, treehouse, lib, ... }: let dotfiles = "${config.home.homeDirectory}/.dotfiles"; in { + imports = [ ./vscode.nix ]; + home.username = user; home.homeDirectory = "/Users/${user}"; home.stateVersion = "24.11"; @@ -16,8 +18,11 @@ in jq # json on the command line lazygit neovim + # vscode + its extensions live in ./vscode.nix # the font everything renders in nerd-fonts.hack + # treehouse install + treehouse.packages.${pkgs.system}.default ]; fonts.fontconfig.enable = true; home.sessionVariables.EDITOR = "nvim"; @@ -37,6 +42,10 @@ in m = "git switch main"; cc = "claude --dangerously-skip-permissions"; co = "codex --full-auto"; + server = "python3 -m http.server 8080"; + # run models all night / clamshell without letting the computer sleep + preventsleep = "sudo pmset -b sleep 0; sudo pmset -b disablesleep 1"; + enablesleep = "sudo pmset -b sleep 30; sudo pmset -b disablesleep 0"; }; }; @@ -79,4 +88,46 @@ in config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/AGENTS.md"; home.file.".config/opencode/AGENTS.md".source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/AGENTS.md"; + + # VSCode + home.file."Library/Application Support/Code/User/settings.json".source = + config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/.vscode/settings.json"; + + + # we're using nix to install homebrew, then homebrew to install nodejs/npm so + # that we can keep it updated easier than relying on the nix packages. + # However, that means we must install the packages ourselves and homebrew + # doesn't have packages for all of them (neither does nix actually) so... + # ...here we are with a hacky post-install script. + home.activation.installNpmPackages = lib.hm.dag.entryAfter ["writeBoundary"] '' + BREW_BIN="/opt/homebrew/bin" + NODE_PATH="$BREW_BIN/node" + NPM_PATH="$BREW_BIN/npm" + NPX_PATH="$BREW_BIN/npx" + + if [ -x "$NPM_PATH" ]; then + export PATH="$BREW_BIN:$PATH" + + # export NPM_CONFIG_PREFIX="${config.home.homeDirectory}/.npm-global" + # mkdir -p "$NPM_CONFIG_PREFIX" + + echo "Installing global npm packages via Homebrew Node..." + $DRY_RUN_CMD "$NPM_PATH" install -g skills gh-axi chrome-devtools-axi gnhf + else + echo "Warning: Homebrew npm not found at $NPM_PATH yet. Skipping." + fi + + if [ -x "$NPX_PATH" ]; then + export PATH="$BREW_BIN:$PATH" + $DRY_RUN_CMD "$NPX_PATH" skills add kunchenguid/lavish-axi --skill lavish + + # report installed skills + "$NPX_PATH" skills list -g + else + echo "Warning: Homebrew npx not found at $NPX_PATH yet. Skipping." + fi + + # also install the no-mistakes binary + $DRY_RUN_CMD go install github.com/kunchenguid/no-mistakes/cmd/no-mistakes@latest + ''; } diff --git a/home/.config/nvim/lua/plugins/navigation.lua b/home/.config/nvim/lua/plugins/navigation.lua index df163f35..67177d85 100644 --- a/home/.config/nvim/lua/plugins/navigation.lua +++ b/home/.config/nvim/lua/plugins/navigation.lua @@ -22,3 +22,4 @@ return { }, } +-- Explaination: https://youtu.be/5N-okeDdIuI?t=1475 \ No newline at end of file diff --git a/home/.config/wezterm/wezterm.lua b/home/.config/wezterm/wezterm.lua index 24041e72..42153107 100644 --- a/home/.config/wezterm/wezterm.lua +++ b/home/.config/wezterm/wezterm.lua @@ -44,4 +44,55 @@ wezterm.on("window-focus-changed", function(window) window:set_config_overrides(overrides) end) +-- Function to get memory usage based on OS +local function get_memory_usage() + local cmd = "" + + if wezterm.target_triple:find("apple") then + -- macOS command + cmd = [[ + vm_stat | awk ' + /Pages free/ {free=$3} + /Pages active/ {a=$3} + /Pages inactive/ {i=$3} + /Pages speculative/ {s=$3} + /Pages wired down/ {w=$3} + END { + used=a+i+s+w; + total=used+free; + if (total==0) { print "N/A"; exit 1 } + printf "%.1f%%", (used/total)*100 + }' + ]] + elseif wezterm.target_triple:find("windows") then + -- Windows PowerShell command + cmd = "powershell -NoProfile -Command \"(Get-CimInstance Win32_OperatingSystem).FreePhysicalMemory\"" + else + -- Linux command + cmd = "free -h | awk '/^Mem:/ {print $3 \"/\" $2}'" + end + + local success, stdout, stderr = wezterm.run_child_process({ "sh", "-c", cmd }) + + -- Fallback for Windows if sh isn't available natively + if not success and wezterm.target_triple:find("windows") then + success, stdout, stderr = wezterm.run_child_process({ "powershell.exe", "-NoProfile", "-Command", cmd }) + end + + if success then + return stdout:gsub("%s+", "") -- Clean up whitespace/newlines + end + return "Mem: Unknown" +end + +wezterm.on('update-status', function(window, pane) + local mem = get_memory_usage() + + window:set_right_status(wezterm.format({ + { Background = { Color = '#1e1e2e' } }, + { Foreground = { Color = '#fab387' } }, + { Text = ' Mem: ' .. mem .. ' ' }, + })) +end) + return config diff --git a/home/.pi/agent/models.json b/home/.pi/agent/models.json index c4ee7894..76000bf6 100644 --- a/home/.pi/agent/models.json +++ b/home/.pi/agent/models.json @@ -12,6 +12,15 @@ "contextWindow": 272000 } } + }, + "lmstuido": { + "baseUrl": "http://127.0.0.1:1234/v1", + "api": "openai-completions", + "apiKey": "lmstudio", + "models": [ + { "id": "qwen/qwen3.6-35b-a3b" }, + { "id": "qwen/qwen3.6-27b" } + ] } } } diff --git a/home/.vscode/settings.json b/home/.vscode/settings.json new file mode 100644 index 00000000..acca434c --- /dev/null +++ b/home/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + "go.toolsManagement.autoUpdate": true, + "go.testTags": "", + "go.testOnSave": true, + "go.testFlags": ["-v"], + "go.formatTool": "goimports", + "go.lintTool": "golint", + "go.lintFlags": [], + "go.useLanguageServer": true, + "go.languageServerFlags": ["-rpc.trace"], + "[go]": { + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports":"explicit", + "source.fixAll":"explicit" + } + }, + "editor.rulers": [80, 120], + "workbench.settings.applyToAllProfiles": [], + "claudeCode.preferredLocation": "panel", + "editor.wordWrap": "wordWrapColumn", + "editor.wordWrapColumn": 80, + "[html]": { + "editor.wordWrapColumn": 80 + }, + "settingsSync.ignoredSettings": [ + + ], + "[c]": {} +} \ No newline at end of file diff --git a/vscode.nix b/vscode.nix new file mode 100644 index 00000000..0a23d04c --- /dev/null +++ b/vscode.nix @@ -0,0 +1,18 @@ +# VSCode plus its extensions, installed from nixpkgs like every other package. +# Kept in its own file so editor/extension changes are easy to find and edit. +{ pkgs, ... }: + +{ + home.packages = [ + (pkgs.vscode-with-extensions.override { + vscodeExtensions = with pkgs.vscode-extensions; [ + golang.go # Go language support + rust-lang.rust-analyzer # Rust language server + ms-python.vscode-pylance # Python language server (unfree) + saoudrizwan.claude-dev # Cline for local agents + shd101wyy.markdown-preview-enhanced + jnoortheen.nix-ide # nix language server + ]; + }) + ]; +}