2021-09-23 23:40:35 +01:00
|
|
|
{ stdenv, lib, resholve, resholve-utils }:
|
2021-01-05 16:56:59 +00:00
|
|
|
|
|
|
|
{ pname
|
|
|
|
, src
|
|
|
|
, version
|
|
|
|
, passthru ? { }
|
|
|
|
, solutions
|
|
|
|
, ...
|
|
|
|
}@attrs:
|
|
|
|
let
|
|
|
|
inherit stdenv;
|
|
|
|
|
|
|
|
self = (stdenv.mkDerivation ((removeAttrs attrs [ "solutions" ])
|
|
|
|
// {
|
|
|
|
inherit pname version src;
|
2021-09-27 03:45:03 +01:00
|
|
|
buildInputs = (lib.optionals (builtins.hasAttr "buildInputs" attrs) attrs.buildInputs) ++ [ resholve ];
|
2021-01-05 16:56:59 +00:00
|
|
|
|
|
|
|
# enable below for verbose debug info if needed
|
|
|
|
# supports default python.logging levels
|
|
|
|
# LOGLEVEL="INFO";
|
2021-09-16 01:58:49 +01:00
|
|
|
/*
|
|
|
|
subshell/PS4/set -x and : command to output resholve envs
|
|
|
|
and invocation. Extra context makes it clearer what the
|
|
|
|
Nix API is doing, makes nix-shell debugging easier, etc.
|
|
|
|
*/
|
2021-01-05 16:56:59 +00:00
|
|
|
preFixup = ''
|
2021-09-16 01:58:49 +01:00
|
|
|
(
|
|
|
|
cd "$out"
|
|
|
|
PS4=$'\x1f'"\033[33m[resholve context]\033[0m "
|
|
|
|
set -x
|
|
|
|
: changing directory to $PWD
|
2021-09-23 23:40:35 +01:00
|
|
|
${builtins.concatStringsSep "\n" (resholve-utils.makeCommands solutions)}
|
2021-09-16 01:58:49 +01:00
|
|
|
)
|
2021-01-05 16:56:59 +00:00
|
|
|
'';
|
|
|
|
}));
|
|
|
|
in
|
|
|
|
lib.extendDerivation true passthru self
|