# Escape hatches on Nix and NixOS

**URL:** https://discourse.nixos.org/t/escape-hatches-on-nix-and-nixos/39352
**Category:** Help
**Created:** [February 5, 2024, 7:38pm UTC](https://discourse.nixos.org/t/escape-hatches-on-nix-and-nixos/39352 "2024-02-05T19:38:11Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![gnu\_s](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/g/df705f/32.png) [@gnu\_s](https://discourse.nixos.org/u/gnu_s)
#### Post date: [February 5, 2024, 7:38pm UTC](https://discourse.nixos.org/t/escape-hatches-on-nix-and-nixos/39352/1 "2024-02-05T19:38:11Z")

</div>

I run NixOS in a few servers, workstations, and desktops. For 95% of the usecases, it is fantastic. But the remaining 5% is sometimes challenging. I am interested in hearing how users install packages that are broken or unpackaged, perhaps by using some escape hatches like `FHSUserEnv`.

Let me give one example. I use Julia in several projects. Julia has been broken for some time on Nix, and it is not particularly easy to package due to some hardcoded paths on Julia’s side. `julia.withPackages` has landed on unstable, but it is still a bit buggy.

What is the easiest way to install Julia, without having to deal with the gargantuan task of packaging it myself? Using `FHSUserEnv`?

This task is paradoxically easier to accomplish in other distributions where I still use Nix for everything. I simply backtrack to the distribution package manager for stuff that is broken or missing in Nix. For example, when using Arch for this particular Julia project I install Julia with Pacman and all other dependencies with Nix.

tl;dr For some tasks, using Nix in a regular Linux distribution is easier than NixOS, as there are some escape hatches. How to improve this scenario?

---

<div class="post-metadata">

### Author: ![rhendric](https://discourse.nixos.org/user_avatar/discourse.nixos.org/rhendric/32/5699_2.png) [@rhendric](https://discourse.nixos.org/u/rhendric)
#### Post date: [February 5, 2024, 7:59pm UTC](https://discourse.nixos.org/t/escape-hatches-on-nix-and-nixos/39352/2 "2024-02-05T19:59:01Z")

</div>

> [@gnu\_s](#):
>
> What is the easiest way

[Distrobox](https://distrobox.it/).

---

<div class="post-metadata">

### Author: ![gnu\_s](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/g/df705f/32.png) [@gnu\_s](https://discourse.nixos.org/u/gnu_s)
#### Post date: [February 6, 2024, 2:11am UTC](https://discourse.nixos.org/t/escape-hatches-on-nix-and-nixos/39352/3 "2024-02-06T02:11:10Z")

</div>

Any other preferred solutions? system nspawn containers? Docker?

---

<div class="post-metadata">

### Author: ![SergeK](https://discourse.nixos.org/user_avatar/discourse.nixos.org/sergek/32/2972_2.png) [@SergeK](https://discourse.nixos.org/u/SergeK)
#### Post date: [February 6, 2024, 2:38am UTC](https://discourse.nixos.org/t/escape-hatches-on-nix-and-nixos/39352/4 "2024-02-06T02:38:32Z")

</div>

> [@gnu\_s](#):
>
> `julia.withPackages` has landed on unstable, but it is still a bit buggy.

Tried it a couple days ago and it worked like a charm. Ofc all of the vendored stuff (CUDA) is likely to be broken and will require overrides. In what way does `julia.withPackages` break for you?

> [@gnu\_s](#):
>
> using Nix in a regular Linux distribution is easier than NixOS, as there are some escape hatches.

There’s plenty of escape hatches and/or ways to build escape hatches on NixOS. If you just want to use an external distribution (conda, pypi) on NixOS and that expects non-existent global paths, no one prevents you from populating those global paths on your own system (e.g. via systemd tmpfiles, etc). Tools like `nix-ld` and `envfs` let you do precisely that but in a more contained manner. IMO, there’s a long road before you actually need a FHS user env

---

<div class="post-metadata">

### Author: ![gnu\_s](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/g/df705f/32.png) [@gnu\_s](https://discourse.nixos.org/u/gnu_s)
#### Post date: [February 6, 2024, 6:57pm UTC](https://discourse.nixos.org/t/escape-hatches-on-nix-and-nixos/39352/5 "2024-02-06T18:57:42Z")

</div>

The Julia enviroment suggested by the [manual](https://nixos.org/manual/nixpkgs/unstable/#language-julia), i.e. `nix-shell -p 'julia.withPackages ["Plots"]' --run julia`, fails to build.

The dependency ll5ydlzjhr44wfjmbma28ns2iz5b5nwl-mtdev.v1.1.6.x86\_64-linux-gnu.tar.gz.drv fails.

---

<div class="post-metadata">

### Author: ![SergeK](https://discourse.nixos.org/user_avatar/discourse.nixos.org/sergek/32/2972_2.png) [@SergeK](https://discourse.nixos.org/u/SergeK)
#### Post date: [February 11, 2024, 10:27pm UTC](https://discourse.nixos.org/t/escape-hatches-on-nix-and-nixos/39352/6 "2024-02-11T22:27:23Z")

</div>

> `nix-shell -p 'julia.withPackages ["Plots"]' --run julia`, fails to build.

What is the error message?

```auto
❯ nix eval --impure --expr builtins.nixPath
[... { path = "flake:nixpkgs"; prefix = "nixpkgs"; } ...]
❯ nix flake metadata nixpkgs
...
Path: /nix/store/3qsyy1d9wlxy0zaa5l27nwis7cjf93qs-source
Revision: faf912b086576fd1a15fca610166c98d47bc667e
...
❯ nix-shell -p 'julia.withPackages ["Plots"]' --run julia
julia>

```

Consider trying a different nixpkgs revision. Please report a bug if the error persists

---

<div class="post-metadata">

### Author: ![gnu\_s](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/g/df705f/32.png) [@gnu\_s](https://discourse.nixos.org/u/gnu_s)
#### Post date: [February 12, 2024, 8:00pm UTC](https://discourse.nixos.org/t/escape-hatches-on-nix-and-nixos/39352/7 "2024-02-12T20:00:47Z")

</div>

When I was about to fill in a bug, it began working. It didn’t work on the last few nixos-unstable channel hashes, but it does build on `24.05pre582649.d934204a0f8d (Uakari)`.

Edit: I will fill in a bug report after all, as simple Julia instantiations fail to build. E.g.:

`nix-shell -p 'julia.withPackages ["Turing"]' --run julia` quickly yields:

`ERROR: Unsatisfiable requirements detected for package GPUCompiler [61eb1bfa]`

It seems that at very least it needs some documentation on how dependencies are resolved.
