From 40731eda737a8d06258a46548f4eff2ad74a9123 Mon Sep 17 00:00:00 2001 From: imbytecat Date: Tue, 14 Apr 2026 22:35:12 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=20justfile=20?= =?UTF-8?q?=E4=B8=AD=20linux=20=E5=91=BD=E4=BB=A4=E7=9A=84=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E4=B8=BB=E6=9C=BA=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 2 +- README.md | 13 ++++++++++--- justfile | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 459e9ba..0f7fd32 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -28,7 +28,7 @@ Flow: `hosts/*` → `modules/*` → `home/*` ```bash just rebuild mac-mini # macOS host just rebuild macbook-air -just rebuild # WSL (linux default) +just rebuild wsl # NixOS host just check # eval without building just update # nix flake update just up nixpkgs # update single input diff --git a/README.md b/README.md index 3908777..3c71650 100644 --- a/README.md +++ b/README.md @@ -38,14 +38,21 @@ sudo nix run nix-darwin -- switch --flake .#mac-mini ### WSL -1. 安装 [NixOS-WSL](https://github.com/nix-community/NixOS-WSL/releases): +1. 启用 WSL 并更新内核: + +```powershell +wsl --install --no-distribution +wsl --update +``` + +2. 安装 [NixOS-WSL](https://github.com/nix-community/NixOS-WSL/releases): ```powershell wsl --import NixOS C:\wsl\nixos nixos-wsl.tar.gz wsl -d NixOS ``` -2. 首次构建: +3. 首次构建: ```bash nix-shell -p git --run "git clone ~/nix-config" @@ -53,7 +60,7 @@ cd ~/nix-config sudo nixos-rebuild switch --flake .#wsl ``` -之后日常重建:`just rebuild` +之后日常重建:`just rebuild wsl` ## 仓库结构 diff --git a/justfile b/justfile index 283bfed..302dea8 100644 --- a/justfile +++ b/justfile @@ -17,7 +17,7 @@ rebuild host: # Rebuild and switch to new system configuration [linux] [group('build')] -rebuild host="wsl": +rebuild host: sudo nixos-rebuild switch --flake .#{{host}} # Check configs evaluate without errors @@ -86,6 +86,6 @@ lsp host: # Generate .vscode/settings.json with LSP option completion [linux] [group('tools')] -lsp host="wsl": +lsp host: @jq --arg h "{{host}}" '."nix.serverSettings".nixd.options = {"nixos":{"expr":"(builtins.getFlake (toString ./.)).nixosConfigurations.\($h).options"},"home-manager":{"expr":"(builtins.getFlake (toString ./.)).nixosConfigurations.\($h).options.home-manager.users.type.getSubOptions []"}}' .vscode/settings.base.json > .vscode/settings.json @echo "Generated .vscode/settings.json for {{host}}"