From aa1b2ff23c27ad5981a8d03584a320ec57401538 Mon Sep 17 00:00:00 2001 From: imbytecat Date: Sat, 11 Apr 2026 17:52:03 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=AE=80=E5=8C=96=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E8=B7=AF=E5=BE=84=EF=BC=8C=E7=A7=BB=E9=99=A4=E7=A1=AC?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E7=9A=84=20rebuild/update=20=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E5=92=8C=E5=AE=89=E8=A3=85=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 2 +- README.md | 8 ++++---- home/shell/fish.nix | 10 ---------- scripts/install.sh | 28 ---------------------------- 4 files changed, 5 insertions(+), 43 deletions(-) delete mode 100755 scripts/install.sh diff --git a/AGENTS.md b/AGENTS.md index f2e9a22..1cfa338 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -59,7 +59,7 @@ Fish abbreviations `rebuild` and `update` are also available in the shell (defin - **catppuccin module name**: Uses `catppuccin.homeModules.catppuccin` (not the old `homeManagerModules`). NixOS uses `catppuccin.nixosModules.catppuccin`. - **Homebrew tap casks**: Casks from taps need full path (e.g. `"goooler/repo/fl-clash"`), not just the short name. - **`onActivation.cleanup = "zap"`**: Any brew formula/cask NOT declared in `modules/darwin/default.nix` WILL be removed on rebuild. Be comprehensive. -- **Repo location**: Must be at `~/Developer/nix-config`. Fish abbreviations and `rebuild` reference this path. +- **Repo location**: Default `~/nix-config`. Configurable via `nix_config_dir` fish variable in `home/shell/fish.nix`. - **First-time bootstrap requires sudo**: `sudo nix run nix-darwin -- switch --flake .#mac-mini` (not `darwin-rebuild` which doesn't exist yet). ## Secrets (sops-nix) diff --git a/README.md b/README.md index d947e56..ce57ee8 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,8 @@ curl -sSf -L https://install.lix.systems/lix | sh -s -- install 2. 克隆仓库并首次构建: ```bash -git clone ~/Developer/nix-config -cd ~/Developer/nix-config +git clone ~/nix-config +cd ~/nix-config # 首次(nix-darwin 尚未安装): sudo nix run nix-darwin -- switch --flake .#mac-mini # 之后日常重建: @@ -43,8 +43,8 @@ wsl -d NixOS 2. 克隆仓库并构建: ```bash -git clone ~/Developer/nix-config -cd ~/Developer/nix-config +git clone ~/nix-config +cd ~/nix-config sudo nixos-rebuild switch --flake .#wsl ``` diff --git a/home/shell/fish.nix b/home/shell/fish.nix index 6961cd2..39a5d0a 100644 --- a/home/shell/fish.nix +++ b/home/shell/fish.nix @@ -24,8 +24,6 @@ # Network http = "xh"; - # Nix - update = "nix flake update --flake ~/Developer/nix-config"; }; interactiveShellInit = '' @@ -41,14 +39,6 @@ # Sudo: double Escape to prepend sudo bind \e\e 'fish_commandline_prepend sudo' - # Platform-specific rebuild command (derive flake attr from hostname) - if test (uname) = Darwin - set -l attr (scutil --get LocalHostName | string lower | string replace 'awesome-' "") - abbr --add rebuild "sudo darwin-rebuild switch --flake ~/Developer/nix-config#$attr" - else - abbr --add rebuild "sudo nixos-rebuild switch --flake ~/Developer/nix-config#wsl" - end - # WSL clipboard if set -q WSL_DISTRO_NAME alias pbcopy clip.exe diff --git a/scripts/install.sh b/scripts/install.sh deleted file mode 100755 index 52fa0ae..0000000 --- a/scripts/install.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -set -euo pipefail - -REPO_URL="https://git.furtherverse.com/imbytecat/nix-config.git" -CONFIG_DIR="$HOME/Developer/nix-config" - -if [[ -d "$CONFIG_DIR/.git" ]]; then - git -C "$CONFIG_DIR" pull -else - mkdir -p "$HOME/Developer" - git clone "$REPO_URL" "$CONFIG_DIR" -fi - -case "$(uname)" in - Darwin) - TARGET="${1:?Usage: $0 }" - if command -v darwin-rebuild &>/dev/null; then - sudo darwin-rebuild switch --flake "$CONFIG_DIR#$TARGET" - else - sudo nix run nix-darwin -- switch --flake "$CONFIG_DIR#$TARGET" - fi - ;; - Linux) - sudo nixos-rebuild switch --flake "$CONFIG_DIR#wsl" - ;; -esac - -echo "Done! Restart your shell."