I am playing around with containers and isolation of services, and I don’t really like the systemd containers due to them sharing the whole /nix
So, is it possible to somehow include the configutation in a docker image built with nix?
for example, an empy-basic docker image to run postfix would be something like:
{ pkgs ? import <nixpkgs> { config.packageOverrides = pkgs: { postfix = pkgs.postfix.override { withPgSQL = true; }; }; }
}:
pkgs.dockerTools.buildImage {
name = "postfix";
tag = "0.0.1";
contents = [
pkgs.postfix
pkgs.pfixtools
];
runAsRoot = ''
#!${pkgs.stdenv.shell}
${pkgs.dockerTools.shadowSetup}
# ...add user nobody and mail...
'';
config = {
Cmd = [ "${pkgs.postfix}/bin/postfix" "start" ];
};
}
But then I would have to mount volumes for the configuration.
I don’t mind mounting the configuration volumes instead of including the conf in the image, but how do I at least generate a conf that is not activated in my main system, so that I can maybe even have multiple instances of the same service with different confs?