Containers on NixOS for running Ubuntu packages

Hi!

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.

1 Like

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

By the Merlin’s left tit, thank you for explaining why my beautifully working distroboxes get trashed after updates/GCing. I was just about ready to give up on the distrobox thing.
By chance, might you know of a link which attempts to explain in more depth the process of why/how this happens?
Not sure where to dig into, took a look at Podman, Distrobox and Nixos docs and just not getting it so far.

1 Like