refactor: 移除 justfile 中 linux 命令的默认主机参数
This commit is contained in:
@@ -28,7 +28,7 @@ Flow: `hosts/*` → `modules/*` → `home/*`
|
|||||||
```bash
|
```bash
|
||||||
just rebuild mac-mini # macOS host
|
just rebuild mac-mini # macOS host
|
||||||
just rebuild macbook-air
|
just rebuild macbook-air
|
||||||
just rebuild # WSL (linux default)
|
just rebuild wsl # NixOS host
|
||||||
just check # eval without building
|
just check # eval without building
|
||||||
just update # nix flake update
|
just update # nix flake update
|
||||||
just up nixpkgs # update single input
|
just up nixpkgs # update single input
|
||||||
|
|||||||
@@ -38,14 +38,21 @@ sudo nix run nix-darwin -- switch --flake .#mac-mini
|
|||||||
|
|
||||||
### WSL
|
### 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
|
```powershell
|
||||||
wsl --import NixOS C:\wsl\nixos nixos-wsl.tar.gz
|
wsl --import NixOS C:\wsl\nixos nixos-wsl.tar.gz
|
||||||
wsl -d NixOS
|
wsl -d NixOS
|
||||||
```
|
```
|
||||||
|
|
||||||
2. 首次构建:
|
3. 首次构建:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
nix-shell -p git --run "git clone <repo-url> ~/nix-config"
|
nix-shell -p git --run "git clone <repo-url> ~/nix-config"
|
||||||
@@ -53,7 +60,7 @@ cd ~/nix-config
|
|||||||
sudo nixos-rebuild switch --flake .#wsl
|
sudo nixos-rebuild switch --flake .#wsl
|
||||||
```
|
```
|
||||||
|
|
||||||
之后日常重建:`just rebuild`
|
之后日常重建:`just rebuild wsl`
|
||||||
|
|
||||||
## 仓库结构
|
## 仓库结构
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ rebuild host:
|
|||||||
# Rebuild and switch to new system configuration
|
# Rebuild and switch to new system configuration
|
||||||
[linux]
|
[linux]
|
||||||
[group('build')]
|
[group('build')]
|
||||||
rebuild host="wsl":
|
rebuild host:
|
||||||
sudo nixos-rebuild switch --flake .#{{host}}
|
sudo nixos-rebuild switch --flake .#{{host}}
|
||||||
|
|
||||||
# Check configs evaluate without errors
|
# Check configs evaluate without errors
|
||||||
@@ -86,6 +86,6 @@ lsp host:
|
|||||||
# Generate .vscode/settings.json with LSP option completion
|
# Generate .vscode/settings.json with LSP option completion
|
||||||
[linux]
|
[linux]
|
||||||
[group('tools')]
|
[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
|
@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}}"
|
@echo "Generated .vscode/settings.json for {{host}}"
|
||||||
|
|||||||
Reference in New Issue
Block a user