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 Download Nix / NixOS | 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

I am trying to reproduce this:
https://github.com/racket/racket/issues/2451

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 https://github.com/nix-community/nixos-generators.

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 https://github.com/NixOS/nixpkgs-channels/blob/5e6ae9b6a51a1ab4a182b23f5bc883e4ae7f6692/pkgs/development/interpreters/racket/default.nix