Add arion.build, arion.eval passthru functions

This commit is contained in:
Robert Hensing 2019-03-26 14:06:50 +01:00
parent 000b938893
commit b94174f4d3
3 changed files with 34 additions and 3 deletions

View file

@ -1,8 +1,9 @@
{ stdenv, lib
, coreutils, docker_compose, jq
}:
let
stdenv.mkDerivation {
arion = stdenv.mkDerivation {
name = "arion";
src = ./src;
unpackPhase = "";
@ -18,4 +19,20 @@ stdenv.mkDerivation {
;
chmod a+x $out/bin/arion
'';
}
inherit passthru;
};
passthru = {
inherit eval build;
};
eval = import "${nix_dir}/eval-composition.nix";
build = args@{...}:
let composition = eval args;
in composition.config.build.dockerComposeYaml;
nix_dir = "${arion.outPath}/share/arion/nix";
in
arion

View file

@ -17,6 +17,8 @@ nix-env -iA arion -f .
TODO: describe: using nix-shell or in a script, building images as
part of nix-build, pinning, see also todomvc-nix.
TODO: exposed Nix functions: arion.build, arion.eval (a bit of IFD)
== Mac or traditional Linux
```

View file

@ -1,8 +1,20 @@
{ pkgs ? import ../pkgs.nix }:
let
inherit (pkgs) nixosTest recurseIntoAttrs;
inherit (pkgs) nixosTest recurseIntoAttrs arion;
in
recurseIntoAttrs {
test = nixosTest ./arion-test;
testBuild = arion.build {
# To be more accurately, you can do
# pkgs = import ../examples/minimal/arion-pkgs.nix;
# but this is quite efficient:
inherit pkgs;
modules = [ ../examples/minimal/arion-compose.nix ];
};
}