7 # ordering should match defaultNativeBuildInputs
10 # TODO: add audit-tmpdir
13 manFile = pkgs.writeText "small-man" ''
14 .TH HELLO "1" "May 2022" "hello 2.12.1" "User Commands"
16 hello - friendly greeting program
20 name = "test-compress-man-pages";
22 mkdir -p $out/share/man
23 cp ${manFile} $out/share/man/small-man.1
25 [[ -e $out/share/man/small-man.1.gz ]]
28 make-symlinks-relative = stdenv.mkDerivation {
29 name = "test-make-symlinks-relative";
35 mkdir -p $out/{bar,baz}
36 mkdir -p $man/share/{x,y}
37 source1="$out/bar/foo"
38 destination1="$out/baz/foo"
39 source2="$man/share/x/file1"
40 destination2="$man/share/y/file2"
43 ln -s $source1 $destination1
44 ln -s $source2 $destination2
45 echo "symlink before patching: $(readlink $destination1)"
46 echo "symlink before patching: $(readlink $destination2)"
48 _makeSymlinksRelativeInAllOutputs
50 echo "symlink after patching: $(readlink $destination1)"
51 ([[ -e $destination1 ]] && echo "symlink isn't broken") || (echo "symlink is broken" && exit 1)
52 ([[ $(readlink $destination1) == "../bar/foo" ]] && echo "absolute symlink was made relative") || (echo "symlink was not made relative" && exit 1)
53 echo "symlink after patching: $(readlink $destination2)"
54 ([[ -e $destination2 ]] && echo "symlink isn't broken") || (echo "symlink is broken" && exit 1)
55 ([[ $(readlink $destination2) == "../x/file1" ]] && echo "absolute symlink was made relative") || (echo "symlink was not made relative" && exit 1)
58 move-docs = stdenv.mkDerivation {
59 name = "test-move-docs";
61 mkdir -p $out/{man,doc,info}
62 touch $out/{man,doc,info}/foo
63 cat $out/{man,doc,info}/foo
67 (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)
70 move-lib64 = stdenv.mkDerivation {
71 name = "test-move-lib64";
81 ([[ -e $out/lib64 ]] && echo "symlink isn't broken") || (echo "symlink is broken" && exit 1)
85 move-sbin = stdenv.mkDerivation {
86 name = "test-move-sbin";
96 ([[ -e $out/sbin ]] && echo "symlink isn't broken") || (echo "symlink is broken" && exit 1)
100 # TODO: add multiple-outputs
101 patch-shebangs = import ./patch-shebangs.nix { inherit stdenv lib pkgs; };
102 prune-libtool-files =
104 libFoo = pkgs.writeText "libFoo" ''
105 # Generated by libtool (GNU libtool) 2.4.6
107 dependency_libs=' -Lbar.la -Lbaz.la'
110 stdenv.mkDerivation {
111 name = "test-prune-libtool-files";
114 cp ${libFoo} $out/lib/libFoo.la
116 grep "^dependency_libs=''' #pruned" $out/lib/libFoo.la
117 # confirm file doesn't only contain the above
118 grep "^old_library='''" $out/lib/libFoo.la
121 reproducible-builds = stdenv.mkDerivation {
122 name = "test-reproducible-builds";
124 # can't be tested more precisely because the value of random-seed changes depending on the output
125 [[ $NIX_CFLAGS_COMPILE =~ "-frandom-seed=" ]]
129 set-source-date-epoch-to-latest = stdenv.mkDerivation {
130 name = "test-set-source-date-epoch-to-latest";
132 sourceRoot=$NIX_BUILD_TOP/source
134 touch --date=1/1/2015 $sourceRoot/foo
136 _updateSourceDateEpochFromSourceRoot
138 [[ $SOURCE_DATE_EPOCH == "1420070400" ]]