diff options
author | binarycat <binarycat@envs.net> | 2024-03-08 14:55:52 -0500 |
---|---|---|
committer | binarycat <binarycat@envs.net> | 2024-03-29 14:34:09 -0400 |
commit | 7e1443abbba99e9dac29ce2ad01c1c4e4fb66070 (patch) | |
tree | 1d8883d5ab723717fe76a9943c84df19ae1a6af9 /pkgs/stdenv/generic | |
parent | c07e41ca093c4bb3a1e4c1bb27acde018016c189 (diff) |
stdenv: add meta.repository field
Diffstat (limited to 'pkgs/stdenv/generic')
-rw-r--r-- | pkgs/stdenv/generic/check-meta.nix | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index 63c853e3dc317..eb4482be78945 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -296,6 +296,10 @@ let str ]; downloadPage = str; + repository = union [ + (listOf str) + str + ]; changelog = union [ (listOf str) str @@ -444,7 +448,29 @@ let let outputs = attrs.outputs or [ "out" ]; in - { + optionalAttrs (attrs ? src.meta.homepage || attrs ? srcs && isList attrs.srcs && any (src: src ? meta.homepage) attrs.srcs) { + # should point to an http-browsable source tree, if available. + # fetchers like fetchFromGitHub set it automatically. + # this could be handled a lot easier if we nulled it instead + # of having it be undefined, but that wouldn't match the + # other attributes. + repository = let + getSrcs = attrs: + if attrs ? src + then + [ attrs.src ] + else + lib.filter (src: src ? meta.homepage) attrs.srcs; + getHomePages = srcs: map (src: src.meta.homepage) srcs; + unlist = list: + if lib.length list == 1 + then + lib.elemAt list 0 + else + list; + in + unlist (getHomePages (getSrcs attrs)); + } // { # `name` derivation attribute includes cross-compilation cruft, # is under assert, and is sanitized. # Let's have a clean always accessible version here. |