btrbk: add mainProgram
[NixPkgs.git] / pkgs / by-name / li / libtree / package.nix
blob621ab218669ec824083df1617df3fc4460630132
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , testers
5 , libtree
6 , runCommand
7 , coreutils
8 , dieHook
9 }:
11 stdenv.mkDerivation (finalAttrs: {
12   pname = "libtree";
13   version = "3.1.1";
15   src = fetchFromGitHub {
16     owner = "haampie";
17     repo = "libtree";
18     rev = "v${finalAttrs.version}";
19     hash = "sha256-q3JtQ9AxoP0ma9K96cC3gf6QmQ1FbS7T7I59qhkwbMk=";
20   };
22   makeFlags = [ "PREFIX=$(out)" ];
24   # Fails at https://github.com/haampie/libtree/blob/v3.1.1/tests/07_origin_is_relative_to_symlink_location_not_realpath/Makefile#L28
25   doCheck = false;
27   passthru.tests = {
28     version = testers.testVersion {
29       package = libtree;
30       command = "libtree --version";
31       version = finalAttrs.version;
32     };
33     checkCoreUtils = runCommand "${finalAttrs.pname}-ls-test" {
34       nativeBuildInputs = [ finalAttrs.finalPackage dieHook ];
35     } ''
36       libtree ${coreutils}/bin/ls > $out || die "libtree failed to show dependencies."
37       [ -s $out ]
38     '';
39   };
41   meta = with lib; {
42     description = "Tree ldd with an option to bundle dependencies into a single folder";
43     mainProgram = "libtree";
44     homepage = "https://github.com/haampie/libtree";
45     license = licenses.mit;
46     platforms = platforms.linux;
47     maintainers = with maintainers; [ prusnak rardiol ];
48   };