Does someone have an example for mkDockerImage from mach-nix?
I was able to get the basic image building but wasn’t successful with the overrides described here:
Edit:
To give a bit more context, with the following flake I can execute nix build and get a result which I can load with docker:
I just wasn’t able to get it to work at all with the provided example due to syntax errors.
I reckon it has to look different in a flake?
I can build the container when I use it without the override so that part works.
If I’m understanding right, the WIP in your post is the working version. From the location you linked to, I’m guessing you want to apply something like:
You are having syntax errors, but haven’t posted which errors or the source causing them, so I can only guess. You need to call override on the result of mkDockerImage (directly, or via the defaultPackage attr).
If you’re trying to do it directly, I think you’d need parentheses to group it properly… probably (I’m shooting from the hip…):
defaultPackage = (machNix.mkDockerImage {
requirements = builtins.readFile ./requirements/docker.txt;
_.pytest-cov.propagatedBuildInputs.mod = pySelf: self: oldVal: oldVal ++ [ pySelf.tomli ];
}).override (<should be able to parrot what the mach-nix doc says here>);
Thank you I got it working this way.
Sorry for not posting the full flake.nix and error I got.
I tried so many things that I really was just looking for a working example.
Next step is now to figure out how to use my run script from before