-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
33 lines (28 loc) · 909 Bytes
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{ pkgs ? import <nixpkgs> {} }:
rec {
mylib-0_1 = pkgs.callPackage ./mylib-0.1 { };
mylib-0_2 = pkgs.callPackage ./mylib-0.2 { };
myapp-0_1 = pkgs.callPackage ./myapp-0.1 { mylib = mylib-0_1; };
myapp-0_2 = pkgs.callPackage ./myapp-0.2 { mylib = mylib-0_2; };
test = pkgs.runCommandLocal "test" {} ''
mkdir $out
cp ${myapp-0_1}/bin/myapp $out/myapp-0.1
echo App 0.1 linked to lib 0.1
$out/myapp-0.1
echo
chmod +w $out/myapp-0.1
patchelf --replace-needed libmylib.so ${mylib-0_2}/lib/libmylib.so $out/myapp-0.1
echo App 0.1 linked to lib 0.2
$out/myapp-0.1
echo
cp ${myapp-0_2}/bin/myapp $out/myapp-0.2
echo App 0.2 linked to lib 0.2
$out/myapp-0.2
echo
chmod +w $out/myapp-0.2
patchelf --replace-needed libmylib.so ${mylib-0_1}/lib/libmylib.so $out/myapp-0.2
echo App 0.2 linked to lib 0.1
$out/myapp-0.2
echo
'';
}