forked from hercules-ci/arion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
arion.nix
38 lines (32 loc) · 903 Bytes
/
arion.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{ stdenv, lib
, coreutils, docker_compose, jq
}:
let
arion = stdenv.mkDerivation {
name = "arion";
src = ./src;
unpackPhase = "";
buildPhase = "";
installPhase = ''
mkdir -p $out/bin $out/share/arion
cp -a nix $out/share/arion/
cp -a arion-image $out/share/arion/
tar -czf $out/share/arion/arion-image/tarball.tar.gz -C arion-image/tarball .
substitute arion $out/bin/arion \
--subst-var-by path ${lib.makeBinPath [jq coreutils docker_compose]} \
--subst-var-by nix_dir $out/share/arion/nix \
;
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