# Nix pragmatism: nix-ld and envfs

**URL:** https://discourse.nixos.org/t/nix-pragmatism-nix-ld-and-envfs/60968
**Category:** Links
**Created:** [February 28, 2025, 12:51am UTC](https://discourse.nixos.org/t/nix-pragmatism-nix-ld-and-envfs/60968 "2025-02-28T00:51:57Z")
**Posts on this page:** 11
**Page:** 2

<div class="post-metadata">

### Author: ![zimbatm](https://discourse.nixos.org/user_avatar/discourse.nixos.org/zimbatm/32/4_2.png) [@zimbatm](https://discourse.nixos.org/u/zimbatm)
#### Post date: [March 3, 2025, 10:58am UTC](https://discourse.nixos.org/t/nix-pragmatism-nix-ld-and-envfs/60968/21 "2025-03-03T10:58:53Z")

</div>

I have envfs and nix-ld enabled on my machines.

Specifically for development, it makes it easier to jump into new projects without going trough this whole “purification” phase. Please don’t take it too literally, but here is a carricature of the “pure” path, vs the green envfs + nix-ld one:

 ![image](https://discourse.nixos.org/uploads/default/original/3X/3/c/3cadb80d6991e5a06471d74d0283c6d56f18f5f6.png)

For projects I run, I still go trough the trouble of the black path, because it’s getting repaid over time. But I find it’s not worth it when all you want to do is fix upstream and send a PR.

---

<div class="post-metadata">

### Author: ![fzakaria](https://discourse.nixos.org/user_avatar/discourse.nixos.org/fzakaria/32/2643_2.png) [@fzakaria](https://discourse.nixos.org/u/fzakaria)
#### Post date: [March 3, 2025, 2:51pm UTC](https://discourse.nixos.org/t/nix-pragmatism-nix-ld-and-envfs/60968/22 "2025-03-03T14:51:06Z")

</div>

Can I use your photo 😂

---

<div class="post-metadata">

### Author: ![iwanb](https://discourse.nixos.org/user_avatar/discourse.nixos.org/iwanb/32/4268_2.png) [@iwanb](https://discourse.nixos.org/u/iwanb)
#### Post date: [March 3, 2025, 7:46pm UTC](https://discourse.nixos.org/t/nix-pragmatism-nix-ld-and-envfs/60968/23 "2025-03-03T19:46:06Z")

</div>

I mostly fall back to [distrobox](https://distrobox.it/) if I want to try something (like a pip install) without having to fiddle with nix. A similar approach could be used with nix, I think `steam-run` is kind of like that. E.g. having `pip-run-with-manylinux-fhs` which would set up the [manylinux FHS](https://github.com/NixOS/nixpkgs/blob/48387559ac2fff5fd789f66ba7e81784d2086e9b/pkgs/development/interpreters/python/manylinux/default.nix#L4) in a mount namespace so you can just use pip normally would be nice. That would preserve the “temporary” nature of nix-shell.

---

<div class="post-metadata">

### Author: ![dtomvan](https://discourse.nixos.org/user_avatar/discourse.nixos.org/dtomvan/32/31095_2.png) [@dtomvan](https://discourse.nixos.org/u/dtomvan)
#### Post date: [March 3, 2025, 9:20pm UTC](https://discourse.nixos.org/t/nix-pragmatism-nix-ld-and-envfs/60968/24 "2025-03-03T21:20:40Z")

</div>

I think programs.nix-ld.enable is enabled in the default generated installer config?? I may be mistaken, it might be stub-ld instead…

---

<div class="post-metadata">

### Author: ![fzakaria](https://discourse.nixos.org/user_avatar/discourse.nixos.org/fzakaria/32/2643_2.png) [@fzakaria](https://discourse.nixos.org/u/fzakaria)
#### Post date: [March 3, 2025, 9:26pm UTC](https://discourse.nixos.org/t/nix-pragmatism-nix-ld-and-envfs/60968/25 "2025-03-03T21:26:22Z")

</div>

since envfs is $PATH based and dynamic it’s effectively “temporary” to the nature of a nix-shell as well!

---

<div class="post-metadata">

### Author: ![waffle8946](https://discourse.nixos.org/user_avatar/discourse.nixos.org/waffle8946/32/27221_2.png) [@waffle8946](https://discourse.nixos.org/u/waffle8946)
#### Post date: [March 3, 2025, 9:29pm UTC](https://discourse.nixos.org/t/nix-pragmatism-nix-ld-and-envfs/60968/26 "2025-03-03T21:29:58Z")

</div>

`nix-ld` is definitely not enabled by default. n-g-c also doesn’t touch `stub-ld` either, the default value on NixOS is just to enable it:

> <https://github.com/NixOS/nixpkgs/blob/1546c45c538633ae40b93e2d14e0bb6fd8f13347/nixos/modules/config/stub-ld.nix#L52-L56>

---

<div class="post-metadata">

### Author: ![iwanb](https://discourse.nixos.org/user_avatar/discourse.nixos.org/iwanb/32/4268_2.png) [@iwanb](https://discourse.nixos.org/u/iwanb)
#### Post date: [March 4, 2025, 12:19pm UTC](https://discourse.nixos.org/t/nix-pragmatism-nix-ld-and-envfs/60968/27 "2025-03-04T12:19:05Z")

</div>

Ah ok, nice, I misunderstood how it works then, I’ll need to give it a proper try!

---

<div class="post-metadata">

### Author: ![Mic92](https://discourse.nixos.org/user_avatar/discourse.nixos.org/mic92/32/5265_2.png) [@Mic92](https://discourse.nixos.org/u/Mic92)
#### Post date: [March 7, 2025, 2:17am UTC](https://discourse.nixos.org/t/nix-pragmatism-nix-ld-and-envfs/60968/28 "2025-03-07T02:17:31Z")

</div>

There are corner cases where environment variables changes are not visible to the approach that envfs is using it via FUSE, so I prefer the simpler glibc wrapper that is more robust and doesn’t require any external process to run.

---

<div class="post-metadata">

### Author: ![Mic92](https://discourse.nixos.org/user_avatar/discourse.nixos.org/mic92/32/5265_2.png) [@Mic92](https://discourse.nixos.org/u/Mic92)
#### Post date: [March 7, 2025, 2:19am UTC](https://discourse.nixos.org/t/nix-pragmatism-nix-ld-and-envfs/60968/29 "2025-03-07T02:19:26Z")

</div>

FUSE doesn’t not require user namespaces. Not sure if mount.fuse uses usernamespaces for unprivileged mounts in some cases, but for envfs we are mounting the filesystems as root.

---

<div class="post-metadata">

### Author: ![Rconybea](https://discourse.nixos.org/user_avatar/discourse.nixos.org/rconybea/32/28877_2.png) [@Rconybea](https://discourse.nixos.org/u/Rconybea)
#### Post date: [March 15, 2025, 6:17pm UTC](https://discourse.nixos.org/t/nix-pragmatism-nix-ld-and-envfs/60968/30 "2025-03-15T18:17:09Z")

</div>

Understood for root, point taken

---

<div class="post-metadata">

### Author: ![jverce](https://discourse.nixos.org/user_avatar/discourse.nixos.org/jverce/32/33656_2.png) [@jverce](https://discourse.nixos.org/u/jverce)
#### Post date: [August 24, 2025, 12:24am UTC](https://discourse.nixos.org/t/nix-pragmatism-nix-ld-and-envfs/60968/31 "2025-08-24T00:24:44Z")

</div>

This has been really useful, thanks!!

[Previous page](https://discourse.nixos.org/t/nix-pragmatism-nix-ld-and-envfs/60968.md?page=1)
