chore(aquamarine): use NixOS's NPU module with nixos-unstable-small (#527)

* chore(aquamarine): take the NPU stack from nixos-unstable-small
* refactor(aquamarine): load the NPU driver via hardware.cpu.intel.npu

Assisted-by: DeepSeek Harness (claude-opus-5-5)
This commit is contained in:
ryan4yin | 二花 authored and GitHub committed 2026-11-11 19:59:51 +08:00
1 parent d5ee0b1699
commit 093f3ad81a
7 files changed
+33 -40

No files matched your search

+2 -2
View File
@@ -17,13 +17,13 @@ obsolete workarounds get rolled back instead of lingering.
A version or revision pinned for a reason that can go away. A version or revision pinned for a reason that can go away.
| ID | What & where | Why | Removal condition | Added | Revisit | Status | | ID | What & where | Why | Removal condition | Added | Revisit | Status |
| ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ---------- | -------------------------- | ------ | | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ---------- | ------------------------------------- | ------ |
| WA-004 | `catppuccin` on `main` — `flake.nix` | `main` carries the nodejs→nodejs-slim deprecation fix, which is not in a release | Switch to a release tag once it includes the fix | 2026-09-25 | on catppuccin release | active | | WA-004 | `catppuccin` on `main` — `flake.nix` | `main` carries the nodejs→nodejs-slim deprecation fix, which is not in a release | Switch to a release tag once it includes the fix | 2026-09-25 | on catppuccin release | active |
| WA-006 | `nixpkgs-blender` — `flake.nix` | Blender 5.2 LTS + CUDA/OptiX pin; keeps `just up` from triggering a full source rebuild | Bump deliberately when needed; drop the pin if the current nixpkgs build is acceptable | 2026-07-24 | deliberate | active | | WA-006 | `nixpkgs-blender` — `flake.nix` | Blender 5.2 LTS + CUDA/OptiX pin; keeps `just up` from triggering a full source rebuild | Bump deliberately when needed; drop the pin if the current nixpkgs build is acceptable | 2026-07-24 | deliberate | active |
| WA-020 | `fcitx5-vinput` pinned to release tag `v2.4.2` — `flake.nix`; consumer `home/linux/gui/base/vinput/default.nix` | Tracks a release tag instead of a branch, so `just up` stays on that release | Bump to a newer release tag when its changes are wanted | 2026-10-04 | on vinput release | active | | WA-020 | `fcitx5-vinput` pinned to release tag `v2.4.2` — `flake.nix`; consumer `home/linux/gui/base/vinput/default.nix` | Tracks a release tag instead of a branch, so `just up` stays on that release | Bump to a newer release tag when its changes are wanted | 2026-10-04 | on vinput release | active |
| WA-021 | `nix-x86-on-aarch64` input — our fork of rowanG077's patched FEX + muvm runtime — `flake.nix`; `hosts/12kingdoms-shoukei/game/` | FEX does not support 16K pages, so x86/x86_64 apps and games on shoukei need this pinned flake's 4K-page microVM runtime; our fork lets upstream changes be reviewed before use | Drop once FEX supports 16K pages directly, or nixpkgs/nixos-apple-silicon ships an equivalent runtime | 2026-10-07 | on FEX/nixpkgs/muvm update | active | | WA-021 | `nix-x86-on-aarch64` input — our fork of rowanG077's patched FEX + muvm runtime — `flake.nix`; `hosts/12kingdoms-shoukei/game/` | FEX does not support 16K pages, so x86/x86_64 apps and games on shoukei need this pinned flake's 4K-page microVM runtime; our fork lets upstream changes be reviewed before use | Drop once FEX supports 16K pages directly, or nixpkgs/nixos-apple-silicon ships an equivalent runtime | 2026-10-07 | on FEX/nixpkgs/muvm update | active |
| WA-023 | `nix.package = pkgs.nixVersions.latest` — `modules/nixos/base/nix.nix` | NixOS is opted into Nix 2.35 (2.35.3), which nixpkgs ships as `nixVersions.latest`, while `nixVersions.stable` is still 2.34 (2.34.9) | Drop the override and fall back to the default `pkgs.nix` once `nixVersions.stable` is 2.35 or newer | 2026-10-07 | eval warning | active | | WA-023 | `nix.package = pkgs.nixVersions.latest` — `modules/nixos/base/nix.nix` | NixOS is opted into Nix 2.35 (2.35.3), which nixpkgs ships as `nixVersions.latest`, while `nixVersions.stable` is still 2.34 (2.34.9) | Drop the override and fall back to the default `pkgs.nix` once `nixVersions.stable` is 2.35 or newer | 2026-10-07 | eval warning | active |
| WA-037 | `nixpkgs-npu` input pinned to `2ddccb854d89` — the `openvino-npu-compiler` branch of `ryan4yin/nixpkgs`, carrying [NixOS/nixpkgs#570230](https://github.com/NixOS/nixpkgs/pull/570230) — `flake.nix`; consumer `pkgs-npu` in `outputs/default.nix`, `hosts/idols-aquamarine/asr.nix` | The Intel NPU compiler, and the driver change that loads it, are unmerged, so the NPU driver the Whisper service needs comes from that branch | Drop the input and load `intel-npu-driver` from `nixos-unstable` once #570230 merges | 2026-10-17 | when #570230 merges | active | | WA-037 | `nixpkgs-small` input on `nixos-unstable-small`, which carries [NixOS/nixpkgs#570230](https://github.com/NixOS/nixpkgs/pull/570230) — `flake.nix`; consumer `pkgs-small` in `outputs/default.nix`, the `intel-npu-driver` overlay in `hosts/idols-aquamarine/hardware-intel-cpu.nix`, and the Python env in `hosts/idols-aquamarine/asr.nix` | The Intel NPU compiler, and the driver change that loads it, are not in `nixos-unstable` yet; `openvino-genai` 2026.4.0.0 failed to build there | Drop the overlay once #570230 reaches `nixos-unstable`; drop the input once `openvino-genai` also builds there | 2026-10-17 | when #570230 reaches `nixos-unstable` | active |
## Workarounds ## Workarounds
Generated
+17 -17
View File
@@ -676,22 +676,6 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-npu": {
"locked": {
"lastModified": 1792250783,
"narHash": "sha256-J/gNk34hn774ccDrvJuSWW9EFLvIvyy3t4HnuTcN4tU=",
"owner": "ryan4yin",
"repo": "nixpkgs",
"rev": "2ddccb854d89eb027e09198368073fdb9cde4d1d",
"type": "github"
},
"original": {
"owner": "ryan4yin",
"ref": "openvino-npu-compiler",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-patched": { "nixpkgs-patched": {
"locked": { "locked": {
"lastModified": 1793459509, "lastModified": 1793459509,
@@ -708,6 +692,22 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-small": {
"locked": {
"lastModified": 1794378162,
"narHash": "sha256-gJGP/BWdmF1pbjAzbuICPSeGkMncAiDt9PRe7L13664=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c24da8b1d51f447e8faedcb5cb823b3f84346a60",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable-small",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1793183032, "lastModified": 1793183032,
@@ -896,8 +896,8 @@
"nixpkgs-blender": "nixpkgs-blender", "nixpkgs-blender": "nixpkgs-blender",
"nixpkgs-darwin": "nixpkgs-darwin", "nixpkgs-darwin": "nixpkgs-darwin",
"nixpkgs-master": "nixpkgs-master", "nixpkgs-master": "nixpkgs-master",
"nixpkgs-npu": "nixpkgs-npu",
"nixpkgs-patched": "nixpkgs-patched", "nixpkgs-patched": "nixpkgs-patched",
"nixpkgs-small": "nixpkgs-small",
"nixpkgs-stable": "nixpkgs-stable", "nixpkgs-stable": "nixpkgs-stable",
"nu_scripts": "nu_scripts", "nu_scripts": "nu_scripts",
"nur-ryan4yin": "nur-ryan4yin", "nur-ryan4yin": "nur-ryan4yin",
+3 -4
View File
@@ -32,10 +32,9 @@
nixpkgs-patched.url = "github:ryan4yin/nixpkgs/nixos-unstable-patched"; nixpkgs-patched.url = "github:ryan4yin/nixpkgs/nixos-unstable-patched";
# get some latest packages from the master branch # get some latest packages from the master branch
nixpkgs-master.url = "github:nixos/nixpkgs/master"; nixpkgs-master.url = "github:nixos/nixpkgs/master";
# ryan4yin/nixpkgs branch carrying NixOS/nixpkgs#570230 (the Intel NPU # Ahead of nixos-unstable for aquamarine's NPU stack, through `pkgs-small`;
# compiler and the driver change that loads it). Only aquamarine consumes it, # removal condition in docs/WORKAROUNDS.md WA-037.
# through `pkgs-npu`; drop it once the PR merges. nixpkgs-small.url = "github:nixos/nixpkgs/nixos-unstable-small";
nixpkgs-npu.url = "github:ryan4yin/nixpkgs/openvino-npu-compiler";
# NixOS MicroVMs -- run the VMs directly on the hosts, replacing the former KubeVirt # NixOS MicroVMs -- run the VMs directly on the hosts, replacing the former KubeVirt
microvm = { microvm = {
url = "github:microvm-nix/microvm.nix"; url = "github:microvm-nix/microvm.nix";
+4 -7
View File
@@ -3,7 +3,7 @@
mylib, mylib,
myvars, myvars,
pkgs, pkgs,
pkgs-npu, pkgs-small,
... ...
}: }:
let let
@@ -52,9 +52,9 @@ let
''; '';
# openvino-genai 2026.4.0.0 fails to compile against the OpenVINO headers in # openvino-genai 2026.4.0.0 fails to compile against the OpenVINO headers in
# nixos-unstable (no matching constructor in continuous_batching); the branch's # nixos-unstable (no matching constructor in continuous_batching); the
# nixpkgs builds it, and the service has to match the NPU stack anyway. # service takes it from the same nixpkgs as the NPU stack.
pythonEnv = pkgs-npu.python3.withPackages (ps: [ pythonEnv = pkgs-small.python3.withPackages (ps: [
ps.fastapi ps.fastapi
ps.numpy ps.numpy
ps.openvino-genai ps.openvino-genai
@@ -90,9 +90,6 @@ in
# Python block-buffers stdout when it is not a tty, which would hold the # Python block-buffers stdout when it is not a tty, which would hold the
# request log lines back instead of putting them in the journal. # request log lines back instead of putting them in the journal.
PYTHONUNBUFFERED = "1"; PYTHONUNBUFFERED = "1";
# The stock driver cannot find the NPU compiler; the patched one loads it
# from its own store path.
ZE_ENABLE_ALT_DRIVERS = "${lib.getLib pkgs-npu.intel-npu-driver}/lib/libze_intel_npu.so";
}; };
# Reads its model, writes its cache, uses the NPU and listens on the LAN. # Reads its model, writes its cache, uses the NPU and listens on the LAN.
-9
View File
@@ -1,8 +1,6 @@
{ {
disko, disko,
myvars, myvars,
lib,
pkgs-npu,
... ...
}: }:
############################################################# #############################################################
@@ -71,13 +69,6 @@ in
# profile's rootless Podman (modules/nixos/agent.nix), built from the `~/src` # profile's rootless Podman (modules/nixos/agent.nix), built from the `~/src`
# checkout that ./preservation.nix keeps. # checkout that ./preservation.nix keeps.
# Speech recognition runs on the NPU, see ./asr.nix. The driver and the
# compiler it loads come from NixOS/nixpkgs#570230, which is unmerged, so they
# are taken from that branch as `pkgs-npu`; the stock driver cannot find the
# compiler, the patched one loads it from its own store path. The service sets
# this itself -- the session variable is for manual runs.
environment.sessionVariables.ZE_ENABLE_ALT_DRIVERS = "${lib.getLib pkgs-npu.intel-npu-driver}/lib/libze_intel_npu.so";
# The daemons of the hosts that build here (modules/nixos/base/remote-builders.nix). # The daemons of the hosts that build here (modules/nixos/base/remote-builders.nix).
# Their host keys have no passphrase, so they only get the daemon protocol, as # Their host keys have no passphrase, so they only get the daemon protocol, as
# nix.sshServe does. `--store daemon` hands builds to the system daemon instead # nix.sshServe does. `--store daemon` hands builds to the system daemon instead
@@ -1,8 +1,14 @@
{ {
pkgs, pkgs,
pkgs-small,
... ...
}: }:
{ {
# The NPU serves ./asr.nix; the driver's compiler lookup is fixed by
# NixOS/nixpkgs#570230, which reached nixos-unstable-small first (WA-037).
hardware.cpu.intel.npu.enable = true;
nixpkgs.overlays = [ (_: _: { inherit (pkgs-small) intel-npu-driver; }) ];
# Ad-hoc CPU idle-power diagnostics: package power, C-state residency and # Ad-hoc CPU idle-power diagnostics: package power, C-state residency and
# wakeup attribution. Long-term RAPL export lives in the shared # wakeup attribution. Long-term RAPL export lives in the shared
# modules/nixos/base/power-monitoring.nix module. # modules/nixos/base/power-monitoring.nix module.
+1 -1
View File
@@ -61,7 +61,7 @@ let
# to use chrome, we need to allow the installation of non-free software # to use chrome, we need to allow the installation of non-free software
config.allowUnfree = true; config.allowUnfree = true;
}; };
pkgs-npu = import inputs.nixpkgs-npu { pkgs-small = import inputs.nixpkgs-small {
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
}; };