Skip to content

Remove flake-utils input#171

Open
HigherOrderLogic wants to merge 1 commit into256lights:mainfrom
HigherOrderLogic:refactor/flake
Open

Remove flake-utils input#171
HigherOrderLogic wants to merge 1 commit into256lights:mainfrom
HigherOrderLogic:refactor/flake

Conversation

@HigherOrderLogic
Copy link
Contributor

Remove flake-utils from Flake inputs and replace with custom function that achieve similar result.

@zombiezen
Copy link
Member

Can you help me understand why having a custom function here is more desirable? flake-utils seems like it's pretty common to import. (Genuine curiosity here: I'm not plugged into the Nix ecosystem as much as I used to be.)

@HigherOrderLogic
Copy link
Contributor Author

The custom function here basically have the same functionality as the one flake-utils provides. However, it is easier to control which parts to apply the system attrs without having to use the merge operator (//) for attrs that dont need merging.

Also removing flake-utils would make downstream consumer's flake.lock cleaner, which I see as a win.

Copy link
Member

@zombiezen zombiezen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation. I'm always happy to eliminate a dependency, although I'm not sure that I fully grok the impact of a flake.lock dependency: they seem mostly lightweight.

I'm cautiously okay with this, but I'd like to address a couple maintenance concerns before going forward:

packages = forEachSystem (
system: pkgs:
let
buildGoModule = pkgs.buildGo125Module;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that this is separated from the Go up above and I'm worried it's going to get out of sync. Can we restructure this so that it is a top-level for-each like what's in main?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we restructure this so that it is a top-level for-each like what's in main?

Then aren't we just trying to re-create flake-utils, which isnt really ideal imo.

I'll try to unify the behavior here.


inherit (pkgs.lib.attrsets) optionalAttrs;
forEachSystem =
fn: lib.genAttrs lib.systems.flakeExposed (system: fn system nixpkgs.legacyPackages.${system});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per nixpkgs:

This attribute is considered experimental and is subject to change.

I also don't really want to expand to that potential set to what nixpkgs supports: zb is very OS-dependent, and so the exact set of targets is important. Let's use an explicit list of systems.

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 this pull request may close these issues.

2 participants