!bxVOQwsVoHhZcmNDGw:nixos.org

Nix + dotnet

116 Members
23 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
23 Oct 2025
@manuelbaerenz:matrix.orgManuel BärenzThanks, I'll try that!17:48:48
24 Oct 2025
@manuelbaerenz:matrix.orgManuel Bärenz

I can't quite figure out how to pass dependencies properly to the dll. Right now I have this:

...
  nupkg = dotnetCorePackages.fetchNupkg {
    inherit url version pname;
    sha256 = "sha256-Cq2t0TkGtmGpMcFrz9m0FJ14F4knfDoGaUFda9dijik=";
  };
in
stdenvNoCC.mkDerivation {
  inherit version pname;
  nativeBuildInputs = [
    makeWrapper
    # dotnetCorePackages.runtime_8_0
    dotnetCorePackages.sdk_8_0
  ];

  buildInputs = [
    dotnetCorePackages.runtime_8_0
    # dotnetCorePackages.sdk_8_0
  ];
  src = nupkg;

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin

    makeWrapper ${lib.getExe dotnetCorePackages.runtime_8_0-bin} $out/bin/${pname} \
          --add-flags "exec ${nupkg}/share/nuget/packages/${lib.toLower pname}/${version}/lib/net8.0/${pname}.dll"

    runHook postInstall
  '';

But it says:

A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/nix/store/yjszifiind26c7vpvyg4c3m49lgksv0z-somepkg-1.0.98/share/nuget/packages/somepkg/1.0.98/lib/net8.0/'
09:02:33
@manuelbaerenz:matrix.orgManuel Bärenz

I tried to shuffle sdk and runtime around, sometimes getting this error:

       > Running phase: configureNuget
       > The command could not be loaded, possibly because:
       >   * You intended to execute a .NET application:
       >       The application 'new' does not exist.
       >   * You intended to execute a .NET SDK command:
       >       No .NET SDKs were found.

But I'm assuming that's because nuget is getting confused depending on what's on the path

09:03:38
@manuelbaerenz:matrix.orgManuel Bärenz Maybe I shouldn't use fetchNupkg at all, and just use fetchUrl? 09:04:08
@manuelbaerenz:matrix.orgManuel Bärenz Anyways I would have assumed that libhostpolicy.so is in either the standard runtime or sdk, but I'm not passing dependencies in the right way 09:06:09
@corngood:corngood.comCorngoodAre you able to share the whole thing somewhere?11:58:16
@manuelbaerenz:matrix.orgManuel BärenzUnfortunately not, it's closed source :/ I'll try and work out a completely parametrized thing and share that12:55:08
@corngood:corngood.comCorngood I think the problem is that makeWrapper is moving the dotnet executable? 13:17:10
@corngood:corngood.comCorngoodcan you share the contents of the wrapper script?13:17:41
@manuelbaerenz:matrix.orgManuel BärenzI guess I'm a step further. Instead of trying to package the dlls directly, I'm now trying to package a simple web service for which I have the source code (including .csproj, NuGet.config and .sln) which depends on the dll13:17:43
@manuelbaerenz:matrix.orgManuel Bärenz* I guess I'm a step further. Instead of trying to package the dlls directly, I'm now trying to package a simple web service for which I have the source code (including .csproj, NuGet.config and .sln) which depends on the dlls13:17:46
@manuelbaerenz:matrix.orgManuel Bärenz(I needed to do this anyways at some point, but I thought it was smarter to leave out that part for later. Probably wasn't.)13:18:14

Show newer messages


Back to Room ListRoom Version: 9