Skip to content
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

buildRustCrate: add a postInstall hook #34906

Merged
merged 1 commit into from Feb 13, 2018

Conversation

sjmackenzie
Copy link
Contributor

@sjmackenzie sjmackenzie commented Feb 12, 2018

Motivation for this change

Need to add a SONAME for rust shared objects.
The simplest way is to add a postInstall phase which will allow me to do a postInstall = "ln -s $out/lib/*.so $out/lib/libagent.so";

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@sjmackenzie sjmackenzie changed the title rustBuildCrate: add a postInstall phase buildRustCrate: add a postInstall phase Feb 12, 2018
@sjmackenzie sjmackenzie changed the title buildRustCrate: add a postInstall phase buildRustCrate: add a postInstall hook Feb 12, 2018
sjmackenzie added a commit to sjmackenzie/fractalide that referenced this pull request Feb 12, 2018
Solution: once NixOS/nixpkgs#34906 gets
merged then this code will work by passing in a postInstall phase
which will be run by `runHook postInstall` at the end of the
installPhase
sjmackenzie added a commit to sjmackenzie/fractalide that referenced this pull request Feb 12, 2018
Solution: depends on NixOS/nixpkgs#34906 getting
merged.

This allows one to pass in this attribute:

`postInstall = "ln -s $out/lib/*.so $out/lib/libagent.so";`

Allowing for an indirection so the scheduler will always find a
libagent.so to load.
@sjmackenzie
Copy link
Contributor Author

@qknight could you take a look at this please?

@qknight
Copy link
Member

qknight commented Feb 13, 2018

@sjmackenzie are there many packages in nixpkgs which use buildRustCrate yet?

if so, do they all build? nix-shell -p nox --run "nox-review wip" <- just try this. if that works, i think we can merge.

@sjmackenzie
Copy link
Contributor Author

nox-review wip built all the dependent pkgs without an error.

@qknight qknight merged commit a5cabdb into NixOS:master Feb 13, 2018
@sjmackenzie
Copy link
Contributor Author

Thanks @qknight!

@sjmackenzie sjmackenzie deleted the rust_build_crate_postinstall branch February 13, 2018 20:04
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/explicit-runhook-in-derivation/4614/27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants