Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packaging: A few small improvements #12539

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packaging/components.nix
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ let
let
n = lib.length finalScope.patches;
in
if n == 0 then finalAttrs.version else finalAttrs.version + "+${toString n}";
if n == 0 then prevAttrs.version else prevAttrs.version + "+${toString n}";

# Clear what `derivation` can't/shouldn't serialize; see prevAttrs.workDir.
fileset = null;
Expand Down Expand Up @@ -256,7 +256,10 @@ in
inherit (finalScope) src patches;
}
);

resolvePath = p: finalScope.patchedSrc + "/${resolveRelPath p}";
filesetToSource = { root, fileset }: finalScope.resolvePath root;

appendPatches = appendPatches finalScope;
}
);
Expand Down
3 changes: 2 additions & 1 deletion src/libstore-tests/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

version,
filesetToSource,
resolvePath,
}:

let
Expand Down Expand Up @@ -79,7 +80,7 @@ mkMesonExecutable (finalAttrs: {
mkdir -p "$HOME"
''
+ ''
export _NIX_TEST_UNIT_DATA=${data + "/src/libstore-tests/data"}
export _NIX_TEST_UNIT_DATA=${resolvePath ./data/src/libstore-tests/data}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This worked in Nixpkgs, but not here. Might need a more explicit conditional, since we don't have the "source layer" to do the work for us in this case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or expose the "source layer" logic (or similar) as an independent function.

${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
''
Expand Down
3 changes: 2 additions & 1 deletion src/libutil-tests/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# Configuration Options

version,
resolvePath,
}:

let
Expand Down Expand Up @@ -61,7 +62,7 @@ mkMesonExecutable (finalAttrs: {
mkdir -p "$HOME"
''
+ ''
export _NIX_TEST_UNIT_DATA=${./data}
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
touch $out
''
Expand Down
Loading