Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 3 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
};

outputs = { self, nixpkgs, ... } @ inputs: {
nixosConfigurations.myhost = nixpkgs.lib.nixosConfiguration {
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
modules = [
{
_module.args = {
Expand Down Expand Up @@ -128,25 +128,9 @@ Vulkan バックエンドはデフォルトで無効です(CPU のみ)。Nix
}
```

Vulkan は GPU ドライバの .so をランタイムでロードするため、`/run/opengl-driver/lib` のドライバが使う glibc と nix-hazkey flake で使われる glibc が一致する必要があります。一致しない場合 SIGSEGV でクラッシュします。
Vulkan は GPU ドライバの .so をランタイムでロードします。NixOS では GPU ドライバも nixpkgs からビルドされるため問題になりませんが、non-NixOS ではディストロの GPU ドライバと nixpkgs の glibc が同一プロセスに混在し、SIGSEGV でクラッシュします。

glibc を一致させるための設定:

NixOS Installation:
NixOS nixpkgs
-> nix-hazkey flake `inputs.nix-hazkey.inputs.nixpkgs.follows = "nixpkgs";`

Home Manager Installation (NixOS):
NixOS nixpkgs
-> Home Manager `nixpkgs.useGlobalPkgs = true;`
-> nix-hazkey flake `inputs.nix-hazkey.inputs.nixpkgs.follows = "nixpkgs";`

Home Manager Installation (non-NixOS):
通常、glibc の不一致が避けられないため Vulkan は使用できません。
[non-nixos-gpu](https://github.com/exzombie/non-nixos-gpu) や Home Manager の `targets.genericLinux.gpu` で `/run/opengl-driver` に nixpkgs ビルドのドライバを配置すれば動作する可能性があります:
/run/opengl-driver/lib (non-nixos-gpu / `targets.genericLinux.gpu`) <-
HM nixpkgs
-> nix-hazkey flake `inputs.nix-hazkey.inputs.nixpkgs.follows = "nixpkgs";`
non-NixOS の場合、通常 Vulkan は使用できません。[non-nixos-gpu](https://github.com/exzombie/non-nixos-gpu) や Home Manager の `targets.genericLinux.gpu` で `/run/opengl-driver` に nixpkgs ビルドのドライバを配置すれば動作する可能性があります。

## Contribution

Expand Down
6 changes: 3 additions & 3 deletions packages/hazkey-server/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ in
runHook postInstall
'';

# Vulkan is opt-in (enableVulkan = true) because GPU drivers are linked
# against the host glibc, which must match this flake's glibc exactly.
# A mismatch causes SIGSEGV. See README for details.
# Vulkan is opt-in (enableVulkan = true) because on non-NixOS the distro's
# GPU drivers and nixpkgs' glibc coexist in the same process, causing SIGSEGV.
# See README for details.
postFixup = lib.optionalString enableVulkan ''
addDriverRunpath $out/lib/hazkey/libllama/backends/libggml-vulkan.so
'';
Expand Down