Add arion.build, arion.eval passthru functions
This commit is contained in:
parent
000b938893
commit
b94174f4d3
3 changed files with 34 additions and 3 deletions
21
arion.nix
21
arion.nix
|
@ -1,8 +1,9 @@
|
||||||
{ stdenv, lib
|
{ stdenv, lib
|
||||||
, coreutils, docker_compose, jq
|
, coreutils, docker_compose, jq
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
arion = stdenv.mkDerivation {
|
||||||
name = "arion";
|
name = "arion";
|
||||||
src = ./src;
|
src = ./src;
|
||||||
unpackPhase = "";
|
unpackPhase = "";
|
||||||
|
@ -18,4 +19,20 @@ stdenv.mkDerivation {
|
||||||
;
|
;
|
||||||
chmod a+x $out/bin/arion
|
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
|
||||||
|
|
|
@ -17,6 +17,8 @@ nix-env -iA arion -f .
|
||||||
TODO: describe: using nix-shell or in a script, building images as
|
TODO: describe: using nix-shell or in a script, building images as
|
||||||
part of nix-build, pinning, see also todomvc-nix.
|
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
|
== Mac or traditional Linux
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,8 +1,20 @@
|
||||||
{ pkgs ? import ../pkgs.nix }:
|
{ pkgs ? import ../pkgs.nix }:
|
||||||
let
|
let
|
||||||
inherit (pkgs) nixosTest recurseIntoAttrs;
|
inherit (pkgs) nixosTest recurseIntoAttrs arion;
|
||||||
in
|
in
|
||||||
|
|
||||||
recurseIntoAttrs {
|
recurseIntoAttrs {
|
||||||
|
|
||||||
test = nixosTest ./arion-test;
|
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 ];
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue