Skip to content

Commit

Permalink
modify a mylib without rebuilding mybin
Browse files Browse the repository at this point in the history
dynamic lib
  • Loading branch information
correabuscar committed Apr 3, 2024
1 parent 8d16435 commit bee1dd5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
12 changes: 12 additions & 0 deletions configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -692,5 +692,17 @@ ccache
# });
# })];

#initially from: https://github.com/NixOS/nixpkgs/issues/300055#issuecomment-2034546410
#this works, well 'mybin' will use this variant of rebuilt mylib, without 'mybin' getting rebuilt.
system.replaceRuntimeDependencies = [({
original = pkgs.mylib;
replacement = pkgs.mylib.overrideAttrs (finalAttrs: prevAttrs: {
#(rec {
version = "0.1.3";
patches = prevAttrs.patches or [] ++ [
./myoverlay/patches/testing1.patch
];
});
})];
}
# vim: set tabstop=2 shiftwidth=2 expandtab :
4 changes: 2 additions & 2 deletions myoverlay/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ self: super:
# ];
# });
mybin = super.rustPlatform.buildRustPackage rec {
name = "mybin";
pname = "mybin";
version = "0.1.0";
src = ./rustdylibusage/mybin/mybin-${version}.tar.gz;
#cargoSha256 = "0qbdcw601m09fw7vqmafvw5q7w17dh37fbbycs6is3rff5qlmbyw"; #mybin
Expand Down Expand Up @@ -293,7 +293,7 @@ self: super:

mylib = super.rustPlatform.buildRustPackage rec {
version = "0.1.0";
name = "mylib";
pname = "mylib";
src = ./rustdylibusage/mylib/mylib-${version}.tar.gz;
#cargoSha256 = "1zwcx7637zl6ka058hfgwzmnxln1y592gfwiycxiz65qygxph383"; #mylib
#cargoSha256 = "sha256-7AfdCKEh4xTyRir/hmA8I6WYnoPYAQH8NN1Jx19SYDc";
Expand Down
13 changes: 13 additions & 0 deletions myoverlay/patches/testing1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/myoverlay/rustdylibusage/mylib/src/lib.rs b/myoverlay/rustdylibusage/mylib/src/lib.rs
index e1077a6..ea57df0 100644
--- mylib/src/lib.rs
+++ mylib/src/lib.rs
@@ -6,7 +6,7 @@ pub fn add(left: usize, right: usize) -> usize {
pub fn greet(name: &str) {
//#[no_mangle]
//pub extern "C" fn greet(name: *const std::os::raw::c_char) {
- println!("Hello, {}!", name);
+ println!("hAllo, {}!", name);
}


0 comments on commit bee1dd5

Please sign in to comment.