mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-02 13:00:23 +00:00
writeTextFile: support pname and version
This commit is contained in:
@@ -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 != "/"))
|
||||
|
||||
Reference in New Issue
Block a user