coriolis/nix/generic.nix

47 lines
1.4 KiB
Nix
Raw Normal View History

2021-08-29 12:36:58 -05:00
{ version, meta }:
2021-08-31 14:06:30 -05:00
let
meta' = meta;
f =
{ lib, stdenv, cmake, ninja, boost
, coriolis-bootstrap, python2Packages }:
let self =
{ name
, buildInputs ? []
, nativeBuildInputs ? []
, meta ? {}
, pythonImportsCheck
, continuation ? (x: x)
2021-09-01 12:18:05 -05:00
, postInstall ? ""
2021-08-31 14:06:30 -05:00
, ...
}@args':
let
args = builtins.removeAttrs args' (builtins.attrNames (builtins.functionArgs self));
boostWithPython = boost.override { enablePython = true; inherit (python2Packages) python; };
drv = stdenv.mkDerivation ({
pname = "coriolis-${name}";
2021-08-29 12:36:58 -05:00
2021-08-31 14:06:30 -05:00
buildInputs = [ python2Packages.python boostWithPython ] ++ buildInputs;
nativeBuildInputs = [
coriolis-bootstrap cmake ninja
python2Packages.pythonImportsCheckHook
] ++ nativeBuildInputs;
2021-08-29 12:36:58 -05:00
2021-09-01 12:18:05 -05:00
postInstall = postInstall + ''
2021-08-31 14:06:30 -05:00
export PYTHONPATH="$out/${python2Packages.python.sitePackages}:$PYTHONPATH"
'';
2021-08-29 12:36:58 -05:00
2021-09-01 12:18:05 -05:00
meta = meta' // meta;
2021-08-31 14:06:30 -05:00
inherit version pythonImportsCheck;
} // args);
in continuation (python2Packages.toPythonModule drv);
in self;
2021-08-29 12:36:58 -05:00
in
pkg:
{
__functionArgs = builtins.functionArgs f // builtins.functionArgs pkg;
__functor = self: args: f (builtins.intersectAttrs (builtins.functionArgs f) args) (pkg (builtins.intersectAttrs (builtins.functionArgs pkg) args));
}