From 610408381746ee3e4c5b25f04b6db12c8128299b Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sun, 31 Dec 2023 11:40:48 +0000 Subject: [PATCH] build-support/fetchgithub: fix metadata eval for arguments without locations Without the change metadata evaluation fails on package like `zammad.src` where no fields are defined in `.nix `files: src = fetchFromGitHub (lib.importJSON ./source.json); There evaluation fails as: $ nix-instantiate --strict --eval --expr 'with import ./. {}; zammad.src.meta' error: 23| # to indicate where derivation originates, similar to make-derivation.nix's mkDerivation 24| position = "${position.file}:${toString position.line}"; | ^ 25| }; error: value is null while a set was expected After the change evaluation succeeds as: $ nix-instantiate --strict --eval --expr 'with import ./. {}; zammad.src.meta' { homepage = "https://github.com/zammad/zammad"; } --- pkgs/build-support/fetchgithub/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/fetchgithub/default.nix b/pkgs/build-support/fetchgithub/default.nix index a2498700b545..231c0fb622b9 100644 --- a/pkgs/build-support/fetchgithub/default.nix +++ b/pkgs/build-support/fetchgithub/default.nix @@ -19,7 +19,7 @@ let baseUrl = "https://${githubBase}/${owner}/${repo}"; newMeta = meta // { homepage = meta.homepage or baseUrl; - + } // lib.optionalAttrs (position != null) { # to indicate where derivation originates, similar to make-derivation.nix's mkDerivation position = "${position.file}:${toString position.line}"; };