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

Source filtering #13

Closed
roberth opened this issue Jun 19, 2022 · 6 comments · Fixed by #276
Closed

Source filtering #13

roberth opened this issue Jun 19, 2022 · 6 comments · Fixed by #276

Comments

@roberth
Copy link
Collaborator

roberth commented Jun 19, 2022

Changes to unrelated files cause rebuilds, especially when the package is at the root of the repo, where non-package files have no other place to go.

Some solutions:
a. parse the cabal file in Nix: no experimental features required, but somewhat hard to get right, not future proof
b. or use ca-derivations with buildFromSdist or buildFromCabalSdist (NixOS/nixpkgs#174176)

@srid
Copy link
Owner

srid commented Aug 23, 2022

This can also do this, right? https://github.com/numtide/nix-filter

One would have manually set up the filters, however.

@roberth
Copy link
Collaborator Author

roberth commented Aug 23, 2022

Yeah, a basic solution is to make the src configurable for the package. (or packages #7 ) Users can then make use of any filtering library they like (lib, nix-filter, lib.sources combinators (a bit heavy as a flake though), ...).

@srid
Copy link
Owner

srid commented Mar 14, 2023

@roberth Is this still relevant?

@roberth
Copy link
Collaborator Author

roberth commented Mar 14, 2023

While technically the automated filtering can still be improved, I don't think it's significant or important enough.
It's best to put a haskell package in its own directory anyway, in which case it would seem unlikely that you'd have any significant amount of redundant files in such a directory.
And if you do, the usual source filtering can be done by setting packages.<name>.root = someLib.someFunction ./<name>. Is that documented?

@ParetoOptimalDev
Copy link

It's best to put a haskell package in its own directory anyway,

Does this mean something like don't let Module.hs and .docker be in the same directory?

@srid
Copy link
Owner

srid commented Mar 14, 2024

https://community.flake.parts/haskell-flake/local#source-filtering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants