The GitHub issue tracker has a report of this: .NET workloads fail to install · Issue #226107 · NixOS/nixpkgs · GitHub
here is nix shell with workaround for workloads and all android dependencies to build a sample dontet-android apps on nixos
It worked like a charm thanks
For folks finding this still, these overrides shouldn’t be necessary anymore. Using dotnetCorePackages.dotnet_X.sdk
will have the userlocal file in the right place to allow workload installs, and dotnetCorePackages.combinePackages
now links the userlocal files together as well:
{ pkgs }:
let
dotnet = (with pkgs.dotnetCorePackages; combinePackages [ dotnet_9.sdk dotnet_8.sdk ]);
in
pkgs.mkShell {
packages = [ dotnet ];
DOTNET_PATH = "${dotnet}/bin/dotnet";
DOTNET_ROOT = "${dotnet}/share/dotnet";
}
$ tree -l $DOTNET_ROOT/metadata
/nix/store/dcb537vbbfs8q3i1gfrc077wm910jkcf-dotnet-wrapped-combined/share/dotnet/metadata
└── workloads
├── 8.0.100 -> /nix/store/2zggnpahim3f5g0jl984vd3z8g4wsc73-dotnet-sdk-wrapped-8.0.114/share/dotnet/metadata/workloads/8.0.100
│ └── userlocal
└── 9.0.100 -> /nix/store/x8pdk25r5g5lv402s3ks03wq4lkjdj14-dotnet-sdk-wrapped-9.0.104/share/dotnet/metadata/workloads/9.0.100
└── userlocal
Nixos noob here, so might be an easy solution, but is there any way to decoratively install workloads?
anyone able to build/publish for android? Seems like some wokloads are missing in the nixpkgs dotnet version.
dotnet publish -f net9.0-android
Determining projects to restore...
All projects are up-to-date for restore.
/home/a/.dotnet/packs/Microsoft.Android.Sdk.Linux/35.0.61/targets/Microsoft.Android.Sdk.Aot.targets(25,5): error : Could not resolve SDK "Microsoft.NET.Runtime.MonoAOTCompiler.Task". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK.
/home/a/.dotnet/packs/Microsoft.Android.Sdk.Linux/35.0.61/targets/Microsoft.Android.Sdk.Aot.targets(25,5): error : SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" returned null.
/home/a/.dotnet/packs/Microsoft.Android.Sdk.Linux/35.0.61/targets/Microsoft.Android.Sdk.Aot.targets(25,5): error : The NuGetSdkResolver did not resolve this SDK because there was no version specified in the project or global.json.
/home/a/.dotnet/packs/Microsoft.Android.Sdk.Linux/35.0.61/targets/Microsoft.Android.Sdk.Aot.targets(25,33): error MSB4236: The SDK 'Microsoft.NET.Runtime.MonoAOTCompiler.Task' specified could not be found. [/home/a/projects/ContextMenuContainer/sample/APES.MAUI.Sample.csproj]
I had do to an FHS shell and install official SDK in order to achieve this. dotnet workload restore
from the fhs shell has a different set of workloads installed, including the missing one.