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

filterSource does not compose #1767

Open
ElvishJerricco opened this issue Dec 29, 2017 · 7 comments
Open

filterSource does not compose #1767

ElvishJerricco opened this issue Dec 29, 2017 · 7 comments
Assignees
Labels
language The Nix expression language; parser, interpreter, primops, evaluation, etc stale

Comments

@ElvishJerricco
Copy link
Contributor

This is pretty frustrating, as it means we can't create nix expressions that reliably filter sources provided by users, e.g. callCabal2nix. With the current implementations, a user cannot use filterSource to filter out e.g. dist/ before passing it to callCabal2nix unless they want to sacrifice the cabal file filtering. In this case, they can use overrideCabal after the fact to reset the source to their own filtered version, but I think this just demonstrates why filterSource really ought to compose.

@shlevy
Copy link
Member

shlevy commented Dec 29, 2017

Can't you do something like this in nixpkgs lib (obviously can be made easier to actually compose)?

composableFilterSource = f: s: { outPath = builtins.filterSource f s; inherit f; }

@shlevy
Copy link
Member

shlevy commented Dec 29, 2017

Hell, you can even have composableFilterSource check s to see if it's the result of a previous call and compose automatically.

@ElvishJerricco
Copy link
Contributor Author

@shlevy Yea I guess that works. Is it not desirable to fix this in builtins?

@shlevy
Copy link
Member

shlevy commented Jan 1, 2018

Why write C++ when you could write nix? 😀

@ElvishJerricco
Copy link
Contributor Author

Should we close this since we have cleanSourceWith in nixpkgs now?

@FRidh
Copy link
Member

FRidh commented May 3, 2019

cleanSourceWith cannot be used with builtins.path to prevent the basename of the source to leak in.
Related issue regarding filterSource #885.

@stale
Copy link

stale bot commented Feb 14, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Feb 14, 2021
@fricklerhandwerk fricklerhandwerk added the language The Nix expression language; parser, interpreter, primops, evaluation, etc label Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language The Nix expression language; parser, interpreter, primops, evaluation, etc stale
Projects
None yet
Development

No branches or pull requests

5 participants