Skip to content

stdenv: PURL fetcher introduction#454333

Open
h0nIg wants to merge 3 commits into
NixOS:masterfrom
h0nIg:purl-featureflag
Open

stdenv: PURL fetcher introduction#454333
h0nIg wants to merge 3 commits into
NixOS:masterfrom
h0nIg:purl-featureflag

Conversation

@h0nIg
Copy link
Copy Markdown
Contributor

@h0nIg h0nIg commented Oct 21, 2025

#421125 was merged and reverted later, because of regressions.

the background is described here: #421125 (comment)

@wolfgangwalther outlined the conditions and would like to enhance CI - over time. This is a continuous approach, which is in line with packages which have been found to be defunct and which need a fix. There may be more packages which have problems and we would like to prevent further fallout by a feature flag (prevents accessing + inheritance of drv.src / drv.srcs).

packages list: #453322 (comment)
list of real broken packages: #453322 (comment)
broken packages fix (deferrable PR: #457769)

With the old PR + the broken&platform check fix from #453291 + the feature flag, we enable maintainers to gather experience with PURL and set appropriate information (e.g. jq example, where fetchurl is used instead of fetchFromGithub)

nix-repl> xx = (import /my/nixpkgs {config={derivationPURLInheritance = true;};})
nix-repl> xx.python3Packages.boto3.meta.identifiers
{
  cpeParts = { ... };
  possibleCPEs = [ ... ];
  purl = "pkg:github/boto/boto3@1.40.18";
  purlParts = { ... };
  purls = [ ... ];
  v1 = { ... };
}

nix-repl> xx = (import /my/nixpkgs {})
nix-repl> xx.python3Packages.boto3.meta.identifiers
{
  cpeParts = { ... };
  possibleCPEs = [ ... ];
  purlParts = { ... };
  purls = [ ... ];
  v1 = { ... };
}

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@h0nIg h0nIg mentioned this pull request Oct 21, 2025
13 tasks
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 8.has: changelog This PR adds or changes release notes 6.topic: ruby A dynamic, open source programming language with a focus on simplicity and productivity. 6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) 6.topic: stdenv Standard environment 8.has: documentation This PR adds or changes documentation labels Oct 21, 2025
@h0nIg
Copy link
Copy Markdown
Contributor Author

h0nIg commented Oct 21, 2025

we need to squash all commits later, just for transparency let's keep the commits separated in order to understand what has been changed.

@h0nIg h0nIg marked this pull request as ready for review October 21, 2025 21:04
@h0nIg h0nIg marked this pull request as draft October 21, 2025 21:04
@h0nIg h0nIg marked this pull request as ready for review October 21, 2025 21:14
@nixpkgs-ci nixpkgs-ci Bot requested review from a team and infinisil March 8, 2026 21:34
@h0nIg h0nIg force-pushed the purl-featureflag branch 2 times, most recently from ca4dc6c to fed1a8d Compare March 8, 2026 21:47
@h0nIg
Copy link
Copy Markdown
Contributor Author

h0nIg commented Mar 8, 2026

(I have not digested the design decisions of that part of this PR, but it seems to me it might help to discuss those changes in isolation in their own PR, which we might be able to merge more quickly?)

as agreed in our call together with @raboof, i removed the inheritance and its feature flag

@h0nIg h0nIg changed the title stdenv: PURL fetcher introduction & feature flag stdenv: PURL fetcher introduction Mar 8, 2026
Comment thread pkgs/by-name/po/popt/package.nix Outdated
@raboof
Copy link
Copy Markdown
Member

raboof commented Mar 24, 2026

Since the transition to Github Actions we no longer have a CI which performs those checks so this needs to be done manually.

You can see the performance report in the PR summary page: https://github.com/NixOS/nixpkgs/actions/runs/18756048808?pr=454333#summary-53508514968

@wolfgangwalther that link is now dead. This PR was significantly simplified since - would it be possible to do another performance check? How would one do that?

@wolfgangwalther
Copy link
Copy Markdown
Contributor

would it be possible to do another performance check? How would one do that?

The performance data is available in every CI run. Just click your way to the details page of the CI jobs listed at the bottom of the PR and scroll your way through.

@raboof
Copy link
Copy Markdown
Member

raboof commented Mar 24, 2026

would it be possible to do another performance check? How would one do that?

The performance data is available in every CI run. Just click your way to the details page of the CI jobs listed at the bottom of the PR and scroll your way through.

Gotcha, for the 'Eval Summary' job, so https://github.com/NixOS/nixpkgs/actions/runs/22830597798?pr=454333 - so no noticeable change in speed, and a size increase of 0.05%-0.3%.

@h0nIg h0nIg force-pushed the purl-featureflag branch from fed1a8d to cd3ff71 Compare March 24, 2026 12:32
@nixpkgs-ci nixpkgs-ci Bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 24, 2026
@h0nIg h0nIg force-pushed the purl-featureflag branch from cd3ff71 to 3c32661 Compare March 24, 2026 13:01
Copy link
Copy Markdown
Member

@raboof raboof left a comment

Choose a reason for hiding this comment

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

Starting to look attractive! Some comments here and there.

Comment thread doc/stdenv/meta.chapter.md Outdated

### Package URL {#sec-meta-identifiers-purl}

[Package-URL](https://github.com/package-url/purl-spec) (PURL) is a specification to reliably identify and locate software packages. Through identification of software packages, additional (non-major) use cases are e.g. software license cross-verification via third party databases or initial vulnerability response management. Package URL's shall default to the mkDerivation.src, as the original consumed software package is the single point of truth.
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.

"Package URL's shall default to the mkDerivation.src" is no longer true 'in nixpkgs', but consuming tools are expected to make this association (at least for now). That seems like a good start to me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

src or srcs is implementation specific, the tool outside should not try to guess which one is the right approach. The interface is drv.meta.identifiers.purl and the implementation (the drv) should define the "where to search". I would like to keep this

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 am in agreement that we shouldn't push tools to trying to guess. Especially with tools that try to be efficient and can parallelize things, it makes the concurrency more difficult. Imo, it would be great if drv.meta.identifiers.purl defaults to drv.src.meta.identifiers.purl. I know people would be concerned with eval performance.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@RossComputerGuy it would be helpful that the SBOM team meets and agrees on an approach. CRA is due in september this year and this should get included in nixos 26.05 - at least the reduced fetcher part

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 get that, though I don't think this is something we can or should rush. I want PURL's just as much as anyone else does. However, we should do this properly. 26.05 is close but I am not super confident that it's possible at this point to get PURL's in.

I think my concern about drv.src.meta vs drv.meta is something that's big enough (considering that it impacts how the identifier should be discovered & consumed). I don't think it's a bad idea for the SBOM team to sync up. However, it is difficult to get people to sync up for something like this with these sorts of projects. I do think that there should be more of a discussion and thorough review before we attempt to merge this PR.

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 agree 'deeper' integration would likely be too ambitious for 26.05, but 'just' being able to populate the drv.meta seems feasible and already a helpful step in the right direction, doesn't it?

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.

Yes, as long as whatever is scanning nixpkgs doesn't have to figure out where the identifiers coming from and can just assume drv.meta like with CPE's, I think that is good. With these sorts of things, usually the first NixOS release doesn't have much use of it. Usually it gets flushed out over the following 2 or 3 releases.

The only blocker I see is not needing to figure out if it's drv.src or drv.srcs for the identifiers. Once that's solved, I don't have any objections to merging this PR.

Copy link
Copy Markdown
Contributor Author

@h0nIg h0nIg Apr 17, 2026

Choose a reason for hiding this comment

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

populate the drv.meta seems feasible and already a helpful step in the right direction, doesn't it?

@raboof the current PR is feasible. Please keep in mind that despite 95% of purls coming out of the box, it is required to manually maintain the remaining ones. This is something which may land 26.11, but no one is investing into something which is an open PR. My ask would be to merge this as a first step into the right direction, i can then work on contributing missing purl informations - since this takes time.

The only blocker I see is not needing to figure out if it's drv.src or drv.srcs for the identifiers. Once that's solved, I don't have any objections to merging this PR.

@RossComputerGuy blocking the full PR does not make sense IMHO, we may go and land this as a first milestone? Maybe even mark it as experimental, which gives time and others confidence that it may not be "stable"?

Comment thread doc/stdenv/meta.chapter.md
Comment thread doc/release-notes/rl-2605.section.md Outdated
Comment thread pkgs/top-level/config.nix Outdated
Comment thread doc/stdenv/meta.chapter.md Outdated
@nixpkgs-ci nixpkgs-ci Bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 24, 2026
@h0nIg h0nIg force-pushed the purl-featureflag branch 2 times, most recently from 0caddcd to c6035ec Compare March 25, 2026 16:37
@h0nIg h0nIg requested review from Eveeifyeve and raboof March 25, 2026 16:39
Copy link
Copy Markdown
Member

@Eveeifyeve Eveeifyeve left a comment

Choose a reason for hiding this comment

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

This looks to good to me, however I would like to see the purl parts be automatically defined by fetchers as well in a followup.

@oneingan oneingan requested review from oneingan and removed request for oneingan March 31, 2026 21:09
Comment thread doc/release-notes/rl-2605.section.md Outdated
Comment thread doc/stdenv/meta.chapter.md Outdated
Comment thread doc/stdenv/meta.chapter.md Outdated
Comment thread doc/stdenv/meta.chapter.md Outdated
Copy link
Copy Markdown
Member

@raboof raboof left a comment

Choose a reason for hiding this comment

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

I don't think this PR is perfect (it still doesn't quite make sense to me to split the purlParts rather than using a simple string, and I'm not sure the field name spec makes sense to me).

Nonetheless, having a place to record upstream purls is valuable, so I'm reluctantly approving this PR.

I think we should feel free to possibly refactor the structure later.

@h0nIg
Copy link
Copy Markdown
Contributor Author

h0nIg commented Apr 21, 2026

I think we should feel free to possibly refactor the structure later.

i think we should outline a list of possible enhancements, which will come later once this PR will get merged:

  • validation of purl scheme (which requires easy to parse spec to determine the validation schema)
  • manual enhancements / maintenance of data in case of fetchurl is used
  • further fetcher support getting added (and missing data getting maintained by local ecosystem experts) - but this does not require stdenv changes
  • ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: wait for branch‐off Waiting for the next Nixpkgs branch‐off 6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) 6.topic: ruby A dynamic, open source programming language with a focus on simplicity and productivity. 6.topic: stdenv Standard environment 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 3+ This PR was reviewed and approved by three or more persons.

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.