Skip to content

binlore: migrate override lore to package passthru#311811

Merged
thiagokokada merged 1 commit intoNixOS:stagingfrom
abathur:move_lore_overrides_to_passthru_staging
Jul 9, 2024
Merged

binlore: migrate override lore to package passthru#311811
thiagokokada merged 1 commit intoNixOS:stagingfrom
abathur:move_lore_overrides_to_passthru_staging

Conversation

@abathur
Copy link
Copy Markdown
Member

@abathur abathur commented May 15, 2024

Move lore overrides from binlore's source repo to the passthru of the target packages.

Note: to keep this from sprawling, see issue/previous PR below for more background/explanation:

Description of changes

  • Change how lore is merged/gathered:

    • Don't apply overrides from binlore's source.

    • Merge lore from $out/nix-support/<loretype> if it exists. Prepares binlore to collect lore generated by makeWrapper and friends.

      (Saving that for a follow-up, since it's a huge rebuild that makes this harder to test.)

    • Merge lore from <package>.binlore if it exists.

      (Happy to debate this name. Avoiding overrideLore since override is roughly a contract in nixpkgs.)

      Note: this has been changed from <package>.lore to <package>.binlore during review in order to mitigate confusion about what this is for. We might need to revisit this later if there are more lore providers (or we come up with better terms all around).

  • Add a utility function (binlore.synthesize) for ~synthesizing lore overrides. It rolls in a small Shell DSL for efficiently expressing overrides.

    (Happy to debate this name. Avoiding override since it's roughly a contract in nixpkgs.)

  • Reimplement most overrides using passthru.binlore = binlore.synthesize ...;. (I'm skipping some to pare them back to the set needed for nixpkgs and other public repos found via search.)

  • Expand resholve's passthru tests to better exercise the machinery.

I also have a branch with these changes based on a recent nixpkgs-unstable commit for easier testing. I generally test with nix-build -A resholve.tests.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label May 15, 2024
@ofborg ofborg bot requested a review from peterhoeg May 15, 2024 02:40
@ofborg ofborg bot added 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. labels May 15, 2024
@abathur
Copy link
Copy Markdown
Member Author

abathur commented May 15, 2024

@ofborg build resholve.tests

@abathur abathur requested review from K900 and roberth May 16, 2024 14:43
@abathur abathur force-pushed the move_lore_overrides_to_passthru_staging branch from 39250a3 to 5f51680 Compare May 18, 2024 21:02
@abathur
Copy link
Copy Markdown
Member Author

abathur commented May 18, 2024

@ofborg build resholve.tests

Copy link
Copy Markdown
Member

@roberth roberth left a comment

Choose a reason for hiding this comment

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

Raised minor concerns about documentation out-of-band; which @abathur will handle with infinisil / docs team, and async from this because staging PRs aren't particularly suited for iterating on docs and such.

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label May 29, 2024
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe move the comment inside so that it is closer when another lore items are added.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Is this on the right one? I'm not sure about moving it into the multiline string. I do like moving it closer, but I think I prefer the clearer legibility of it being a comment at the Nix level.

If we need to leave breadcrumbs for more executables, the comments can just be converted into a bulleted list?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder how compatible the different providers are. I can imagine GNU adding some extra flags. But we can probably handle that if this becomes a problem.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually, it might make some sense to inherit lore from the individual provider packages.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If by this you mean push them out into the packages where these all come from, I think I mostly agree.

I tried that first and ended up settling with implementing them here for a few expedience reasons, the foremost of which was not really being able to figure out how to splice it in to some of the macOS commands which are already fairly abstractly sliced out of source releases in a way that makes it hard to tell where and how to intervene and also be able to pair up lore overrides for the commands we care about.

Looking around at the implementation of diskdev_cmds in https://github.com/NixOS/nixpkgs/tree/master/pkgs/os-specific/darwin/apple-source-releases may clarify why I backed off of that (but I'm happy to do it if you can tell how we could accomplish it in a way that's as or more straightforward than what I have now?)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Having two different directory paths is weird. Would it be feasible to standardize on e.g. lib/binlore/$lore_type?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've waffled a little about where to put this.

Open to changing it (whether here or later) so I'll just think out loud for now:

  • I think if we moved it into a lib/ dir it'd be at risk of getting split off into a lib output when it's present (so I guess this is at least somewhat related to your other question about multiple outputs)?
  • When I was first thinking about doing this I didn't feel like it was my place to take up part of the nix-support namespace and imagined this actually belongs in some new namespace that doesn't imply it's just for nix/nixpkgs internal purposes. I opened an issue in the architecture repo last year but it didn't go anywhere and has been since transferred into this repo (Attaching more kinds of data to packages? #295029).
  • In make(Binary)Wrapper: record created wrappers #314937 I'm also tweaking the wrapper generators to output this data, and nix-support/ does feel more semantically appropriate from that perspective. Since this path is ~anticipating the other change, maybe it feels less out-of-place with that in frame?

@abathur
Copy link
Copy Markdown
Member Author

abathur commented Jun 28, 2024

@ofborg build resholve.tests

@thiagokokada
Copy link
Copy Markdown
Contributor

thiagokokada commented Jul 3, 2024

Looks good to me, but please fix the commit messages and rebase.

Lore overrides have been included with binlore's source up to now, but
this hasn't worked very well. (It isn't as easy to self-service for
people working in nixpkgs, and its use of partial pnames for matching
breaks down around some edge cases like version numbers appearing
early in perl pnames, or multiple packages having identical pnames.)
@abathur abathur force-pushed the move_lore_overrides_to_passthru_staging branch from a48c633 to 8f413d8 Compare July 4, 2024 16:15
@thiagokokada
Copy link
Copy Markdown
Contributor

Eval error.

@abathur
Copy link
Copy Markdown
Member Author

abathur commented Jul 4, 2024

Sounds like the problem this one's addressing:

@thiagokokada
Copy link
Copy Markdown
Contributor

@ofborg eval

1 similar comment
@thiagokokada
Copy link
Copy Markdown
Contributor

@ofborg eval

@thiagokokada
Copy link
Copy Markdown
Contributor

Eval is still failing. Maybe you need to rebase?

@abathur
Copy link
Copy Markdown
Member Author

abathur commented Jul 5, 2024

It looks like the periodic merges into staging have been failing, so I think it isn't in staging yet: https://github.com/NixOS/nixpkgs/actions/workflows/periodic-merge-6h.yml

@abathur
Copy link
Copy Markdown
Member Author

abathur commented Jul 6, 2024

@ofborg eval

@thiagokokada thiagokokada merged commit c62ade3 into NixOS:staging Jul 9, 2024
@abathur abathur deleted the move_lore_overrides_to_passthru_staging branch July 13, 2024 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants