From 2bcfeccb1aedb63cbd039ecf645cdebc30fd66fc Mon Sep 17 00:00:00 2001 From: zimbatm Date: Fri, 30 Aug 2024 11:07:18 +0200 Subject: [PATCH 1/2] stdenv: inherit meta from src.meta This opens the road to removing a lot of the repetition we see in the meta attributes. Most of the time, computed values such as the changelog URL are already known from the source fetcher. --- pkgs/stdenv/generic/check-meta.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index 502343f01fb32..27db9c42ddc3b 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -481,6 +481,7 @@ let ] ++ optional (hasOutput "man") "man"; } + // attrs.src.meta or { } // attrs.meta or { } # Fill `meta.position` to identify the source location of the package. // optionalAttrs (pos != null) { From 69c77332ed9985c992d5979fa0e3f90c94f61161 Mon Sep 17 00:00:00 2001 From: zimbatm Date: Fri, 30 Aug 2024 10:56:16 +0200 Subject: [PATCH 2/2] fetchFromGitHub: add computed meta.changelog Assume that the changelog is attached to the release. --- pkgs/build-support/fetchgithub/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/fetchgithub/default.nix b/pkgs/build-support/fetchgithub/default.nix index 4ce3c6e84d768..21ddeb2cbfc0d 100644 --- a/pkgs/build-support/fetchgithub/default.nix +++ b/pkgs/build-support/fetchgithub/default.nix @@ -17,7 +17,9 @@ let else builtins.unsafeGetAttrPos "rev" args ); baseUrl = "https://${githubBase}/${owner}/${repo}"; - newMeta = meta // { + newMeta = { + changelog = "${baseUrl}/releases/tag/${lib.removePrefix "refs/tags/" rev}"; + } // meta // { homepage = meta.homepage or baseUrl; } // lib.optionalAttrs (position != null) { # to indicate where derivation originates, similar to make-derivation.nix's mkDerivation