You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default value of the installPath argument to the buildDotnetModule function is $out/lib/${pname}. While the default value seems good, if you manually set it to $out/lib/${pname}, it will actually be interpreted as /build/source/$out/lib/${pname}, and the $out here is literal (it is a dir with a literal dollar sign in its name). This prevents setting anything relative to $out as installPath.
Steps To Reproduce
Steps to reproduce the behavior:
Take this hello world example (the postInstall line is for debugging purpose):
{fetchFromGitHub,buildDotnetModule,dotnetCorePackages,} :
buildDotnetModulerec{pname="hello-dotnet";version="0.0.10";src=fetchFromGitHub{owner="ofenloch";repo="hello-world";rev=version;hash="sha256-tjTeTxwBHIoaA41JplbEVgowiEgPslFVyDdEKkRjnY8=";};nugetDeps=./deps.json;projectFile="hello-world.csproj";dotnetInstallFlags=["-p:PublishSingleFile=false"];executables=["hello-world"];dotnet-runtime=dotnetCorePackages.runtime_6_0;postInstall="ls";installPath="$out/lib/${pname}";# comment out this}
If you comment out the installPath setting, it builds the package fine. The result structure is this:
However, if you set installPath, the result is like this:
$ tree resultresult└── bin └── hello-world2 directories, 1 file
The files that should be installed in $out/lib/${pname} are not there. You can see from the build log that it is actually installed in a directory literally called $out:
Running phase: installPhaseExecuting dotnetInstallHook hello-world -> /build/source/$out/lib/hello-dotnet/'$out' bin hello-world.sln obj test Dockerfile data lib scripts README.md hello-world.csproj nuget.config srcFinished dotnetInstallHook
Expected behavior
Setting installPath = "$out/lib/${pname}"; shouldn't change the result of the build.
Screenshots
Additional context
Metadata
Notify maintainers
@NixOS/dotnet
Note for maintainers: Please tag this issue in your PR.
local -r dotnetInstallPath="${dotnetInstallPath-$out/lib/$pname}"
Because installPath is passed as dotnetInstallPath environment variable and not directly as part of the sh script. Will using placeholder meet your needs?
You mean have a placeholder in the script that gets replaced with a string passed as an argument to buildDotnetModule? I think that would work. Would this raise security concerns as script injection is possible?
Describe the bug
The default value of the
installPath
argument to thebuildDotnetModule
function is$out/lib/${pname}
. While the default value seems good, if you manually set it to$out/lib/${pname}
, it will actually be interpreted as/build/source/$out/lib/${pname}
, and the$out
here is literal (it is a dir with a literal dollar sign in its name). This prevents setting anything relative to$out
asinstallPath
.Steps To Reproduce
Steps to reproduce the behavior:
Take this hello world example (the
postInstall
line is for debugging purpose):If you comment out the
installPath
setting, it builds the package fine. The result structure is this:However, if you set
installPath
, the result is like this:The files that should be installed in
$out/lib/${pname}
are not there. You can see from the build log that it is actually installed in a directory literally called$out
:Expected behavior
Setting
installPath = "$out/lib/${pname}";
shouldn't change the result of the build.Screenshots
Additional context
Metadata
Notify maintainers
@NixOS/dotnet
Note for maintainers: Please tag this issue in your PR.
Add a 👍 reaction to issues you find important.
The text was updated successfully, but these errors were encountered: