writeTextFile: support pname and version

This commit is contained in:
jopejoe1
2026-02-18 09:49:38 +01:00
parent 0a756486cc
commit fce1d202a2

View File

@@ -117,7 +117,9 @@ rec {
in
finalAttrs:
{
name,
pname ? null,
version ? null,
name ? "${pname}-${version}",
text,
executable ? false,
destination ? "",
@@ -127,7 +129,7 @@ rec {
allowSubstitutes ? false,
preferLocalBuild ? true,
derivationArgs ? { },
pos ? builtins.unsafeGetAttrPos "name" args,
pos ? builtins.unsafeGetAttrPos (if pname != null then "pname" else "name") args,
}@args:
{
inherit
@@ -139,6 +141,10 @@ rec {
allowSubstitutes
preferLocalBuild
;
${if pname != null then "pname" else null} = pname;
${if version != null then "version" else null} = version;
destination =
assert
(destination != "" -> (hasRootPrefix destination && destination != "/"))