runCommand: set meta.position from the arguments

Currently all packages defined by a call to runCommand have their
meta.position pointing to trivial-builders.nix.

This change makes uses of runCommand that supply at least one attribute
in the second argument point to the right file.
This commit is contained in:
Naïm Favier 2023-06-13 18:58:37 +02:00
parent 69be6e9c72
commit 2e6013cf1b
No known key found for this signature in database
GPG key ID: 95AFCE8211908325

View file

@ -87,6 +87,10 @@ rec {
inherit buildCommand name;
passAsFile = [ "buildCommand" ]
++ (derivationArgs.passAsFile or []);
pos = let args = builtins.attrNames derivationArgs; in
if builtins.length args > 0
then builtins.unsafeGetAttrPos (builtins.head args) derivationArgs
else null;
}
// (lib.optionalAttrs runLocal {
preferLocalBuild = true;