Files
WHC 12e5ec30af Add KiCad, SPlayer, and fixed official OpenCode binary.
Replace broken nixpkgs opencode with upstream linux-x64 release to avoid SystemPrompt.environment crashes.
2026-09-19 18:59:14 +08:00

81 lines
2.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# whc NixOS(桌面:i7-12700F + RTX 4060)
从当前笔记本配置整理而来,按目标机拆成模块,并加上 NVIDIA 独显支持。
## 结构
```
flake.nix # nixosConfigurations.desktop
hosts/desktop/ # 主机入口 + hardware
modules/
common.nix # 用户 / 网络 / PipeWire / Clash / nix
desktop-plasma.nix # Plasma 6 + SDDM
chinese.nix # 中文 locale / Fcitx5 / 字体
nvidia.nix # RTX 4060(12700F 无核显)
gaming.nix # Steam
printing.nix # CUPS + HP ULD + 中文打印
apps.nix # QQ/微信包装、开发工具、KiCad、SPlayer、opencode 等
fpga.nix # 高云 FPGA(Gowin EDU IDE + 开源工具链)
pkgs/
hp-uld-driver.nix
gowin-eda-edu-ide/ # 高云教育版 IDE(FHS)
opencode-bin.nix # 官方 opencode 二进制(规避 nixpkgs 崩溃)
```
## 目标机安装(摘要)
1. 用 NixOS 安装介质启动,按官方流程分区挂载到 `/mnt`。
2. 克隆本仓库:
```bash
sudo git clone https://git.whcself.xyz/WHC/whc-nixos.git /mnt/etc/nixos
```
3. **必须**按本机磁盘重新生成硬件配置(覆盖占位 UUID):
```bash
sudo nixos-generate-config --root /mnt
# 把 /mnt/etc/nixos/hardware-configuration.nix
# 覆盖到 hosts/desktop/hardware.nix
# 或改 hosts/desktop/default.nix 去 import 生成的那份
```
4. 安装(flake):
```bash
cd /mnt/etc/nixos
sudo nixos-install --flake .#desktop
```
5. 重启后登录用户 `whc`,设密码(若安装时未设)。
已装系统上更新:
```bash
cd /etc/nixos # 或本仓库路径
sudo nixos-rebuild switch --flake .#desktop
```
## 硬件说明
| 项目 | 配置 |
|------|------|
| CPU | Intel i7-12700F → `kvm-intel`,无核显 |
| GPU | RTX 4060 → `modules/nvidia.nix`(`open = true`) |
| 桌面 | Plasma 6 + SDDM |
| 打印 | HP Laser MFP 13x ULD(不需要可从 `hosts/desktop/default.nix` 去掉 `printing.nix`) |
若 NVIDIA 黑屏:在 `modules/nvidia.nix` 把 `open = true` 改成 `false` 后重建。
## 高云 FPGA
| 工具 | 用途 | 命令 |
|------|------|------|
| Gowin EDA 教育版 | 官方 IDE / 综合 | `gowin-ide` 或 `gowin-env` → `gw_ide` |
| openFPGALoader | 烧录(推荐替代官方 Programmer) | `openFPGALoader -b tangnano9k -m foo.fs` |
| yosys + nextpnr + apicula | 开源综合与布局布线 | `yosys` / `nextpnr-himbaechel` / `gowin_pack` |
| iverilog / verilator / gtkwave | 仿真与波形 | `iverilog` / `verilator` / `gtkwave` |
插上开发板后若无权限,重新插拔或重新登录(用户已加入 `dialout` / `plugdev`)。
## 相对原 `/etc/nixos` 的改动
- 去掉本机(Ultra 9 / Arc / 磁盘 UUID / NPU)相关硬件
- 拆模块,主机名改为 `desktop`
- 新增 RTX 4060 驱动与 `nvtop`
- 保留 QQ/微信源修复、Fcitx 包装、Clash、Steam、开发工具链