diff options
Diffstat (limited to '')
-rw-r--r-- | nix-modules/docker-nixos-modules.nix | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/nix-modules/docker-nixos-modules.nix b/nix-modules/docker-nixos-modules.nix index 6ab2785..d14144d 100644 --- a/nix-modules/docker-nixos-modules.nix +++ b/nix-modules/docker-nixos-modules.nix @@ -1,5 +1,6 @@ { nixpkgsPath ? <nixpkgs> -, ociconfig +, dockerConfig +, nixConfig , name , ...}: @@ -40,7 +41,7 @@ let config = pkgs.lib.evalModules { modules = [ systemModule - ociconfig + nixConfig "${nixpkgsPath}/nixos/modules/misc/assertions.nix" ]; }; @@ -66,7 +67,7 @@ in pkgs.dockerTools.buildImage { # scripts that are started when the docker container runs. # Note that many features of the systemd.services config # are just ignored (e.g. no auto-restarts yet) - config = with pkgs.lib; with pkgs.lib.strings; { + config = with pkgs.lib; with pkgs.lib.strings; dockerConfig // { Cmd = pkgs.writeScript "main-entrypoint" ("#!${pkgs.dash.outPath}/bin/dash\n" + concatStrings (map (command: "${command}&\n") @@ -75,7 +76,13 @@ in pkgs.dockerTools.buildImage { (pkgs.writeScript "systemd-script-${name}" '' #!${pkgs.dash.outPath}/bin/dash - set -ue + set -xue + + # set up working directory + ${optionalString (service ? serviceConfig + && service.serviceConfig ? WorkingDirectory) '' + mkdir -p ${service.serviceConfig.WorkingDirectory} + cd ${service.serviceConfig.WorkingDirectory} ''} # run the prestart script ${optionalString (service ? preStart) '' @@ -84,12 +91,6 @@ in pkgs.dockerTools.buildImage { echo ${name}: starting ... - # set up working directory - ${optionalString (service ? serviceConfig - && service.serviceConfig ? WorkingDirectory) '' - mkdir -p ${service.serviceConfig.WorkingDirectory} - cd ${service.serviceConfig.WorkingDirectory} ''} - # set up environment variables ${optionalString (service ? environment) (concatStrings |