feat(build): add options for arguments passed only to dependencies or the binary derivation #13

Merged
krauterbaquette merged 1 commit from distinct-args into main 2026-01-26 11:00:04 +00:00

This is important when you want e.g. wrap the output binary with for example postInstall.

nix-rust.lib.build.buildRustPackage {
   ...
   postInstall = ''
     wrapProgram $out/bin/my-app \
      --set MY_ENV "yoink"
   '';
}

This is not possible in the current implementation,
because $out/bin/my-app does not exist in the dependency derivation.

With the changes it will be possible to write the above as:

nix-rust-lib.build.buildRustPackage {
  ...
  binaryArgs.postInstall = ''
    wrapProgram $out/bin/my-app \
      --set MY_ENV "yoink"
    '';
}
``

The new options are:
- `binaryArgs` -> for binary derivation
- `dependencyArgs` -> for dependency derivation
This is important when you want e.g. wrap the output binary with for example `postInstall`. ```nix nix-rust.lib.build.buildRustPackage { ... postInstall = '' wrapProgram $out/bin/my-app \ --set MY_ENV "yoink" ''; } ``` This is not possible in the current implementation, because `$out/bin/my-app` does not exist in the dependency derivation. With the changes it will be possible to write the above as: ```nix nix-rust-lib.build.buildRustPackage { ... binaryArgs.postInstall = '' wrapProgram $out/bin/my-app \ --set MY_ENV "yoink" ''; } `` The new options are: - `binaryArgs` -> for binary derivation - `dependencyArgs` -> for dependency derivation
feat(build): add options for arguments passed only to dependencies or the binary derivation
Some checks failed
update-flake.yml / feat(build): add options for arguments passed only to dependencies or the binary derivation (push) Failing after 0s
update-flake.yml / feat(build): add options for arguments passed only to dependencies or the binary derivation (pull_request) Failing after 0s
aaf6b6981a
krauterbaquette deleted branch distinct-args 2026-01-26 11:00:04 +00:00
Author
Owner

@aviac menton so you know about that change

@aviac menton so you know about that change
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
solarpunk-kollektiv-dd/nix-rust!13
No description provided.