Skip to content

Expose targetPackages for buildDotnetModule compatibility - #14

Merged
adampoit merged 1 commit into
mainfrom
fix-build-dotnet-module-target-packages
Jul 7, 2026
Merged

adampoit merged 1 commit into
mainfrom
fix-build-dotnet-module-target-packages

Conversation

@adampoit

@adampoit adampoit commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Problem

Follow-up to #7. mkDotnet now exposes packages and icu, but nixpkgs buildDotnetModule also reads dotnet-sdk.targetPackages when evaluating fetch-deps / runtime inputs:

error: attribute 'targetPackages' missing
at pkgs/build-support/dotnet/build-dotnet-module/default.nix:231:79:
  ++ lib.concatLists (lib.attrValues (lib.getAttrs dotnetRuntimeIds dotnet-sdk.targetPackages));

This still required downstream consumers to add a local shim like:

dotnet-sdk = dotnetSdk // { inherit (dotnetCorePackages.sdk_10_0) targetPackages; };

Solution

Add targetPackages to the buildDotnetModule passthru returned by mkDotnet.

The implementation maps the SDK major version to the corresponding nixpkgs dotnetCorePackages.sdk_<major>_0 package and reuses its targetPackages. If nixpkgs does not provide a matching SDK package, it falls back to {} so the attribute still exists.

Validation

alejandra .
nix run github:nix-community/nix-unit -- --flake '.#tests'

Result: 49/49 unit tests passed.

@adampoit
adampoit merged commit e7e8415 into main Jul 7, 2026
5 checks passed
@adampoit
adampoit deleted the fix-build-dotnet-module-target-packages branch July 7, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant