Skip to content

Commit 016c6e6

Browse files
committed
stdenv: introduce PURL feature flag, adjust docu & release notes
1 parent 30340ae commit 016c6e6

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

doc/release-notes/rl-2511.section.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@
252252

253253
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
254254

255-
- Metadata identifier purl (Package URL, https://github.com/package-url/purl-spec) has been added for fetchgit, fetchpypi and fetchFromGithub fetchers and mkDerivation has been adjusted to reuse these informations. Package URL's enables a reliable identification and locatization of software packages. Maintainers of derivations using the adopted fetchers should rely on the `drv.src.meta.identifiers.v1.purl` default identifier and can enhance their `drv.meta.identifiers.v1.purls` list once they would like to have additional identifiers. Maintainers using fetchurl for `drv.src` are urged to adopt their `drv.meta.identifiers.purlParts` for proper identification.
255+
- Metadata identifier purl (Package URL, https://github.com/package-url/purl-spec) has been added for fetchgit, fetchpypi and fetchFromGithub fetchers and mkDerivation has been adjusted to reuse these informations. Package URL's enables a reliable identification and locatization of software packages. Maintainers of derivations using the adopted fetchers should rely on the `drv.src.meta.identifiers.v1.purl` default identifier and can enhance their `drv.meta.identifiers.v1.purls` list once they would like to have additional identifiers. Maintainers using fetchurl for `drv.src` are urged to adopt their `drv.meta.identifiers.purlParts` for proper identification. Maintainers should check that their `drv.src` / `drv.srcs` either evaluate properly or that they throw an UnsupportedPlatform statement instead of a missing attribute error. The inheritance feature of `drv.src(s).meta.identifiers.purl(s)` for `drv.meta.identifiers.purl(s)` can get activated via `config.derivationPURLInheritance`.
256256

257257
- Added `rewriteURL` attribute to the nixpkgs `config`, to allow for rewriting the URLs downloaded by `fetchurl`.
258258
- Added `hashedMirrors` attribute to the nixpkgs `config`, to allow for customization of the hashed mirrors used by `fetchurl`.

doc/stdenv/meta.chapter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ A readonly attribute containing the list of guesses for what CPE for this packag
322322

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

325-
[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 default to the mkDerivation.src, as the original consumed software package is the single point of truth.
325+
[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. The default inheritance must get enabled explicitly through the nixpkgs config paramter `derivationPURLInheritance`.
326326

327327
#### `meta.identifiers.purlParts` {#var-meta-identifiers-purlParts}
328328

pkgs/stdenv/generic/check-meta.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,8 @@ let
713713
}
714714
) possibleCPEPartsFuns;
715715

716-
evaluateSrc = !isMarkedBroken attrs && !hasUnsupportedPlatform attrs;
716+
evaluateSrc =
717+
config.derivationPURLInheritance && !isMarkedBroken attrs && !hasUnsupportedPlatform attrs;
717718
purlParts = attrs.meta.identifiers.purlParts or { };
718719
purlPartsFormatted =
719720
if purlParts ? type && purlParts ? spec then "pkg:${purlParts.type}/${purlParts.spec}" else null;

pkgs/top-level/config.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,16 @@ let
333333
Please read https://www.visualstudio.com/license-terms/mt644918/ and enable this config if you accept.
334334
'';
335335
};
336+
337+
derivationPURLInheritance = mkOption {
338+
type = types.bool;
339+
default = false;
340+
description = ''
341+
Commonly PURL identifiers are based on the source of software. For example software distributed through github.com can get identified via pkg:github/org/repo.
342+
Most of the nixpkgs derivations have a drv.src or drv.srcs which properly evaluate, but there are some corner cases.
343+
This feature flag should get activated, once an SBOM tool is in use and where drv.meta.identifiers.purl(s) should inherit the informations from drv.src(s).meta.identifiers.purl(s).
344+
'';
345+
};
336346
};
337347

338348
in

0 commit comments

Comments
 (0)