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

xyzBuilder = channels: {..} should be replaced with exports = channels: { packages = ...; apps = ...;} #56

Closed
gytis-ivaskevicius opened this issue May 6, 2021 · 5 comments

Comments

@gytis-ivaskevicius
Copy link
Owner

I have no idea why fup does not implement just a single builder for everything - but now that I look at it - it's obvious that this would be quite a bit nicer way of handling things.

Possible issues:
Merging logic, it's always has been a pain. Tho if I recall correctly existing mergeAny function should just work out of the box

Expected outcome:

utils.lib.systemFlake {

  exports = channels: { 
    packages = { 
      inherit (channels.nixpkgs) hello coreutils neovim; 
    };
    
    apps = {
      neovim = mkApp {
        drv = channels.nixpkgs.neovim;
        exePath = "/bin/nvim";
      };   
    };

    checks = { 
      inherit (channels.nixpkgs) hello coreutils neovim; 
    };
    # ... etc ...
  };

}

@blaggacao @Pacman99 Looks good?

@blaggacao
Copy link
Collaborator

blaggacao commented May 6, 2021

Looks good, let's make it outputs = instead of exports =. The name "exports" was once proposed in the community for rhe non-package-dependent outputs (like modules & overlays)

@gytis-ivaskevicius
Copy link
Owner Author

I am definitely open to naming suggestions but i am not sure if outputs is the right word for it since i got a feeling that it will confuse users.
Basically, I'd rather avoid duplicating keyword outputs like so:

{
  # outputs #1
  outputs = { self, utils, nixpkgs}@inputs:
    utils.lib.systemFlake {
      inherit self inputs;
      
      # outputs #2
      outputs = channels: {
        # ...
      };
    };
}

@blaggacao
Copy link
Collaborator

Oh true, I havn't seen that coming. Let's stick with "exports", then.

@Pacman99
Copy link
Collaborator

Pacman99 commented May 6, 2021

Yeah I like it, the interface is much cleaner.
For devos's mkFlake - which we're trying to maintain as a wrapper of systemFlake - we could do something like this:

exports = channels: lib.mergeAny {
  packages = lib.builder.packagesFromOverlaysBuilderConstructor self.overlays channels;
} (otherArguments.exports channels);

Also we should probably rename packagesFromOverlaysBuilderConstructor, and maybe the overlays exporter too.

But we definitely need a different name for this than exports or outputs. I think enough people have read this proposal: NixOS/nix#3843 (comment), for that to be counter-productive. Even though that proposal might not be implemented, we would be directly opposing it by using the exports name that was suggested for non-system based outputs. And as you said, outputs is confusing because of the duplicate naming.

Random ideas:

  • systemOutputs
  • outputsBuilder
  • products

I like outputsBuilder because it has a direct connection to the previous naming.

@gytis-ivaskevicius
Copy link
Owner Author

Implemented in #59

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

3 participants