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

View file

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

View file

@ -2,7 +2,7 @@
let let
# To make some prebuilt derivations available in the vm # 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 ]; modules = [ ../../examples/minimal/arion-compose.nix ];
inherit pkgs; inherit pkgs;
}; };