6 ms·
Does it make sense to use nix during the image build process to precisely define dependencies I want to have in the resulting container? Or perhaps in other wor
by dusanh 3y ago
Does it make sense to use nix during the image build process to precisely define dependencies I want to have in the resulting container? Or perhaps in other words, can I use nix and docker together, to have a precisely defined environment I can share with others devs as a result?
- dlahoda 3y agoyes. nix builds linux filesystem with all dependencies and puts it into oci image. so locally i use process-compose to avoiding waiting docker builds.
- dusanh 3y agoHm, I skimmed the github page for process-compose and I don't understand how it is different from building the container image directly with nix.
- rgoulter 3y ago> Does it make sense to use nix during the image build process to precisely define dependencies I want to have in the resulting container? Using a dockerfile with a step like "RUN nix ..."? You can, but it strikes me as a cumbersome way of doing things. Mitchell H describes this way of doing things here: https://mitchellh.com/writing/nix-with-dockerfiles https://mitchellh.com/writing/nix-with-dockerfiles Whereas, I'd reckon the more idiomatic thing to do is to build the Docker image with Nix code. -- You're going to get a precisely defined environment to share across workstation/CI/etc. Some example Nix code for building Docker images is here https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/docker/examples.nix https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-supp...
- dusanh 3y agoThanks for the links, that is very useful! It seems like I was thinking about this process the other way around.