docker: use callPackage, parametrise the image build#13354
Merged
Mic92 merged 3 commits intoNixOS:masterfrom Jun 13, 2025
Merged
docker: use callPackage, parametrise the image build#13354Mic92 merged 3 commits intoNixOS:masterfrom
callPackage, parametrise the image build#13354Mic92 merged 3 commits intoNixOS:masterfrom
Conversation
053cf5c to
585b3e5
Compare
585b3e5 to
6eb4ee6
Compare
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/nix-official-docker-image-with-custom-ssl-certificate/65527/3 |
Contributor
Author
|
Thanks! |
drupol
added a commit
to drupol/nix
that referenced
this pull request
Jun 14, 2025
Follow-up of NixOS#13354
This was referenced Jul 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
At work, I needed to prepare a custom Nix Docker image to support our internal setup, which relies on a private GitLab instance secured with custom SSL certificates. My initial intention was to reuse the official
docker.nixrecipe and simply inject the custom certificates. Unfortunately, this was not straightforward, as the set of packages included in the image is not exposed as configurable parameters. It may be possible to override them in a more advanced way, but I have not found a clean solution yet.To work around this, I copied the
docker.nixfile into our project and modified it so that the packages injected into the final Docker image are now passed as parameters. This gives me full control over the contents of the image, including the ability to add our custom certificates and tools.This PR implements the changes that I made in my own
docker.nix, I guess it will be useful for some others.If this PR gets merged, then I'll update my project, remove the duplicated
docker.nixfile and use something similar to:The old image size is:
The new image size is:
There's a size gain of around 17%.
Context
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.