coriolis/nix/generic.nix

48 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
2021-10-26 16:10:09 -05:00
, coriolis-bootstrap, python3Packages }:
2021-08-31 14:06:30 -05:00
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));
2021-10-26 16:10:09 -05:00
boostWithPython = boost.override { enablePython = true; inherit (python3Packages) python; };
2021-08-31 14:06:30 -05:00
drv = stdenv.mkDerivation ({
pname = "coriolis-${name}";
2021-08-29 12:36:58 -05:00
2021-10-26 16:10:09 -05:00
buildInputs = [ python3Packages.python boostWithPython ] ++ buildInputs;
2021-08-31 14:06:30 -05:00
nativeBuildInputs = [
coriolis-bootstrap cmake ninja
2021-10-26 16:10:09 -05:00
python3Packages.pythonImportsCheckHook
2021-08-31 14:06:30 -05:00
] ++ nativeBuildInputs;
2021-08-29 12:36:58 -05:00
2021-09-01 12:18:05 -05:00
postInstall = postInstall + ''
2021-10-26 16:10:09 -05:00
export PYTHONPATH="$out/${python3Packages.python.sitePackages}:$PYTHONPATH"
2021-08-31 14:06:30 -05:00
'';
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
2021-10-26 17:11:04 -05:00
# FIXME: inherit pythonImportsCheck;
inherit version;
2021-08-31 14:06:30 -05:00
} // args);
2021-10-26 16:10:09 -05:00
in continuation (python3Packages.toPythonModule drv);
2021-08-31 14:06:30 -05:00
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));
}