2021-09-28 08:13:01 +00:00
|
|
|
{ stdenv, lib, resholve, resholve-utils }:
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
{ pname
|
|
|
|
, src
|
|
|
|
, version
|
|
|
|
, passthru ? { }
|
|
|
|
, solutions
|
|
|
|
, ...
|
|
|
|
}@attrs:
|
|
|
|
let
|
|
|
|
inherit stdenv;
|
|
|
|
|
|
|
|
self = (stdenv.mkDerivation ((removeAttrs attrs [ "solutions" ])
|
|
|
|
// {
|
|
|
|
inherit pname version src;
|
2021-09-28 08:13:01 +00:00
|
|
|
buildInputs = (lib.optionals (builtins.hasAttr "buildInputs" attrs) attrs.buildInputs) ++ [ resholve ];
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
# enable below for verbose debug info if needed
|
|
|
|
# supports default python.logging levels
|
|
|
|
# LOGLEVEL="INFO";
|
2021-09-26 12:46:18 +00: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 17:05:55 +00:00
|
|
|
preFixup = ''
|
2021-09-26 12:46:18 +00:00
|
|
|
(
|
|
|
|
cd "$out"
|
|
|
|
PS4=$'\x1f'"\033[33m[resholve context]\033[0m "
|
|
|
|
set -x
|
|
|
|
: changing directory to $PWD
|
2021-09-28 08:13:01 +00:00
|
|
|
${builtins.concatStringsSep "\n" (resholve-utils.makeCommands solutions)}
|
2021-09-26 12:46:18 +00:00
|
|
|
)
|
2021-01-05 17:05:55 +00:00
|
|
|
'';
|
|
|
|
}));
|
|
|
|
in
|
|
|
|
lib.extendDerivation true passthru self
|