Allow overriding the source used for evaluation

This commit is contained in:
Robert Hensing 2020-10-10 21:27:48 +02:00
parent 525b598ce3
commit 3fb8782296
2 changed files with 10 additions and 9 deletions

View file

@ -9,4 +9,5 @@
import ./upstreamable/default.nix { import ./upstreamable/default.nix {
inherit pkgs lib haskell runCommand; inherit pkgs lib haskell runCommand;
haskellPackages = haskellPackages // { inherit arion-compose; }; haskellPackages = haskellPackages // { inherit arion-compose; };
evalSrc = ./..;
} }

View file

@ -1,8 +1,14 @@
args@
{ pkgs { pkgs
, lib , lib
, haskellPackages , haskellPackages
, haskell , haskell
, runCommand , runCommand
# Allow this expression file to be used more efficiently in situations where
# the sources are more readily available. Unpacking haskellPackages.arion-compose.src
# is not always the best choice for arion.eval.
, evalSrc ? null
}: }:
let let
@ -57,14 +63,8 @@ let
}; };
# Unpacked sources for evaluation by `eval` # Unpacked sources for evaluation by `eval`
srcUnpacked = pkgs.stdenv.mkDerivation { evalSrc' = args.evalSrc or (runCommand "arion-src" {}
name = "arion-src"; "mkdir $out; tar -C $out --strip-components=1 -xf ${arion-compose.src}");
inherit (arion-compose) src;
buildPhase = ''
cp -r $src $out
'';
installPhase = "";
};
/* Function for evaluating a composition /* Function for evaluating a composition
@ -73,7 +73,7 @@ let
Returns the module system's `config` and `options` variables. Returns the module system's `config` and `options` variables.
*/ */
eval = args@{...}: eval = args@{...}:
import (srcUnpacked + "/src/nix/eval-composition.nix") import (evalSrc' + "/src/nix/eval-composition.nix")
({ inherit pkgs; } // args); ({ inherit pkgs; } // args);
/* Function to derivation of the docker compose yaml file /* Function to derivation of the docker compose yaml file