3 # ordering should match defaultNativeBuildInputs
6 # TODO: add audit-tmpdir
9 manFile = pkgs.writeText "small-man" ''
10 .TH HELLO "1" "May 2022" "hello 2.12.1" "User Commands"
12 hello - friendly greeting program
16 name = "test-compress-man-pages";
18 mkdir -p $out/share/man
19 cp ${manFile} $out/share/man/small-man.1
21 [[ -e $out/share/man/small-man.1.gz ]]
24 make-symlinks-relative = stdenv.mkDerivation {
25 name = "test-make-symlinks-relative";
26 outputs = [ "out" "man" ];
28 mkdir -p $out/{bar,baz}
29 mkdir -p $man/share/{x,y}
30 source1="$out/bar/foo"
31 destination1="$out/baz/foo"
32 source2="$man/share/x/file1"
33 destination2="$man/share/y/file2"
36 ln -s $source1 $destination1
37 ln -s $source2 $destination2
38 echo "symlink before patching: $(readlink $destination1)"
39 echo "symlink before patching: $(readlink $destination2)"
41 _makeSymlinksRelativeInAllOutputs
43 echo "symlink after patching: $(readlink $destination1)"
44 ([[ -e $destination1 ]] && echo "symlink isn't broken") || (echo "symlink is broken" && exit 1)
45 ([[ $(readlink $destination1) == "../bar/foo" ]] && echo "absolute symlink was made relative") || (echo "symlink was not made relative" && exit 1)
46 echo "symlink after patching: $(readlink $destination2)"
47 ([[ -e $destination2 ]] && echo "symlink isn't broken") || (echo "symlink is broken" && exit 1)
48 ([[ $(readlink $destination2) == "../x/file1" ]] && echo "absolute symlink was made relative") || (echo "symlink was not made relative" && exit 1)
51 move-docs = stdenv.mkDerivation {
52 name = "test-move-docs";
54 mkdir -p $out/{man,doc,info}
55 touch $out/{man,doc,info}/foo
56 cat $out/{man,doc,info}/foo
60 (cat $out/share/{man,doc,info}/foo 2>/dev/null && echo "man,doc,info were moved") || (echo "man,doc,info were not moved" && exit 1)
63 move-lib64 = stdenv.mkDerivation {
64 name = "test-move-lib64";
74 ([[ -e $out/lib64 ]] && echo "symlink isn't broken") || (echo "symlink is broken" && exit 1)
78 move-sbin = stdenv.mkDerivation {
79 name = "test-move-sbin";
89 ([[ -e $out/sbin ]] && echo "symlink isn't broken") || (echo "symlink is broken" && exit 1)
93 # TODO: add multiple-outputs
94 patch-shebangs = import ./patch-shebangs.nix { inherit stdenv lib pkgs; };
97 libFoo = pkgs.writeText "libFoo" ''
98 # Generated by libtool (GNU libtool) 2.4.6
100 dependency_libs=' -Lbar.la -Lbaz.la'
103 stdenv.mkDerivation {
104 name = "test-prune-libtool-files";
107 cp ${libFoo} $out/lib/libFoo.la
109 grep "^dependency_libs=''' #pruned" $out/lib/libFoo.la
110 # confirm file doesn't only contain the above
111 grep "^old_library='''" $out/lib/libFoo.la
114 reproducible-builds = stdenv.mkDerivation {
115 name = "test-reproducible-builds";
117 # can't be tested more precisely because the value of random-seed changes depending on the output
118 [[ $NIX_CFLAGS_COMPILE =~ "-frandom-seed=" ]]
122 set-source-date-epoch-to-latest = stdenv.mkDerivation {
123 name = "test-set-source-date-epoch-to-latest";
125 sourceRoot=$NIX_BUILD_TOP/source
127 touch --date=1/1/2015 $sourceRoot/foo
129 _updateSourceDateEpochFromSourceRoot
131 [[ $SOURCE_DATE_EPOCH == "1420070400" ]]