2019-02-13 12:29:54 +01:00
|
|
|
{ modules ? [], uid ? "0", pkgs, hostNixStorePrefix ? "", }:
|
2018-12-17 19:08:38 +01:00
|
|
|
|
|
|
|
let _pkgs = pkgs;
|
|
|
|
in
|
|
|
|
let
|
|
|
|
pkgs = if builtins.typeOf _pkgs == "path"
|
|
|
|
then import _pkgs
|
|
|
|
else if builtins.typeOf _pkgs == "set"
|
|
|
|
then _pkgs
|
|
|
|
else builtins.abort "The pkgs argument must be an attribute set or a path to an attribute set.";
|
|
|
|
|
|
|
|
inherit (pkgs) lib;
|
|
|
|
|
2019-01-20 12:22:28 +01:00
|
|
|
composition = lib.evalModules {
|
2018-12-17 19:08:38 +01:00
|
|
|
check = true;
|
|
|
|
modules = builtinModules ++ modules;
|
|
|
|
};
|
|
|
|
|
|
|
|
builtinModules = [
|
|
|
|
argsModule
|
2019-02-13 11:33:19 +01:00
|
|
|
./modules/composition/docker-compose.nix
|
2019-02-13 12:29:54 +01:00
|
|
|
./modules/composition/host-environment.nix
|
2019-03-11 15:03:27 +01:00
|
|
|
./modules/composition/images.nix
|
2019-03-21 15:06:44 +01:00
|
|
|
./modules/composition/service-info.nix
|
2018-12-17 19:08:38 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
argsModule = {
|
2019-01-20 12:22:28 +01:00
|
|
|
_file = ./eval-composition.nix;
|
|
|
|
key = ./eval-composition.nix;
|
2018-12-17 19:08:38 +01:00
|
|
|
config._module.args.pkgs = lib.mkIf (pkgs != null) (lib.mkForce pkgs);
|
2019-02-13 12:29:54 +01:00
|
|
|
config.host.nixStorePrefix = hostNixStorePrefix;
|
|
|
|
config.host.uid = lib.toInt uid;
|
2018-12-17 19:08:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
2019-01-20 12:22:28 +01:00
|
|
|
# Typically you need composition.config.build.dockerComposeYaml
|
|
|
|
composition
|