From 607d59fa9e6b557a4cb3b1f1b8472d7f555ae530 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Mon, 30 May 2022 10:11:09 -0700 Subject: [PATCH 1/2] check-meta.nix: make non-source consistent with documentation The documentation for `meta.sourceProvenance` in `doc/stdenv/meta.chapter.md` says: "the `meta.sourceProvenance` attribute should be a list containing one or more value..." Let's update check-meta.nix to require that `meta.sourceProvenance` is a list, as the documentation says, rather than a single element. Adding two extra keystrokes `[` and `]` when filling out this field is an insignificant burden for package authors, and being able to assume that the `meta.sourceProvenance` field is always a list greatly simplifies any code that acts on the value of this field. Since `meta.sourceProvenance` was just merged a few hours ago now is the easiest time to fix this: nobody is using the feature yet. --- pkgs/stdenv/generic/check-meta.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index 83557f995af3..da2e9b135f2e 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -93,14 +93,14 @@ let hasNonSourceProvenance = attrs: (attrs ? meta.sourceProvenance) && - isNonSource (lib.lists.toList attrs.meta.sourceProvenance); + isNonSource attrs.meta.sourceProvenance; # Allow granular checks to allow only some non-source-built packages # Example: # { pkgs, ... }: # { # allowNonSource = false; - # allowNonSourcePredicate = with pkgs.lib.lists; pkg: !(any (p: !p.isSource && p != lib.sourceTypes.binaryFirmware) (toList pkg.meta.sourceProvenance)); + # allowNonSourcePredicate = with pkgs.lib.lists; pkg: !(any (p: !p.isSource && p != lib.sourceTypes.binaryFirmware) pkg.meta.sourceProvenance); # } allowNonSourcePredicate = config.allowNonSourcePredicate or (x: false); @@ -269,7 +269,7 @@ let license = let licenseType = either (attrsOf anything) str; # TODO disallow `str` licenses, use a module in either licenseType (listOf licenseType); - sourceProvenance = either (listOf (attrsOf anything)) (attrsOf anything); + sourceProvenance = listOf lib.types.attrs; maintainers = listOf (attrsOf anything); # TODO use the maintainer type from lib/tests/maintainer-module.nix priority = int; platforms = listOf str; From 30bf7264ed899f91eda9fe79d9d4c2a976eac79e Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sun, 1 Jan 2023 18:48:04 -0800 Subject: [PATCH 2/2] fix packages with broken meta attributes --- pkgs/development/tools/database/apgdiff/default.nix | 2 +- pkgs/games/itch/default.nix | 2 +- pkgs/servers/onlyoffice-documentserver/default.nix | 2 +- pkgs/tools/admin/pulumi/default.nix | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/tools/database/apgdiff/default.nix b/pkgs/development/tools/database/apgdiff/default.nix index 016259f0bbb4..d96e3dbd99d0 100644 --- a/pkgs/development/tools/database/apgdiff/default.nix +++ b/pkgs/development/tools/database/apgdiff/default.nix @@ -29,7 +29,7 @@ stdenvNoCC.mkDerivation (finalAttrs: { homepage = "https://apgdiff.com"; license = licenses.mit; inherit (jre.meta) platforms; - sourceProvenance = sourceTypes.binaryBytecode; + sourceProvenance = [ sourceTypes.binaryBytecode ]; maintainers = [ maintainers.misterio77 ]; }; }) diff --git a/pkgs/games/itch/default.nix b/pkgs/games/itch/default.nix index 5776a1b43b2b..ca0a04a8492d 100644 --- a/pkgs/games/itch/default.nix +++ b/pkgs/games/itch/default.nix @@ -93,7 +93,7 @@ stdenvNoCC.mkDerivation rec { homepage = "https://github.com/itchio/itch"; license = licenses.mit; platforms = platforms.linux; - sourceProvenance = lib.sourceTypes.binaryBytecode; + sourceProvenance = [ lib.sourceTypes.binaryBytecode ]; maintainers = with maintainers; [ pasqui23 ]; }; } diff --git a/pkgs/servers/onlyoffice-documentserver/default.nix b/pkgs/servers/onlyoffice-documentserver/default.nix index 179257f67e37..51417fce2666 100644 --- a/pkgs/servers/onlyoffice-documentserver/default.nix +++ b/pkgs/servers/onlyoffice-documentserver/default.nix @@ -144,7 +144,7 @@ let homepage = "ONLYOFFICE Document Server is an online office suite comprising viewers and editors"; license = licenses.agpl3; platforms = [ "x86_64-linux" ]; - sourceProvenance = sourceTypes.binaryNativeCode; + sourceProvenance = [ sourceTypes.binaryNativeCode ]; maintainers = with maintainers; [ SuperSandro2000 ]; }; }; diff --git a/pkgs/tools/admin/pulumi/default.nix b/pkgs/tools/admin/pulumi/default.nix index ddfbfee6107f..e95a265ebd6f 100644 --- a/pkgs/tools/admin/pulumi/default.nix +++ b/pkgs/tools/admin/pulumi/default.nix @@ -109,7 +109,7 @@ buildGoModule rec { meta = with lib; { homepage = "https://pulumi.io/"; description = "Pulumi is a cloud development platform that makes creating cloud programs easy and productive"; - sourceProvenance = sourceTypes.fromSource; + sourceProvenance = [ sourceTypes.fromSource ]; license = licenses.asl20; platforms = platforms.unix; maintainers = with maintainers; [