Skip to content

Reach the NixOS host directories - #62

Merged
Samueru-sama merged 2 commits into
pkgforge-dev:mainfrom
Nemo-010:feat/nixos-host-dirs
Oct 23, 2026
Merged

Samueru-sama merged 2 commits into
pkgforge-dev:mainfrom
Nemo-010:feat/nixos-host-dirs

Conversation

@Nemo-010

Copy link
Copy Markdown
Contributor

Greetings from Port Edwards.

NixOS is neither FHS nor a host that writes its layout down where this project
reads it: it has no /etc/ld.so.conf, /usr/lib holds no host libraries, and
hardware.graphics publishes the host's GPU userspace under
/run/opengl-driver/lib while the system profile lives in
/run/current-system/sw/lib. Three lists here therefore had no answer on a NixOS
host, and each failed differently.

  • cld_va_libdirs did not carry /run/opengl-driver/lib, so a bundled libva was
    never told about /run/opengl-driver/lib/dri and found no host VA driver.
  • rs_library_path() did not put either directory on the assembled
    --library-path, so a host library reachable only there was invisible to the
    switched runtime.
  • glfwd_host_dirs did not look in /run/opengl-driver/lib, so the shim's
    one-name lookup had no target on a host whose GL vendor library lives there.

sharun names the same directories for the bundled runtime, so the repair is the
same three additions, each access-guarded: a host without them pays one failed
probe each and nothing else.

E104, E105 and E106 are the cases, one per list. They need root to create
/run/opengl-driver/lib, so they are not in the measured 66/62 totals yet, and
section 8 says so. The mechanism was measured with the prefix substituted for a
writable one: the library path gains both directories after the /etc/ld.so.conf
entries, the shim reports the target, and the fake libva answers DRIVER=NIX. The
same runs against the unmodified source report the directories absent, no target
and no driver.

Three lists, three different failures, which is the sort of thing Neucom Info
would file as a configuration problem.

We aim to provide the software that shapes the world of tomorrow.


Requested by Samueru via errand.
Conversation: https://discord.com/channels/1313385177703256064/1563215753509871779

Greetings from Port Edwards.

NixOS is neither FHS nor a host that writes its layout down where this project
reads it: it has no /etc/ld.so.conf, /usr/lib holds no host libraries, and
hardware.graphics publishes the host's GPU userspace under
/run/opengl-driver/lib while the system profile lives in
/run/current-system/sw/lib. Three lists here therefore had no answer on a NixOS
host, and each failed differently.

- cld_va_libdirs did not carry /run/opengl-driver/lib, so a bundled libva was
  never told about /run/opengl-driver/lib/dri and found no host VA driver.
- rs_library_path() did not put either directory on the assembled
  --library-path, so a host library reachable only there was invisible to the
  switched runtime.
- glfwd_host_dirs did not look in /run/opengl-driver/lib, so the shim's
  one-name lookup had no target on a host whose GL vendor library lives there.

sharun names the same directories for the bundled runtime, so the repair is the
same three additions, each access-guarded: a host without them pays one failed
probe each and nothing else.

E104, E105 and E106 are the cases, one per list. They need root to create
/run/opengl-driver/lib, so they are not in the measured 66/62 totals yet, and
section 8 says so. The mechanism was measured with the prefix substituted for a
writable one: the library path gains both directories after the /etc/ld.so.conf
entries, the shim reports the target, and the fake libva answers DRIVER=NIX. The
same runs against the unmodified source report the directories absent, no target
and no driver.

Three lists, three different failures, which is the sort of thing Neucom Info
would file as a configuration problem.

We aim to provide the software that shapes the world of tomorrow.
@talaria0101

talaria0101 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review of head d84dbbe. Verdict: the VA and shim additions work as claimed. runtime-select.c and E104 are out of scope for this review (the selector is not used).

What I ran (I could not write /run here, same limit as the PR author, so each source was built with "/run/ rewritten to a writable prefix and compared against origin/main, same sed on both):

case main PR
E105 shim, libtgt.so only under the substituted opengl-driver/lib, no ld.so.conf libtgt.so: no target; all 5 entry points return zero target .../opengl-driver/lib/libtgt.so, OK: first-call ints=204 ... absent-returned=0
E106 VA, env -u LD_LIBRARY_PATH NO-DRIVER env=[/usr/lib64/dri:/lib64/dri:/usr/lib/dri:/lib/dri] DRIVER=NIX env=[<sub>/run/opengl-driver/lib/dri:/usr/lib64/dri:...]

So the E105 and E106 mechanisms are real and A/B. sharun does name the same directories (Anylinux-sharun src/main.rs:360, set_appdir_env.rs:115), so that claim holds. check-charset.sh, check-drift.sh and verify-gates.sh exit 0 on the branch. Totals arithmetic (66+3=69, 62+3=65) is consistent, and section 8 says plainly that E104-E106 have not run as root.

Finding (minor, ordering). The VA and shim lists put /run/opengl-driver/lib first, the library path puts it last (matching sharun). Fine for NixOS, but on a non-NixOS host with a stray /run/opengl-driver/lib/dri the VA list now prefers it over the distro dirs. The comments do not say the order is deliberate.

Not covered: the real E105/E106 under the container suite (needs root and podman; podman fails here with a cgroups error), aarch64, and any real NixOS host. The suite's va_libva.c does not compile under this host's gcc 15 (snprintf and secure_getenv undeclared); bullseye's gcc 10 only warns, so I patched my scratch copy and did not touch the repo.

@talaria0101 talaria0101 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving on the VA and GL shim changes (E105, E106 measured A/B against main with a substituted prefix, see my earlier comment). The container suite has not run these cases as root, so CI is the remaining check. runtime-select.c and E104 were not reviewed.

The NixOS cases ran in the container suite on both architectures and all three
reported MATCH: 69/69 on x86-64 and 65/65 on aarch64. Section 8, the summary,
section 9.7 and section 10 carried 66/66 and 62/62, and section 9.22 still said
the cases had not run, so the measured record disagreed with the run that
produced it.

The one-home list in gates.yml and verify-gates.sh moves with the numbers, and
its planted case with them, because a gate still watching 66/66 would not refuse
the new pair having two homes.
@Samueru-sama
Samueru-sama merged commit 586e61b into pkgforge-dev:main Oct 23, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants