Compare commits

..
6 Commits
Author SHA1 Message Date
WHC cf6e2a1a48 feat: 新增 laptop 主机配置(Ultra 9 285H / Arc)
- hosts/laptop/hardware.nix: 本机真实硬件配置(btrfs 子卷 / NPU / 微码)
- hosts/laptop/default.nix: 复用 common/desktop-plasma/chinese/gaming/printing/apps,跳过 nvidia 与 fpga;加 Intel Arc VA-API
- flake.nix: 抽出 mkSystem,新增 nixosConfigurations.laptop / nixos
2026-09-21 23:45:25 +08:00
WHC b0ee60f7a2 Add splayer launcher alias for SPlayer-Next. 2026-09-19 19:17:43 +08:00
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
WHC 5a54a98c30 Ignore GCM diagnose log artifacts. 2026-09-19 18:39:23 +08:00
WHC 014922f406 Add Git Credential Manager for HTTPS auth to Gitea. 2026-09-19 18:39:06 +08:00
WHC cac29b4c79 Add Gowin FPGA toolchain for desktop development.
Vendor Gowin EDU IDE, add openFPGALoader/Yosys/nextpnr/Apicula, and USB udev rules for Tang boards.
2026-09-19 18:34:38 +08:00
16 changed files with 454 additions and 35 deletions
+1
View File
@@ -15,3 +15,4 @@ secrets.nix
*.key
.env
.env.*
gcm-diagnose.log
+18 -3
View File
@@ -6,7 +6,7 @@
```
flake.nix # nixosConfigurations.desktop
hosts/desktop/ # 主机入口 + hardware 占位
hosts/desktop/ # 主机入口 + hardware
modules/
common.nix # 用户 / 网络 / PipeWire / Clash / nix
desktop-plasma.nix # Plasma 6 + SDDM
@@ -14,8 +14,12 @@ modules/
nvidia.nix # RTX 4060(12700F 无核显)
gaming.nix # Steam
printing.nix # CUPS + HP ULD + 中文打印
apps.nix # QQ/微信包装、开发工具等
pkgs/hp-uld-driver.nix
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 崩溃)
```
## 目标机安装(摘要)
@@ -57,6 +61,17 @@ sudo nixos-rebuild switch --flake .#desktop
若 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)相关硬件
Generated
+27
View File
@@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1789684949,
"narHash": "sha256-ZKhUe/2IJUq1JhKxKMu8rbkgSGmPP2ZCqlIPn40aGCM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e554fab72f81915600f3f449b786fd9af40439a5",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
+10 -4
View File
@@ -1,5 +1,5 @@
{
description = "whc NixOS — desktop (i7-12700F + RTX 4060)";
description = "whc NixOS — desktop (i7-12700F + RTX 4060) + laptop (Ultra 9 285H / Arc)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@@ -9,11 +9,17 @@
{ self, nixpkgs, ... }:
let
system = "x86_64-linux";
mkSystem = host: nixpkgs.lib.nixosSystem {
inherit system;
modules = [ (./hosts + "/${host}") ];
};
in
{
nixosConfigurations.desktop = nixpkgs.lib.nixosSystem {
inherit system;
modules = [ ./hosts/desktop ];
nixosConfigurations = {
desktop = mkSystem "desktop";
laptop = mkSystem "laptop";
# hostname 仍是 nixos:让不带 attr 的 `nixos-rebuild --flake .#` 也能命中
nixos = mkSystem "laptop";
};
# 无 flake 时也可:把本仓库拷到 /etc/nixos 后 nixos-rebuild switch
+1
View File
@@ -10,6 +10,7 @@
../../modules/gaming.nix
../../modules/printing.nix
../../modules/apps.nix
../../modules/fpga.nix
];
networking.hostName = "desktop";
+26 -25
View File
@@ -1,43 +1,42 @@
# 目标机(i7-12700F + RTX 4060)上必须重新生成本文件,当前为占位骨架。
#
# 安装时在目标机执行:
# sudo nixos-generate-config --root /mnt # 若在 live 安装环境
# # 或已装系统上:
# sudo nixos-generate-config
# 然后把生成的 hardware-configuration.nix 内容覆盖本文件(保留下面 nvidia 相关不要被冲掉的话,
# 显卡驱动在 modules/nvidia.nix,本文件只放磁盘/CPU/固件)。
#
# 切勿带着本仓库里旧机器(Ultra 9 / 另一块盘 UUID)的分区信息开机。
# Generated for this machine by ‘nixos-generate-config’ (from the installer).
# Disk layout: single btrfs disk with /, /nix, /home subvolumes + ESP + swap.
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [
"vmd"
"xhci_pci"
"ahci"
"nvme"
"usbhid"
"uas"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
# === 必须按目标机实际分区改 UUID / 挂载点 ===
# fileSystems."/" = { device = "/dev/disk/by-uuid/REPLACE-ROOT"; fsType = "ext4"; };
# fileSystems."/boot" = { device = "/dev/disk/by-uuid/REPLACE-ESP"; fsType = "vfat"; options = [ "fmask=0077" "dmask=0077" ]; };
# swapDevices = [ { device = "/dev/disk/by-uuid/REPLACE-SWAP"; } ];
fileSystems."/" = lib.mkDefault {
device = "/dev/disk/by-uuid/REPLACE-ME-ROOT-UUID";
fsType = "ext4";
fileSystems."/" = {
device = "/dev/disk/by-uuid/6fe797fa-edcc-4e9f-b3e0-aac88c454563";
fsType = "btrfs";
};
fileSystems."/boot" = lib.mkDefault {
device = "/dev/disk/by-uuid/REPLACE-ME-BOOT-UUID";
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/6fe797fa-edcc-4e9f-b3e0-aac88c454563";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/home" = {
device = "/dev/disk/by-uuid/6fe797fa-edcc-4e9f-b3e0-aac88c454563";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/5779-DFED";
fsType = "vfat";
options = [
"fmask=0077"
@@ -45,7 +44,9 @@
];
};
swapDevices = lib.mkDefault [ ];
swapDevices = [
{ device = "/dev/disk/by-uuid/55d9c36c-6692-4fb7-bc2e-20fe4978576e"; }
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
@@ -0,0 +1,53 @@
# 目标机(i7-12700F + RTX 4060)上必须重新生成本文件,当前为占位骨架。
#
# 安装时在目标机执行:
# sudo nixos-generate-config --root /mnt # 若在 live 安装环境
# # 或已装系统上:
# sudo nixos-generate-config
# 然后把生成的 hardware-configuration.nix 内容覆盖本文件(保留下面 nvidia 相关不要被冲掉的话,
# 显卡驱动在 modules/nvidia.nix,本文件只放磁盘/CPU/固件)。
#
# 切勿带着本仓库里旧机器(Ultra 9 / 另一块盘 UUID)的分区信息开机。
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usbhid"
"uas"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
# === 必须按目标机实际分区改 UUID / 挂载点 ===
# fileSystems."/" = { device = "/dev/disk/by-uuid/REPLACE-ROOT"; fsType = "ext4"; };
# fileSystems."/boot" = { device = "/dev/disk/by-uuid/REPLACE-ESP"; fsType = "vfat"; options = [ "fmask=0077" "dmask=0077" ]; };
# swapDevices = [ { device = "/dev/disk/by-uuid/REPLACE-SWAP"; } ];
fileSystems."/" = lib.mkDefault {
device = "/dev/disk/by-uuid/REPLACE-ME-ROOT-UUID";
fsType = "ext4";
};
fileSystems."/boot" = lib.mkDefault {
device = "/dev/disk/by-uuid/REPLACE-ME-BOOT-UUID";
fsType = "vfat";
options = [
"fmask=0077"
"dmask=0077"
];
};
swapDevices = lib.mkDefault [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.enableRedistributableFirmware = true;
}
+26
View File
@@ -0,0 +1,26 @@
# 笔记本:Intel Core Ultra 9 285H + Intel Arc(Arrow Lake-P),无 NVIDIA
{ pkgs, ... }:
{
imports = [
./hardware.nix
../../modules/common.nix
../../modules/desktop-plasma.nix
../../modules/chinese.nix
../../modules/gaming.nix
../../modules/printing.nix
../../modules/apps.nix
# 本机无 NVIDIA:刻意不导入 ../../modules/nvidia.nix
# FPGA 工具链依赖 Qt5,在 unstable 上求值风险高,暂不导入 ../../modules/fpga.nix
];
networking.hostName = "nixos";
# 笔记本不照抄 desktop 的 "performance",交给内核默认调度
# powerManagement.cpuFreqGovernor = "powersave";
# Intel Arc 硬解(VA-API),可选
hardware.graphics.extraPackages = [ pkgs.intel-media-driver ];
system.stateVersion = "26.05";
}
+46
View File
@@ -0,0 +1,46 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "uas" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/cbcb5930-50a9-4ff8-92f9-4622bd869579";
fsType = "btrfs";
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/cbcb5930-50a9-4ff8-92f9-4622bd869579";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/cbcb5930-50a9-4ff8-92f9-4622bd869579";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/84D8-EB50";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/d62e342b-271a-40e7-912d-3a748b5f55a1"; }
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.npu.enable = true;
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+12 -1
View File
@@ -16,7 +16,7 @@ let
version = "4.1.1";
src = pkgs.fetchurl {
url = "https://dldir1v6.qq.com/weixin/Universal/Linux/WeChatLinux_x86_64.AppImage";
hash = "sha256-RX26ArkbAxzdRBLu4HT7v/udnQax5Q/Bgi00hw4RSZA=";
hash = "sha256-T1StKQLs1vb9xWgLc1R/gNVCO/RwsBI3pXmi5bPK7us=";
};
meta = pkgs.wechat.meta;
};
@@ -90,6 +90,7 @@ in
wpsoffice-cn
git
git-credential-manager
gcc
gnumake
binutils
@@ -140,5 +141,15 @@ in
eza
fzf
btop
# EDA / 媒体
kicad
splayer-next
(writeShellScriptBin "splayer" ''exec ${splayer-next}/bin/SPlayer-Next "$@"'')
# 官方二进制:nixpkgs 版发 prompt 会崩(SystemPrompt.environment)
(callPackage ../pkgs/opencode-bin.nix { })
bun # opencode 插件安装需要
cursor-cli
];
}
+17 -1
View File
@@ -55,6 +55,11 @@
"flakes"
];
auto-optimise-store = true;
substituters = [
"https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store"
"https://mirrors.ustc.edu.cn/nix-channels/store"
"https://cache.nixos.org"
];
};
nix.gc = {
@@ -64,7 +69,18 @@
};
programs.nix-ld.enable = true;
programs.git.enable = true;
programs.git = {
enable = true;
config = {
credential = {
helper = "manager";
credentialStore = "cache";
"https://git.whcself.xyz" = {
provider = "generic";
};
};
};
};
# Clash Verge Rev
programs.clash-verge = {
+53
View File
@@ -0,0 +1,53 @@
# 高云(Gowin)FPGA 开发:开源工具链 + 教育版 IDE + 下载器权限
# IDE 包装源自 ryan4yin/nur-packages(本地 vendoring,因上游已注释掉该包)
{ pkgs, ... }:
let
gowin-eda-edu-ide = pkgs.callPackage ../pkgs/gowin-eda-edu-ide { };
in
{
# openFPGALoader / 串口下载器
users.groups.plugdev = { };
users.users.whc.extraGroups = [
"dialout"
"plugdev"
];
# FTDI / Sipeed Tang 等常见下载器(含 TAG+=uaccess,登录用户可直接访问)
services.udev.extraRules = ''
# openFPGALoader — FTDI 常见 VID/PID(Tang Nano / Primer 等)
ACTION!="add|change", GOTO="gowin_fpga_end"
SUBSYSTEM!="usb|tty|hidraw", GOTO="gowin_fpga_end"
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0664", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6014", MODE="0664", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", MODE="0664", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="0664", GROUP="plugdev", TAG+="uaccess"
# Sipeed / CMSIS-DAP 类
ATTRS{idVendor}=="1d50", MODE="0664", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="0d28", ATTRS{idProduct}=="0204", MODE="0664", GROUP="plugdev", TAG+="uaccess"
LABEL="gowin_fpga_end"
'';
environment.systemPackages = with pkgs; [
# 烧录(官方 Programmer 在 NixOS 上不稳定,优先用这个)
openfpgaloader
# 开源综合 / 布局布线(Apicula → nextpnr himbaechel/gowin)
yosys
nextpnr
python3Packages.apycula
# 仿真与波形
iverilog
verilator
gtkwave
# 高云教育版 IDE:gowin-env / gowin-ide → 启动 gw_ide
# 强制 X11,避免 Wayland 下 Qt 插件崩溃
(writeShellScriptBin "gowin-ide" ''
export QT_QPA_PLATFORM=xcb
exec ${gowin-eda-edu-ide}/bin/gowin-env "$@"
'')
gowin-eda-edu-ide
];
}
+1 -1
View File
@@ -15,7 +15,7 @@
powerManagement.enable = false;
powerManagement.finegrained = false;
# Ada (40 系) 推荐开源内核模块;若黑屏可改 open = false
open = true;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
+58
View File
@@ -0,0 +1,58 @@
{
lib,
buildFHSEnv,
freetype,
xkeyboard_config,
callPackage,
}:
let
gowin-ide = callPackage ./gowin-ide.nix { };
in
buildFHSEnv {
name = "gowin-env";
targetPkgs =
pkgs:
# ldd /nix/store/*gowin-version/bin/gw_ide
with pkgs; [
gowin-ide
# runtime dependencies
libGL
fontconfig
libxcrypt-legacy
zlib
libuuid
libpulseaudio
glib
dbus
libusb1
nss
nspr
expat
krb5
libxcomposite
libxdamage
libxfixes
libxtst
udev
alsa-lib
vulkan-loader
libx11
libxcursor
libxi
libxrandr
libxkbcommon
wayland
qt5.qtwayland
qt5.qtbase
];
profile = ''
export LD_PRELOAD="${lib.getLib freetype}/lib/libfreetype.so"
export QT_XKB_CONFIG_ROOT="${xkeyboard_config}/etc/X11/xkb"
export QT_QPA_PLATFORM=xcb
export FHS=1
gw_ide
'';
}
+55
View File
@@ -0,0 +1,55 @@
{
fetchurl,
lib,
stdenv,
qt5,
}:
stdenv.mkDerivation rec {
pname = "gowin-eda-edu-ide";
version = "1.9.11.01";
src = fetchurl {
# https://www.gowinsemi.com.cn/faq.aspx
url = "https://cdn.gowinsemi.com.cn/Gowin_V${version}_Education_Linux.tar.gz";
sha256 = "sha256-I26TSznMquS74NZzgJtRDMQ4V9hg7z4WCSJ0ybkvrQ4=";
};
sourceRoot = ".";
buildInputs = [qt5.qtbase];
nativeBuildInputs = [qt5.wrapQtAppsHook];
installPhase = ''
_package-ide() {
# install IDE
cd IDE
find doc/ -type f -exec install -Dm644 {} $out/{} \;
find lib/ -type f -exec install -Dm644 {} $out/{} \;
find data/ -type f -exec install -Dm644 {} $out/{} \;
find share/ -type f -exec install -Dm644 {} $out/{} \;
find simlib/ -type f -exec install -Dm644 {} $out/{} \;
find ipcore/ -type f -exec install -Dm644 {} $out/{} \;
find plugins/ -type f -exec install -Dm644 {} $out/{} \;
find bin/vhdl_packages -type f -exec install -Dm644 {} $out/{} \;
find bin/ -type f -exec install -Dm755 {} $out/{} \;
chmod 644 $out/bin/prim{itive.xml,_syn.vhd,_syn.v}
chmod 644 $out/bin/qt.conf
chmod 644 $out/bin/programmer.json
# fix ide launch error
# libfreetype.so.6 from Gowin EDA ide could cause error when launch the IDE:
# /opt/gowin-eda-edu-ide/bin/gw_ide: symbol lookup error: /usr/lib/libfontconfig.so.1: undefined symbol: FT_Done_MM_Var
#
# https://bbs.archlinux.org/viewtopic.php?id=251445
# https://mathematica.stackexchange.com/questions/189306/cant-launch-mathematica-11-on-fedora-29
rm -f $out/lib/libfreetype.so.6
}
_package-ide
'';
meta = with lib; {
description = "Gowin EDA, an easy to use integrated design environment provides design engineers one-stop solution from design entry to verification. (education version)";
homepage = "http://www.gowinsemi.com.cn/faq.aspx";
maintainers = with maintainers; [];
};
}
+50
View File
@@ -0,0 +1,50 @@
# 官方预编译二进制:nixpkgs 用新版 bun 构建的 opencode 会在发 prompt 时
# 触发 SystemPrompt.environment 崩溃(Unexpected server error / a.name)。
{
lib,
stdenv,
fetchurl,
autoPatchelfHook,
makeWrapper,
ripgrep,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "opencode";
version = "1.18.31";
src = fetchurl {
url = "https://github.com/anomalyco/opencode/releases/download/v${finalAttrs.version}/opencode-linux-x64.tar.gz";
hash = "sha256-6TEr517YA7dBX8Kuq9ofT+k4kSo5Zzdi3Aw4wOEeveQ=";
};
nativeBuildInputs = [
autoPatchelfHook
makeWrapper
];
buildInputs = [ stdenv.cc.cc.lib ];
sourceRoot = ".";
dontStrip = true;
installPhase = ''
runHook preInstall
install -Dm755 opencode $out/bin/.opencode-wrapped
makeWrapper $out/bin/.opencode-wrapped $out/bin/opencode \
--prefix PATH : ${lib.makeBinPath [ ripgrep ]} \
--set OPENCODE_DISABLE_AUTOUPDATE true
runHook postInstall
'';
meta = {
description = "AI coding agent built for the terminal (official binary; nixpkgs build is broken)";
homepage = "https://github.com/anomalyco/opencode";
changelog = "https://github.com/anomalyco/opencode/releases/tag/v${finalAttrs.version}";
license = lib.licenses.mit;
platforms = [ "x86_64-linux" ];
mainProgram = "opencode";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
})