NixOS on docker

I am trying to debug a bug in racket that only occurs under NixOS. I am new to NixOS. Is there a quick way to get a NixOS image where I can compile and debug? I was thinking of docker but can’t find any NixOS docker image. Have I missed anything?

The short version: nixos won’t run on docker properly (without --privileged or similar concessions) because it needs systemd. I’d recommend a VM or live system instead, which you can set up using one of the images on NixOS - Getting Nix / NixOS.

I’m not sure of the specifics of the bug, but maybe you can also reproduce it with the racket from nixpkgs on another distribution or in the nix docker image.

If all you want is to install and run a package, maybe you want Nix docker image? It is here Docker Hub

I am trying to reproduce this:

Reproducing is actually ok, because I can just install racket and run it to check. But now I need a debuggable version. I need to build racket under nix and then run it under gdb to understand what’s happening. Similar to what Mic92 did on the bug report.

I guess I might need a VM then…

than indeed, you should download a VM image just like @lheckemann described. Also, you can install Nix locally and generate NixOS VM images yourself with GitHub - nix-community/nixos-generators: Collection of image builders [maintainer=@Lassulus].

And finally, you can install additional packages (like gdb) in Docker as well. Just add -p gdb to command line (dunno how well gdb works in docker). You may also run in Docker

$ nix-shell '<nixpkgs>' -A racket
nix-shell $ unpackPhase

to fetch sources and builders. Then reconfigure and rebuild racket as usual

You may also be interested in current build instructions. They lay at