Skip to content

dotnet: fix problems with --runtime flags #432571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 20, 2025

Conversation

corngood
Copy link
Contributor

@corngood corngood commented Aug 10, 2025

Cc: @NixOS/dotnet

Fixes: #283430

This is a subtly breaking change as shown in ArchiSteamFarm.

Projects that use a directory in projectFile will now be correctly identify if they are building a solution and omit the runtime flags. If the project changes dotnetProjectFile between phases (like ArchiSteamFarm) this can cause a mismatch in the build paths.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@corngood corngood changed the title Dotnet runtime flags dotnet: fix problems with --runtime flags Aug 10, 2025
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 6.topic: dotnet Language: .NET labels Aug 10, 2025
@corngood
Copy link
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 432571
Commit: e43fd5756982204ebab14f7aa77362209bb75124


x86_64-linux

⏩ 10 packages marked as broken and skipped:
  • am2rlauncher
  • eddie
  • eventstore
  • msbuild
  • networkminer
  • openra
  • roslyn
  • spotlight-downloader
  • tshock
  • wasabibackend
✅ 132 packages built:
  • ArchiSteamFarm
  • alttpr-opentracker
  • audiothekar
  • autoPatchcilHook (dotnetCorePackages.autoPatchcilHook)
  • avalonia-ilspy
  • azure-artifacts-credprovider
  • azure-functions-core-tools
  • bicep
  • bicep-lsp
  • blendfarm
  • bms-to-osu
  • boogie (dotnetPackages.Boogie)
  • bs-manager
  • btcpayserver
  • btcpayserver-altcoins
  • cavalier
  • celeste64
  • certdump
  • clps2c-compiler
  • csharp-ls
  • csharpier
  • csharprepl
  • cyclonedx-cli
  • dafny
  • denaro
  • dependency-track
  • depotdownloader
  • discordchatexporter-cli
  • discordchatexporter-desktop
  • docfx
  • dotnet-ef
  • dotnet-outdated
  • dotnet-repl
  • fable
  • famistudio
  • fantomas
  • formula
  • fsautocomplete
  • galaxy-buds-client
  • garnet
  • gh-gei
  • git-credential-manager
  • github-runner
  • gitversion
  • grayjay
  • hedgemodmanager
  • ilspycmd
  • imewlconverter
  • inklecate
  • jackett
  • jellyfin
  • juniper
  • kavita
  • knossosnet
  • kryptor
  • libation
  • liborbispkg-pkgtool
  • lubelogger
  • lumafly
  • marksman
  • mesen
  • min-ed-launcher
  • mqttmultimeter
  • msbuild-structured-log-viewer
  • msgraph-cli
  • n-m3u8dl-re
  • naps2
  • nbxplorer
  • netcoredbg
  • nexusmods-app
  • nexusmods-app-unfree
  • obj2tiles
  • olympus
  • olympus-unwrapped
  • omnisharp-roslyn
  • opentabletdriver
  • openutau
  • osu-lazer
  • pablodraw
  • patchcil
  • pbm
  • pinta
  • prowlarr
  • ps2patchelf
  • ps3-disc-dumper
  • pupdate
  • qbittorrent-cli
  • radarr
  • recyclarr
  • retrospy
  • rockstarlang
  • roslyn-ls
  • ryubing
  • rzls
  • scarab
  • seq-cli
  • skeditor
  • slskd
  • smtp4dev
  • sonarr
  • sourcegit
  • space-station-14-launcher
  • tagger
  • technitium-dns-server
  • technitium-dns-server-library
  • tests.dotnet.final-attrs.check-output
  • tests.dotnet.final-attrs.output-matches-const
  • tests.dotnet.final-attrs.override-has-no-effect
  • tests.dotnet.final-attrs.override-modifies-output
  • tests.dotnet.nuget-deps.derivation
  • tests.dotnet.nuget-deps.json-file
  • tests.dotnet.nuget-deps.list
  • tests.dotnet.nuget-deps.nix-file
  • tests.dotnet.nuget-deps.null
  • tests.dotnet.project-references
  • tests.dotnet.structured-attrs.check-output
  • tests.dotnet.structured-attrs.no-structured-attrs
  • tests.dotnet.use-dotnet-from-env.fallback
  • tests.dotnet.use-dotnet-from-env.use-dotnet-path-env
  • tests.dotnet.use-dotnet-from-env.use-dotnet-root-env
  • tests.dotnet.use-dotnet-from-env.without-fallback
  • tkmm
  • tone
  • torrentstream
  • upgrade-assistant
  • v2rayn
  • vrcadvert
  • vrcx
  • vscode-extensions.ms-azuretools.vscode-bicep
  • wiseunpacker
  • xivlauncher
  • yafc-ce

@corngood corngood marked this pull request as ready for review August 10, 2025 19:57
@nix-owners nix-owners bot requested a review from SuperSandro2000 August 10, 2025 19:58
@@ -26,7 +26,15 @@ buildDotnetModule rec {

nugetDeps = ./deps.json;

projectFile = "ArchiSteamFarm.sln";
projectFile = [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative to this would be to add a flag that allows the solution detection to be overridden so that we can disable --runtime for all phases.

I could also rewrite this to avoid repeating the names of the plugins if that's preferable.

@nixpkgs-ci nixpkgs-ci bot added 9.needs: reviewer This PR currently has no reviewers requested and needs attention. and removed 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels Aug 10, 2025
@@ -26,7 +26,15 @@ buildDotnetModule rec {

nugetDeps = ./deps.json;

projectFile = "ArchiSteamFarm.sln";
projectFile = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
projectFile = [
projectFiles = [

lists usually have a s suffix

Copy link
Contributor Author

@corngood corngood Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately buildDotnetModule doesn't currently allow that. It probably should just be renamed to projectFiles and testProjectFiles.

@SuperSandro2000
Copy link
Member

I would solve the duplication like:

diff --git a/pkgs/applications/misc/ArchiSteamFarm/default.nix b/pkgs/applications/misc/ArchiSteamFarm/default.nix
index 385747878758..432c5530b7fb 100644
--- a/pkgs/applications/misc/ArchiSteamFarm/default.nix
+++ b/pkgs/applications/misc/ArchiSteamFarm/default.nix
@@ -9,6 +9,14 @@
   callPackage,
 }:
 
+let
+  plugins = [
+    "ArchiSteamFarm.OfficialPlugins.ItemsMatcher"
+    "ArchiSteamFarm.OfficialPlugins.MobileAuthenticator"
+    "ArchiSteamFarm.OfficialPlugins.Monitoring"
+    "ArchiSteamFarm.OfficialPlugins.SteamTokenDumper"
+  ];
+in
 buildDotnetModule rec {
   pname = "ArchiSteamFarm";
   # nixpkgs-update: no auto update
@@ -26,13 +34,9 @@
 
   nugetDeps = ./deps.json;
 
-  projectFile = [
+  projectFiles = [
     "ArchiSteamFarm"
-    "ArchiSteamFarm.OfficialPlugins.ItemsMatcher"
-    "ArchiSteamFarm.OfficialPlugins.MobileAuthenticator"
-    "ArchiSteamFarm.OfficialPlugins.Monitoring"
-    "ArchiSteamFarm.OfficialPlugins.SteamTokenDumper"
-  ];
+  ] ++ plugins;
   testProjectFile = "ArchiSteamFarm.Tests";
 
   executable = "ArchiSteamFarm";
@@ -76,10 +80,7 @@
       dotnetInstallPhase
     }
 
-    buildPlugin ArchiSteamFarm.OfficialPlugins.ItemsMatcher
-    buildPlugin ArchiSteamFarm.OfficialPlugins.MobileAuthenticator
-    buildPlugin ArchiSteamFarm.OfficialPlugins.Monitoring
-    buildPlugin ArchiSteamFarm.OfficialPlugins.SteamTokenDumper
+  '' + lib.concatStringsSep (p: "buildPlugin ${p}\n") plugins + ''
 
     chmod +x $out/lib/ArchiSteamFarm/ArchiSteamFarm.dll
     wrapDotnetProgram $out/lib/ArchiSteamFarm/ArchiSteamFarm.dll $out/bin/ArchiSteamFarm

@corngood corngood force-pushed the dotnet-runtime-flags branch from e43fd57 to 54425bb Compare August 11, 2025 13:14
@corngood
Copy link
Contributor Author

I would solve the duplication like:

Yeah, that looks good. Done.

@corngood corngood force-pushed the dotnet-runtime-flags branch from 54425bb to 4910a4d Compare August 14, 2025 23:50
@@ -1,5 +1,9 @@
# shellcheck shell=bash

_dotnetIsSolution() {
dotnet sln ${1:+"$1"} list 2>/dev/null
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@js6pak reminded me of .slnx, so I switched this to use dotnet sln list to avoid duplicating that internal logic. There's also .slnf and various differences between versions.

@corngood
Copy link
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 432571
Commit: 4910a4d3948dcf9df88d8c24cf1a2513e59c1a14


x86_64-linux

⏩ 12 packages marked as broken and skipped:
  • am2rlauncher
  • eddie
  • eventstore
  • msbuild
  • networkminer
  • openra
  • renode
  • renode-unstable
  • roslyn
  • spotlight-downloader
  • tshock
  • wasabibackend
✅ 133 packages built:
  • ArchiSteamFarm
  • alttpr-opentracker
  • audiothekar
  • autoPatchcilHook (dotnetCorePackages.autoPatchcilHook)
  • avalonia-ilspy
  • azure-artifacts-credprovider
  • azure-functions-core-tools
  • bicep
  • bicep-lsp
  • blendfarm
  • bms-to-osu
  • boogie (dotnetPackages.Boogie)
  • bs-manager
  • btcpayserver
  • btcpayserver-altcoins
  • cavalier
  • celeste64
  • certdump
  • clps2c-compiler
  • csharp-ls
  • csharpier
  • csharprepl
  • cyclonedx-cli
  • dafny
  • denaro
  • dependency-track
  • depotdownloader
  • discordchatexporter-cli
  • discordchatexporter-desktop
  • docfx
  • dotnet-ef
  • dotnet-outdated
  • dotnet-repl
  • empire-compiler
  • fable
  • famistudio
  • fantomas
  • formula
  • fsautocomplete
  • galaxy-buds-client
  • garnet
  • gh-gei
  • git-credential-manager
  • github-runner
  • gitversion
  • grayjay
  • hedgemodmanager
  • ilspycmd
  • imewlconverter
  • inklecate
  • jackett
  • jellyfin
  • juniper
  • kavita
  • knossosnet
  • kryptor
  • libation
  • liborbispkg-pkgtool
  • lubelogger
  • lumafly
  • marksman
  • mesen
  • min-ed-launcher
  • mqttmultimeter
  • msbuild-structured-log-viewer
  • msgraph-cli
  • n-m3u8dl-re
  • naps2
  • nbxplorer
  • netcoredbg
  • nexusmods-app
  • nexusmods-app-unfree
  • obj2tiles
  • olympus
  • olympus-unwrapped
  • omnisharp-roslyn
  • opentabletdriver
  • openutau
  • osu-lazer
  • pablodraw
  • patchcil
  • pbm
  • pinta
  • prowlarr
  • ps2patchelf
  • ps3-disc-dumper
  • pupdate
  • qbittorrent-cli
  • radarr
  • recyclarr
  • retrospy
  • rockstarlang
  • roslyn-ls
  • ryubing
  • rzls
  • scarab
  • seq-cli
  • skeditor
  • slskd
  • smtp4dev
  • sonarr
  • sourcegit
  • space-station-14-launcher
  • tagger
  • technitium-dns-server
  • technitium-dns-server-library
  • tests.dotnet.final-attrs.check-output
  • tests.dotnet.final-attrs.output-matches-const
  • tests.dotnet.final-attrs.override-has-no-effect
  • tests.dotnet.final-attrs.override-modifies-output
  • tests.dotnet.nuget-deps.derivation
  • tests.dotnet.nuget-deps.json-file
  • tests.dotnet.nuget-deps.list
  • tests.dotnet.nuget-deps.nix-file
  • tests.dotnet.nuget-deps.null
  • tests.dotnet.project-references
  • tests.dotnet.structured-attrs.check-output
  • tests.dotnet.structured-attrs.no-structured-attrs
  • tests.dotnet.use-dotnet-from-env.fallback
  • tests.dotnet.use-dotnet-from-env.use-dotnet-path-env
  • tests.dotnet.use-dotnet-from-env.use-dotnet-root-env
  • tests.dotnet.use-dotnet-from-env.without-fallback
  • tkmm
  • tone
  • torrentstream
  • upgrade-assistant
  • v2rayn
  • vrcadvert
  • vrcx
  • vscode-extensions.ms-azuretools.vscode-bicep
  • wiseunpacker
  • xivlauncher
  • yafc-ce

@corngood corngood requested a review from js6pak August 15, 2025 12:32
@corngood
Copy link
Contributor Author

Any more comments on this? I'd like to get it in before #433244 because they've fixed the pack flags upstream, which breaks our tests in their current state.

@corngood corngood merged commit d02f749 into NixOS:master Aug 20, 2025
26 of 28 checks passed
@corngood corngood deleted the dotnet-runtime-flags branch August 20, 2025 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: dotnet Language: .NET 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

buildDotnetModule seems to break when specifying the projectFile and setting packNupkg=true?
2 participants