forked from rust-lang/cargo
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Question
In the nix/derivations/default.nix there are several src= blocks:
- Some use fixed paths to show that evaluation in principle works with fixed paths.
- Some use
relativeFilesetas a hack to make toSource work with a dynamicproject_rootargument. - And then there is the naive attempt to use
toSourcewithproject_rootwithout therelativeFilesethack, which fails...
Can we add a variant of lib.fileset.toSource (like lib.fileset.toSourceRelative) which:
- sees
rootas a baseDir and fileset = lib.fileset.unions [as a list of files relative to baseDir
Contrast: toSource sees root as a prefix which needs to be removed from all the entries in the given fileset.
project_root = /home/foo/myproject;
src = lib.fileset.toSourceRelative {
root = project_root;
fileset = lib.fileset.unions [
src/main.rs
src/build.rs
];
};In case you want to reproduce / experiment with this, I've added this repository with all variants:
https://github.com/qknight/nix-toSource-need-help?tab=readme-ov-file#question
Reactions are currently unavailable