!bxVOQwsVoHhZcmNDGw:nixos.org

Nix + dotnet

116 Members
23 Servers

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


SenderMessageTime
24 Oct 2025
@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
@manuelbaerenz:matrix.orgManuel Bärenz

Either way this is what I have right now:

{
  lib,
  dotnetCorePackages,
  makeWrapper,
  stdenvNoCC,
}:

let
  url = "${customNugetServer}(Id='${pname}',Version='${version}')/Download";
  dlls = dotnetCorePackages.fetchNupkg {
    inherit url version pname;
    sha256 = "sha256-xEPmYA0wkQrDBl82HDa6khIMltNUV5gdzayt6J1Lwpw=";
  };
in

with dotnetCorePackages;

buildDotnetModule {
  inherit pname version;
  src = webapi-src;

  buildInputs = [
    aspnetcore_9_0
    dlls
  ];

  dotnet-sdk = sdk_9_0;
  dotnet-runtime = runtime_9_0;
}

13:19:08
@manuelbaerenz:matrix.orgManuel Bärenz

And it gets me this far:

       > Running phase: configureNuget
       > The template "NuGet Config" was created successfully.
       >
       > Processing post-creation actions...
       >
       >
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > Executing dotnetConfigureHook
       >   Determining projects to restore...
       > /build/myAPI/myApi.csproj : error NU1101: Unable to find package Swashbuckle.AspNetCore. No packages exist with this id in source(s): _nix
13:20:12
@manuelbaerenz:matrix.orgManuel BärenzI would have thought that the package is part of aspnet, but either it isn't or I'm adding dependencies incorrectly13:20:42
@corngood:corngood.comCorngood You probably need to add nuget deps: nugetDeps = ./deps.json, and then run $(nix-build -A [pkg].fetch-deps) 13:23:59
@corngood:corngood.comCorngood Also putting aspnetcore_9_0 in buildInputs is unusual. You might just want to use it for dotnet-runtime. 13:26:10
@manuelbaerenz:matrix.orgManuel BärenzThat seems like some great piece of tooling. Right now it fails because of some proprietary dependency from our partner, but it did download a bunch of packages that seemed sensible13:32:39
@manuelbaerenz:matrix.orgManuel Bärenz

That seems like some great piece of tooling.

Sorry, that sounded sarcastic, I meant it seriously 😅 and thanks for your help so far

13:41:53
@manuelbaerenz:matrix.orgManuel BärenzCan I point the fetch-deps to a custom nuget server for some packages? Or at least pass it a NuGet.config that has the custom server configured?13:46:14
@manuelbaerenz:matrix.orgManuel Bärenz Ohh. I think if I name it properly (nuget.config instead of NuGet.config) it detects it automatically. 13:53:13
@corngood:corngood.comCorngoodDid you get a complete deps.json then?14:09:51

Show newer messages


Back to Room ListRoom Version: 9