Building docker images with Nix that require internet access? + `dockerTools` usecases

I’d like to use Nix and Nixpkgs’ dockerTools to help me compile something on an Ubuntu machine, hopefully in a reproducible manner. It’s something proprietary, very non-portable unfortunately, even when trying to use buildFHSEnv (let’s not get into the details of that).

The thing is, that I need a few Debian packages to be installed in that image before I start compiling things there - this is the only part where I need internet connection. Does that makes things overly complicated? Because Nix would then require a fixed output derivation? Should I simply use a Dockerfile and work like everyone else?

Since I’m also somewhat less familiar with Docker, I’d like to hear your use-cases for Nixpkgs’ dockerTools, especially if other distributions are involved in these use-cases.

1 Like

If it is just a few .debs you can prefetch them and then just install them using extraCommands.

Hmm right… Since there could be many dependencies, it may not be trivial to get all the dependencies correctly, but it should also be possible to get them all via a script and a fixed output derivation.

I am still wondering if anyone has also felt the need for a generalized way to do it. If I’ll write a script such as the above for sure I’ll share it…