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

name spacing overlay #15

Open
blaggacao opened this issue Dec 30, 2020 · 1 comment
Open

name spacing overlay #15

blaggacao opened this issue Dec 30, 2020 · 1 comment

Comments

@blaggacao
Copy link
Contributor

I can faintly see why package overlays are namespaced, even though simple flake does not reexport them in output.overlay.

Is it enough to encourage this as a convention vs enforcing it in the flake spec?

@zimbatm
Copy link
Member

zimbatm commented Jan 1, 2021

I agree, It would be good to enforce that convention. The main thing that has been holding me back is about what to do with the overlay function signature.
Let's say we have a wrapper like this:

name: overlay:
# The wrapping overlay
final: prev: {
  "${name}" = import overlay final prev;
}

Where name is the name of the flake, and overlay the location of the user overlay.

In that case, the user overlay can not use final to access its own attributes.

./overlay.nix

final: prev: {
  one = prev.runCommand "dummy" {} "echo dummy > $out";
  two = prev.mkDerivation {
    buildInputs = [ final.myflake.one ]; # <---
  };
}

Here the user has to know the name of the flake to access one.
We could recommend to use the rec keyword, but then the flake becomes un-overridable because it's bound to the local scope.

So the only option is to add a third argument and change the function signature. It also means that the overlay becomes unusable outside of flake-utils without a similar wrapper.

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

No branches or pull requests

2 participants