Use the word 'composition' where applicable.

Also adds some documentation to celebrate that we can now - with ease - verbally
distinguish between composition-level modules and service-level modules.
This commit is contained in:
Robert Hensing 2019-01-20 12:22:28 +01:00
parent e7ad732bb3
commit 23ee554f2f
6 changed files with 32 additions and 10 deletions

View File

@ -140,7 +140,7 @@ do_eval() {
echo 1>&2 "Evaluating configuration..."
# read-write-mode is required for import from derivation
nix-instantiate \
"$nix_dir/eval-docker-compose.nix" \
"$nix_dir/eval-composition.nix" \
--eval \
--read-write-mode \
--json \
@ -155,7 +155,7 @@ do_eval() {
do_build() {
echo 1>&2 "Building configuration..."
nix-build \
"$nix_dir/eval-docker-compose.nix" \
"$nix_dir/eval-composition.nix" \
--out-link $docker_compose_yaml \
--argstr uid "$UID" \
--arg modules "$modules" \
@ -190,7 +190,7 @@ To bring the top-level Nixpkgs attributes into scope
EOF
cat >"$REPL_TMP" <<EOF
import $nix_dir/eval-docker-compose.nix {
import $nix_dir/eval-composition.nix {
uid = "$UID";
modules = $modules;
pkgs = $pkgs_argument;

View File

@ -1,3 +1,14 @@
/*
This is a composition-level module.
It defines the low-level options that are read by arion, like
- build.dockerComposeYaml
It declares options like
- docker-compose.services
*/
{ pkgs, uid, lib, config, ... }:
let

View File

@ -11,7 +11,7 @@ let
inherit (pkgs) lib;
composite = lib.evalModules {
composition = lib.evalModules {
check = true;
modules = builtinModules ++ modules;
};
@ -22,12 +22,12 @@ let
];
argsModule = {
_file = ./eval-docker-compose.nix;
key = ./eval-docker-compose.nix;
_file = ./eval-composition.nix;
key = ./eval-composition.nix;
config._module.args.pkgs = lib.mkIf (pkgs != null) (lib.mkForce pkgs);
config._module.args.uid = uid;
};
in
# Typically you need composite.config.build.dockerComposeYaml
composite
# Typically you need composition.config.build.dockerComposeYaml
composition

View File

@ -1,4 +1,9 @@
# Bind-mounts the host store
/*
This service-level bind mounts the host store into the container
when the service.useHostStore option is set to true.
*/
{ lib, config, ... }:
let
inherit (lib) mkOption types mkIf;

View File

@ -1,3 +1,9 @@
/*
This service-level module defines the build.service option, using
the user-facing options service.image, service.volumes, etc.
*/
{ pkgs, lib, config, ... }:
let

View File

@ -2,7 +2,7 @@
let
# To make some prebuilt derivations available in the vm
preEval = import ../../src/nix/eval-docker-compose.nix {
preEval = import ../../src/nix/eval-composition.nix {
modules = [ ../../examples/minimal/arion-compose.nix ];
inherit pkgs;
};