I’ve been struggling with this for awhile so I’ve decided that I could really use another set of eyes on this. I should add that this is my first time writing a wrapper derivation & passthru.test, so maybe I’m not doing something about this correctly or should go a completely different route instead.
We have a binary package for the OpenWatcom compiler suite (https://github.com/NixOS/nixpkgs/blob/7a01a0efeb82d5f114ed4fb181548f0b44a9b7fc/pkgs/development/compilers/open-watcom-bin/default.nix) because it’s a dependency for some virtualbox BIOS stuff. But nobody seems to have bothered with actually writing some nice wrapping for the suite? tl;dr you’re supposed to add hostPlatform-specific paths to PATH & set some some special envvars for the tools but it doesn’t have any of the required wrapping to work on its own, only when virtualbox detects it & sets everything up on its own.
I’m now writing a derivation for a fork of this suite with afew more features (open-watcom-v2: init at unstable 2021-11-30 by OPNA2608 · Pull Request #124000 · NixOS/nixpkgs · GitHub). Since this will need the same kind of wrapping I decided to try my hand at writing a wrapper function wrapWatcom
. Done, so far so good.
Next, since building the suite from source can take anywhere from 25 minutes to almost 3 hours depending on the settings, and writing the wrapper went so smooth, I figured that writing some simple tests would be a good idea. Here’s where my problems start:
From what I gathered, when writing a passthru.tests
entry, the test needs to explicitly reference the to-be-tested package. For this, the package needs to get itself as an argument. For example if we take a look at the hello
package, we see:
{ lib
, stdenv
, fetchurl
, testVersion
, *hello*
}:
stdenv.mkDerivation rec {
pname = "hello";
# ...
passthru.tests.version =
testVersion { package = *hello*; };
}
With a wrapper function that returns the package symlinkJoin
ed with the wrappers, I’m not sure how I’m supposed to get this to work. Maybe I’m just overthinking this and going another way would be much nicer & easier? Any help would be appreciated.