Nix develop and checkPhase

So we’ve got a basic flake.nix and we’re moving to create a devShell. I’d like to be able to run the same checkPhase from nix develop that gets run for nix build. But it seems the checkPhase is implicitly disabled in the interactive environment (and is this intentional/documented) ?

my checkPhase is simple:

      checkPhase = "make -C ./build test";

And it successfully runs tests with nix build

My attempt to inspect it follows (and is there a better way to tshoot this)

$ set -x
$ checkPhase
+ checkPhase
+ runHook preCheck
+ local hookName=preCheck
+ shift
+ local 'hooksSlice=preCheckHooks[@]'
+ local hook
+ for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"}
+ _eval '_callImplicitHook 0 preCheck'
+ declare -F '_callImplicitHook 0 preCheck'
+ eval '_callImplicitHook 0 preCheck'
++ _callImplicitHook 0 preCheck
++ local def=0
++ local hookName=preCheck
++ declare -F preCheck
++ type -p preCheck
++ '[' -n '' ']'
++ return 0
+ return 0
+ [[ -z '' ]]
+ echo 'no Makefile or custom checkPhase, doing nothing'
no Makefile or custom checkPhase, doing nothing
+ runHook postCheck

How do you declare and run the checkphase?

IIRC nix develop --check should do, under the assumption that the project has been configured and maybe built before… Details of course depend on how the make file is written and what it expects…

In your case eval $checkPhase should run the checks. Just checkPhase only works for the default phases.