DotNET: Difference between revisions
No edit summary |
Bring example more in line with Nixpkgs manual re: NuGet deps; don't suggest copying hash from failed build log |
||
| Line 18: | Line 18: | ||
repo = pname; | repo = pname; | ||
rev = "v${version}"; | rev = "v${version}"; | ||
hash = ""; # use e.g. `nix-prefetch-git` | |||
}; | }; | ||
| Line 24: | Line 24: | ||
dotnet-sdk = dotnetCorePackages.sdk_8_0; | dotnet-sdk = dotnetCorePackages.sdk_8_0; | ||
dotnet-runtime = dotnetCorePackages.runtime_8_0; | dotnet-runtime = dotnetCorePackages.runtime_8_0; | ||
nugetDeps = ./ | nugetDeps = ./deps.nix; # to generate, set to `""`, then `nix-build -A fetch-deps && ./result` | ||
meta = with lib; { | meta = with lib; { | ||
| Line 35: | Line 35: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
If the <code>fetch-deps</code> script isn't working for whatever reason, you can manually run <code>nuget-to-nix</code>: | |||
<syntaxhighlight lang="sh"> | |||
< | dotnet restore --packages=packageDir ./SomeProject.csproj | ||
nuget-to-nix packageDir >deps.nix | |||
rm -r packageDir | |||
</syntaxhighlight> | |||
Remember to build and run the <code>fetch-deps</code> script after NuGet packages are updated, or building the derivation will fail. | |||
== Building non-.NET Core packages == | == Building non-.NET Core packages == | ||