cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
4.13k stars 312 forks source link

Package Sets #61

Open domenkozar opened 1 year ago

domenkozar commented 1 year ago

It would be useful to be able to expose a package set in an environment, so that environments that import it can use a subset.

This would allow us to provide for example a set of all $lang tooling.

domenkozar commented 1 year ago

I was thinking about this a bit also in the scope of #154

inputs:
  nixpkgs:
    url: nixpkgs
  xxx:
    url: github:myorg/myrepo
overlays:
  - nixpkgs
  - otherinput
pkgsets:
  pkgs:
    input: nixpkgs
    unfree: true
  mypkgs:
    input: xxx

Where they could then be automatically wired from flakes using myflake.packages.${builtins.currentSystem} or exposedPackages attribute in devenv.nix.

bobvanderlinden commented 1 year ago

Ah that example explains what you're after with this issue :+1: Makes a lot of sense.

I do think that overlays should be used (or possible to be used optionally) inside each pkgset. Maybe merging global overlays with the pkgset specific ones.

unfree: true is not an option that nixpkgs supports. It is allowUnfree. Are these options sneakily renamed to allow{option}?

What will it do in the background? import ${input} { config = { ... }; }, because I think most flakes do not support this(?). Might not be a problem if pkgsets are mostly geared toward using nixpkgs.

Alternatively the packages.{system} could be used, but that doesn't allow overlays :sweat_smile:.

Meh, flakes give a bit more structure/standardization, but it's still not as far as is sometimes needed.

domenkozar commented 1 year ago

The other option would be to overload the inputs:

inputs:
  nixpkgs:
    url: nixpkgs
    allowUnfree: true
  xxx:
    url: github:myorg/myrepo
    includeOverlays: true
    packages: mypkgs

And then devenv.nix option could be called output.packages.

domenkozar commented 1 year ago

A bit more explicit:

inputs:
  nixpkgs:
    url: nixpkgs
    args:
      allowUnfree: true
  xxx:
    url: github:myorg/myrepo
    outputs:
      overlays: true
      packages: mypkgs