mirror of
https://github.com/nix-community/flakelight.git
synced 2025-02-13 07:59:24 +01:00
Allow check attributes to be functions that take pkgs
This commit is contained in:
parent
03cdbbabdf
commit
07e68ac51b
@ -241,14 +241,17 @@ let
|
|||||||
|
|
||||||
/* Makes cmd into a derivation for a flake's checks output. If it is not
|
/* Makes cmd into a derivation for a flake's checks output. If it is not
|
||||||
already a derivation, makes one that runs cmd on the flake source and
|
already a derivation, makes one that runs cmd on the flake source and
|
||||||
depends on its success.
|
depends on its success. Passes cmd pkgs if it is its a function.
|
||||||
*/
|
*/
|
||||||
mkCheck = pkgs: src: name: cmd:
|
mkCheck = pkgs: src: name: cmd:
|
||||||
if pkgs.lib.isDerivation cmd then cmd else
|
let
|
||||||
|
cmd' = callFn pkgs cmd;
|
||||||
|
in
|
||||||
|
if pkgs.lib.isDerivation cmd' then cmd' else
|
||||||
pkgs.runCommand "check-${name}" { } ''
|
pkgs.runCommand "check-${name}" { } ''
|
||||||
cp --no-preserve=mode -r ${src} src
|
cp --no-preserve=mode -r ${src} src
|
||||||
cd src
|
cd src
|
||||||
${cmd}
|
${cmd'}
|
||||||
touch $out
|
touch $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user