Nix-pkgset: Cross-compilation aware (flake) package sets

Inspired by @jade’s Flakes aren’t real, @zimbatm’s 1000 instances of nixpkgs and my own struggles working with cross-compilation across flake input boundaries over the past year, I’ve prototyped a library called nix-pkgset.

Nix-pkgset is a lightweight library that helps package nix derivations into cross-compilation aware package sets by splicing packages in the same fashion as nixpkgs.

Design goals:

  • Adopt the packaging conventions of nixpkgs as much as possible (scopes, splicing, pkgs<build><host>, pkgsCross, etc.)
  • Avoid re-instantiating nixpkgs (use lib.makeScope instead of overlays)

WARNING: The library is still in proof of concept stage and the API is subject to change.

My understanding of nixpkgs scopes and splicing is still pretty limited so it’s possible that some of what I’m doing is insane. I would love to get some feedback on this, especially from nixpkgs maintainers responsible for scopes and splicing. My hope is to eventually have something similar upstreamed to nixpkgs.

Nix-pkgset: GitHub - szlend/nix-pkgset: Nix package set library

17 Likes

I love this direction. It presents a simpler interface to people and a potential to standardize how nixpkgs itself does this.

I’ve been playing and implementing a very similar set of ideas of leveraging makeScope, package sets, and reducing the cognitive load compared to overlays. I’d love to discuss if you have a chance.

Spoke about a similar idea to “lib.makePackageSet” at the end of this talk: FOSDEM 2024 - Units of composition: recipes, overlays, and packages I would encourage exposing the recipes prior to callPackage’ing them.

6 Likes

@tomberek Excellent talk! I wish I saw it earlier cause I really like the idea of composing recipes over packages. I also share your pain of naming some of these concepts.

I’ve been playing and implementing a very similar set of ideas of leveraging makeScope, package sets, and reducing the cognitive load compared to overlays. I’d love to discuss if you have a chance.

Would love to see what you’ve been up to and possibly join efforts. If you’d like to reach me, you can find my email in the nixpkgs maintainers list and I can also share other contact methods there. For any comments on nix-pkgset feel free to open issues on Github as well.

6 Likes