2019-02-14 15:29:42 +08:00
|
|
|
# We need to pass the whole source to conda for the git variables to work.
|
|
|
|
# recipe must be a string pointing to a path within the source.
|
|
|
|
|
2019-02-15 18:17:34 +08:00
|
|
|
{ pkgs }:
|
2020-11-24 22:26:35 +08:00
|
|
|
{ name ? null
|
|
|
|
, src
|
|
|
|
, pname ? null
|
|
|
|
, version ? null
|
|
|
|
, recipe ? "fake-conda"
|
|
|
|
}:
|
2019-02-14 15:29:42 +08:00
|
|
|
|
2020-11-24 22:26:35 +08:00
|
|
|
# Check that either name is specified or both pname & version are specified.
|
|
|
|
assert (name == null) -> pname != null && version != null;
|
|
|
|
assert (name != null) -> pname == null && version == null;
|
2019-02-14 15:29:42 +08:00
|
|
|
let
|
2020-06-09 14:30:23 +08:00
|
|
|
condaBuilderEnv = import ./builder-env.nix { inherit pkgs; };
|
2020-11-24 22:26:35 +08:00
|
|
|
realName = if (name != null) then name else "${pname}-${version}";
|
2021-11-05 10:29:15 +08:00
|
|
|
in pkgs.stdenvNoCC.mkDerivation {
|
2020-11-24 22:26:35 +08:00
|
|
|
name = realName;
|
|
|
|
inherit src;
|
2019-02-14 15:29:42 +08:00
|
|
|
buildCommand =
|
|
|
|
''
|
|
|
|
HOME=`pwd`
|
|
|
|
mkdir $out
|
2020-06-09 15:12:37 +08:00
|
|
|
${condaBuilderEnv}/bin/conda-builder-env -c "conda build --no-anaconda-upload --no-test --output-folder $out $src/${recipe}"
|
2019-02-14 15:29:42 +08:00
|
|
|
|
|
|
|
mkdir -p $out/nix-support
|
2020-06-10 11:44:19 +08:00
|
|
|
echo file conda $out/*/*.tar.bz2 >> $out/nix-support/hydra-build-products
|
2019-02-14 15:29:42 +08:00
|
|
|
'';
|
|
|
|
}
|