diff options
| author | tv <tv@krebsco.de> | 2026-12-01 01:44:42 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-12-01 01:44:42 +0000 |
| commit | 235162ee73cf4418a91f8d7336b2f3675eec1f55 (patch) | |
| tree | 35c1ebb4f8de8694f1a177efb15a92e26d0e7c91 /pkgs | |
| parent | 143b4991a1cecbf471e6199d3aa100944e007c4d (diff) | |
crate2nix-package: join extraPaths to any package
Not only to the members of a workspace: a root crate's build gets them,
too. Packages without extraPaths build as before.
Diffstat (limited to 'pkgs')
| -rw-r--r-- | pkgs/rust/lib/crate2nix-package.nix | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/pkgs/rust/lib/crate2nix-package.nix b/pkgs/rust/lib/crate2nix-package.nix index 892d40e8..92002cee 100644 --- a/pkgs/rust/lib/crate2nix-package.nix +++ b/pkgs/rust/lib/crate2nix-package.nix @@ -36,7 +36,7 @@ , resolvedJson ? null # Workspace members to build; null: the root crate, or else all members. -# With members, extraPaths get joined to them, e.g. documentation. +# extraPaths get joined to what is built, e.g. documentation. , members ? null , extraPaths ? [] }: @@ -138,14 +138,16 @@ let cargoNix = if useJson then checkFeatures (checkLock fromJson) else fromLock; in cargoNix // { - build = - if members != null then - pkgs.symlinkJoin { - inherit name; - paths = - map (member: cargoNix.workspaceMembers.${member}.build) members ++ - extraPaths; - } - else if cargoNix.rootCrate or null != null then cargoNix.rootCrate.build - else cargoNix.allWorkspaceMembers; + build = let + built = + if members != null then + map (member: cargoNix.workspaceMembers.${member}.build) members + else if cargoNix.rootCrate or null != null then [ cargoNix.rootCrate.build ] + else [ cargoNix.allWorkspaceMembers ]; + in + if members == null && extraPaths == [] then builtins.head built + else pkgs.symlinkJoin { + inherit name; + paths = built ++ extraPaths; + }; } |
