[GH-ISSUE #5248] Native mod builds fail on NixOS (missing pkg-config / ALSA / libudev dev files) #1611

Closed
opened 2026-11-02 15:48:21 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @UniDex101 on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5248

On NixOS the launcher reports that native mods can’t be built because pkg-config, ALSA development files and libudev development files are missing:

Native mods need these to build the game on Linux, and this computer lacks them: pkg-config, ALSA's development files, libudev's development files. Install them with your distribution's package manager, then build again (on Debian, Ubuntu or Mint: sudo apt install build-essential pkg-config libasound2-dev libudev-dev).

Image

The packages are installed ( via environment.systemPackages ): pkg-config, alsa-lib / alsa-lib.dev, udev / udev.dev, plus the usual compiler bits. On NixOS they live in the store and are only visible to pkg-config when the corresponding setup hooks have run ( i.e. inside a nix-shell / nix develop that lists them as buildInputs / nativeBuildInputs ). The launcher’s check (and the later Cargo invocation) don’t see them from a normal desktop session.

Workaround that works:

nix-shell -p pkg-config alsa-lib.dev udev.dev gcc gnumake cargo rustc --run "path/to/horizon-launcher"

( or the equivalent mkShell )

Environment:
NixOS ( ID=nixos in /etc/os-release )
Horizon launcher binary (not a nixpkgs package)
A NixOS-aware check (or documenting the shell wrapper) would be enough; packaging the launcher as a flake that already provides the build environment would also solve it.

Originally created by @UniDex101 on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5248 On NixOS the launcher reports that native mods can’t be built because pkg-config, ALSA development files and libudev development files are missing: > Native mods need these to build the game on Linux, and this computer lacks them: pkg-config, ALSA's development files, libudev's development files. Install them with your distribution's package manager, then build again (on Debian, Ubuntu or Mint: sudo apt install build-essential pkg-config libasound2-dev libudev-dev). <img width="814" height="142" alt="Image" src="https://github.com/user-attachments/assets/12330014-7f2b-490e-9cac-783e4b01399d" /> The packages are installed ( via `environment.systemPackages` ): `pkg-config`, `alsa-lib` / `alsa-lib.dev`, `udev` / `udev.dev`, plus the usual compiler bits. On NixOS they live in the store and are only visible to pkg-config when the corresponding setup hooks have run ( i.e. inside a nix-shell / nix develop that lists them as `buildInputs` / `nativeBuildInputs` ). The launcher’s check (and the later Cargo invocation) don’t see them from a normal desktop session. Workaround that works: ``` nix-shell -p pkg-config alsa-lib.dev udev.dev gcc gnumake cargo rustc --run "path/to/horizon-launcher" ``` ( or the equivalent `mkShell` ) Environment: NixOS ( ID=nixos in `/etc/os-release` ) Horizon launcher binary (not a nixpkgs package) A NixOS-aware check (or documenting the shell wrapper) would be enough; packaging the launcher as a flake that already provides the build environment would also solve it.
Author
Owner

@UniDex101 commented on GitHub (Oct 31, 2026):

Related packaging (doesn’t fix the build-deps check): community flake in #4292 / https://github.com/forge-sa/horizon-nix wraps the launcher in buildFHSEnv for running, but native mod compilation still needs the dev files visible to pkg-config.

<!-- gh-comment-id:6546030775 --> @UniDex101 commented on GitHub (Oct 31, 2026): Related packaging (doesn’t fix the build-deps check): community flake in #4292 / https://github.com/forge-sa/horizon-nix wraps the launcher in buildFHSEnv for running, but native mod compilation still needs the dev files visible to pkg-config.
Author
Owner

@UniDex101 commented on GitHub (Oct 31, 2026):

Update: working runtime workaround

The nix-shell that only has the .dev packages is enough for the mod's build to start, but the resulting horizon-client binary still fails at runtime with missing shared libraries (libudev.so.1, then Wayland, etc.).

This shell provides both the build tools and the runtime libraries via LD_LIBRARY_PATH:

# ~/horizon-shell.nix
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
  packages = with pkgs; [
    pkg-config
    alsa-lib
    alsa-lib.dev
    udev
    udev.dev
    gcc
    gnumake
    cargo
    rustc

    # runtime libs the built client needs
    wayland
    libxkbcommon
    vulkan-loader
    mesa
    libGL
  ];

  shellHook = ''
    export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath [
      pkgs.alsa-lib
      pkgs.udev
      pkgs.wayland
      pkgs.libxkbcommon
      pkgs.vulkan-loader
      pkgs.mesa
      pkgs.libGL
    ]}"
  '';
}

Run with:

nix-shell ~/horizon-shell.nix --run "path/to/horizon-client"

The launcher and the built horizon-client with mods both inherit LD_LIBRARY_PATH, so the dynamic linker finds the libraries. Native mod builds and launching the client both work with this.

(If you have programs.nix-ld.enable = true, adding the same runtime packages to nix-ld.libraries is a more permanent alternative.)

<!-- gh-comment-id:6549249163 --> @UniDex101 commented on GitHub (Oct 31, 2026): Update: working runtime workaround The `nix-shell` that only has the `.dev` packages is enough for the mod's build to start, but the resulting `horizon-client` binary still fails at runtime with missing shared libraries (`libudev.so.1`, then Wayland, etc.). This shell provides both the build tools and the runtime libraries via LD_LIBRARY_PATH: ```nix # ~/horizon-shell.nix { pkgs ? import <nixpkgs> {} }: pkgs.mkShell { packages = with pkgs; [ pkg-config alsa-lib alsa-lib.dev udev udev.dev gcc gnumake cargo rustc # runtime libs the built client needs wayland libxkbcommon vulkan-loader mesa libGL ]; shellHook = '' export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath [ pkgs.alsa-lib pkgs.udev pkgs.wayland pkgs.libxkbcommon pkgs.vulkan-loader pkgs.mesa pkgs.libGL ]}" ''; } ``` Run with: ``` nix-shell ~/horizon-shell.nix --run "path/to/horizon-client" ``` The launcher and the built `horizon-client` with mods both inherit `LD_LIBRARY_PATH`, so the dynamic linker finds the libraries. Native mod builds and launching the client both work with this. (If you have `programs.nix-ld.enable = true`, adding the same runtime packages to `nix-ld.libraries` is a more permanent alternative.)
Author
Owner

@kira-horizon[bot] commented on GitHub (Nov 1, 2026):

Claimed by doodly on Discord, to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #5248).

<!-- gh-comment-id:6559926908 --> @kira-horizon[bot] commented on GitHub (Nov 1, 2026): Claimed by `doodly` on Discord, to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #5248). <!-- kira:work -->
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#1611
No description provided.