In particular, I'd like to do a build with doCheck=true.
As a starting point, when I try this with my package of interest (singularity):
nix-build '<nixpkgs>' -E '(import <nixpkgs>{}).singularity'
The end goal would be something like:
nix-build -E '(import <nixpkgs>{}).singularity.override { doCheck=true; }' --pure
Both of these result in the error message:
error: expression does not evaluate to a derivation (or a set or list of those)
Of course, maybe there is an easier way to enable checkPhase as well, in which case, I guess this question might have two answers.
The error expression does not evaluate to a derivation (or a set or list of those) is caused by the '<nixpkgs>' in your command.
Getting rid of that gets past the error but your second example fails with anonymous function at /nix/store/-nixos-18.09pre142796.4b649a99d84/nixos/pkgs/applications/virtualization/singularity/default.nix:1:1 called with unexpected argument 'doCheck', at /nix/store/-nixos-18.09pre142796.4b649a99d84/nixos/lib/customisation.nix:74:12
That's because override allows you to amend the set which is passed to callPackage and that set does not have a doCheck attribute. doCheck is part of the set passed to mkDerivation and other equivalent functions. To change those attributes you need overrideAttrs:
nix-build -E '(import <nixpkgs>{}).singularity.overrideAttrs (oldAttrs: { doCheck=true; })' --pure
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With