Escape hatches on Nix and NixOS

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?



Any other preferred solutions? system nspawn containers? Docker?

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?

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


The Julia enviroment suggested by the manual, 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.

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

What is the error message?

❯ 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

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

1 Like

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.