arion/src/nix/eval-composition.nix

35 lines
875 B
Nix
Raw Normal View History

2019-02-13 10:04:17 +01:00
{ modules ? [], uid ? 0, pkgs, customNixRootPath ? "", }:
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;
composition = lib.evalModules {
check = true;
modules = builtinModules ++ modules;
};
builtinModules = [
argsModule
./docker-compose-module.nix
];
argsModule = {
_file = ./eval-composition.nix;
key = ./eval-composition.nix;
config._module.args.pkgs = lib.mkIf (pkgs != null) (lib.mkForce pkgs);
config._module.args.uid = uid;
2019-02-13 10:04:17 +01:00
config._module.args.customNixRootPath = customNixRootPath;
};
in
# Typically you need composition.config.build.dockerComposeYaml
composition