1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-18 10:30:23 -04:00

Add resolvePath, filesetToSource indirections for Nixpkgs

This commit is contained in:
Robert Hensing 2024-07-06 17:49:58 +02:00
parent 0729f0a113
commit bea54d116e
5 changed files with 18 additions and 5 deletions

View file

@ -14,9 +14,16 @@
let
inherit (pkgs) lib;
root = ../.;
# Nixpkgs implements this by returning a subpath into the fetched Nix sources.
resolvePath = p: p;
# Indirection for Nixpkgs to override when package.nix files are vendored
filesetToSource = lib.fileset.toSource;
localSourceLayer = finalAttrs: prevAttrs:
let
root = ../.;
workDirPath =
# Ideally we'd pick finalAttrs.workDir, but for now `mkDerivation` has
# the requirement that everything except passthru and meta must be
@ -104,5 +111,7 @@ scope: {
meta.platforms = lib.platforms.all;
});
inherit resolvePath filesetToSource;
mkMesonDerivation = f: stdenv.mkDerivation (lib.extends localSourceLayer f);
}

View file

@ -18,6 +18,7 @@
# Configuration Options
, version
, resolvePath
}:
let
@ -84,7 +85,7 @@ mkMesonDerivation (finalAttrs: {
run = runCommand "${finalAttrs.pname}-run" {
} ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
export _NIX_TEST_UNIT_DATA=${./data}
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
nix-expr-tests
touch $out
'';

View file

@ -17,6 +17,7 @@
# Configuration Options
, version
, resolvePath
}:
let
@ -82,7 +83,7 @@ mkMesonDerivation (finalAttrs: {
run = runCommand "${finalAttrs.pname}-run" {
} ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
export _NIX_TEST_UNIT_DATA=${./data}
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
nix-fetchers-tests
touch $out
'';

View file

@ -17,6 +17,7 @@
# Configuration Options
, version
, resolvePath
}:
let
@ -82,7 +83,7 @@ mkMesonDerivation (finalAttrs: {
run = runCommand "${finalAttrs.pname}-run" {
} ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
export _NIX_TEST_UNIT_DATA=${./data}
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
nix-flake-tests
touch $out
'';

View file

@ -19,6 +19,7 @@
# Configuration Options
, version
, filesetToSource
}:
let
@ -86,7 +87,7 @@ mkMesonDerivation (finalAttrs: {
run = let
# Some data is shared with the functional tests: they create it,
# we consume it.
data = lib.fileset.toSource {
data = filesetToSource {
root = ../..;
fileset = lib.fileset.unions [
./data