Containers on NixOS for running Ubuntu packages


I’m pretty new to NixOS, and I’ve never messed with containers before. I need to run LabVIEW for a class, and according to NI’s website, LabVIEW is packaged for Ubuntu 22.04/20.04 (and RHEL and OpenSUSE, but I’m even less familiar with those distros). You have to download a package which (i assume) adds some sources to apt to install LabVIEW. I could run this in a Windows VM (which I will need for other software anyway, such as Multisim), but this is problematic for a number of reasons, including massive storage space requirements, the need to move files between a host/client system, and etc.

I was thinking about using Distrobox, but from my research this uses Podman under the hood. I’ve never used Docker or Podman before, and I’m looking for a good place to start (and some advice for setup with NixOS). I basically just need to be able to run apt/dpkg to download propreitary software.

Would something like Docker/Podman be a good solution for this problem? Thanks for the advice.

I use Distrobox for such use cases on NixOS. Works like a charm, with a single caveat: Pin Distrobox, as the path to the Distrobox-Script leaks into the containers, which breaks the container when these paths are eventually GC’s from the store.

If you want to use Podman directly and run your own container, it is as easy as enabling it in your config:

  virtualisation.podman.enable = true;

You can even run Podman from a nix shell without enabling it in the config.

By pinning Distrobox, do you mean ensuring I’m declaring it using (for example) stable 24.05 nixpkgs as opposed to an unstable input? Thanks!

No, pinning to a NIxpkgs commit using niv or flakes.

1 Like