Commit 88f1cafa authored by Profpatsch's avatar Profpatsch

containers: different evaluations for deployment and dev

Dev containers and deployment differ in the activated options, e.g. postgres dev
containers have mock data enabled.
parent 9f65c474
let
lib = import <nixpkgs/lib>;
# evaluate the deployment config
eval = import <nixpkgs/nixos> {
configuration = { ... }: {
# the base config
baseConfig = { ... }: {
# import all module definitions
imports = [
./modules/docker-images.nix
./postgres.nix
......@@ -10,6 +11,7 @@ let
];
config = {
# enable docker image generation
org.techcultivation.deploy.database.dockerImage.enable = true;
org.techcultivation.deploy.queue.dockerImage.enable = true;
......@@ -27,12 +29,29 @@ let
})];
};
};
# final configs for dev & deployment
deployConfig = baseConfig;
devConfig = {
imports = [ baseConfig ];
config = {
org.techcultivation.deploy.database.dockerImage.insertMockData = true;
};
};
inherit (eval.config._module.args) pkgs;
# eval a config
doEval = config: import <nixpkgs/nixos> {
configuration = config;
};
# evaluated configs
evalDeploy = doEval deployConfig;
evalDev = doEval devConfig;
inherit (evalDeploy.config._module.args) pkgs;
# TODO tmp
sanghaPostgresTemplate = eval.config.passthru;
sanghaPostgresTemplate = evalDev.config.passthru;
# make docker image suitable for download from Hydra
buildHydraDockerImage = image: pkgs.runCommand "sangha-docker-image" {
......@@ -53,8 +72,9 @@ in {
inherit sanghaPostgresTemplate;
};
downloads.dockerImages.sangha = lib.mapAttrs (lib.const buildHydraDockerImage) {
postgres = eval.config.generated.dockerImages.sanghaPostgres;
rabbitmq = eval.config.generated.dockerImages.sanghaRabbitmq;
postgres = evalDeploy.config.generated.dockerImages.sanghaPostgres;
postgresDev = evalDev.config.generated.dockerImages.sanghaPostgres;
rabbitmq = evalDeploy.config.generated.dockerImages.sanghaRabbitmq;
};
tests = eval.config.tests;
tests = evalDeploy.config.tests;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment