btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / un / unionfs-fuse / package.nix
blob6f55dbe426a69fb1f648c8415df579d67f87ad8d
1 { lib, stdenv, fetchFromGitHub, cmake, fuse }:
3 stdenv.mkDerivation rec {
4   pname = "unionfs-fuse";
5   version = "2.2";
7   src = fetchFromGitHub {
8     owner = "rpodgorny";
9     repo = "unionfs-fuse";
10     rev = "v${version}";
11     sha256 = "sha256-EJryML6E0CW4kvsqMRqV3cq77j50HuylNzgaHD6CL/o=";
12   };
14   patches = [
15     # Prevent the unionfs daemon from being killed during
16     # shutdown. See
17     # https://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons/
18     # for details.
19     ./prevent-kill-on-shutdown.patch
20   ];
22   postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
23     substituteInPlace CMakeLists.txt \
24       --replace '/usr/local/include/osxfuse/fuse' '${lib.getDev fuse}/include/fuse'
25   '';
27   nativeBuildInputs = [ cmake ];
28   buildInputs = [ fuse ];
30   # Put the unionfs mount helper in place as mount.unionfs-fuse. This makes it
31   # possible to do:
32   #   mount -t unionfs-fuse none /dest -o dirs=/source1=RW,/source2=RO
33   #
34   # This must be done in preConfigure because the build process removes
35   # helper from the source directory during the build.
36   preConfigure = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
37     mkdir -p $out/sbin
38     cp -a mount.unionfs $out/sbin/mount.unionfs-fuse
39     substituteInPlace $out/sbin/mount.unionfs-fuse --replace mount.fuse ${fuse}/sbin/mount.fuse
40     substituteInPlace $out/sbin/mount.unionfs-fuse --replace unionfs $out/bin/unionfs
41   '';
43   meta = with lib; {
44     broken = stdenv.hostPlatform.isDarwin;
45     description = "FUSE UnionFS implementation";
46     homepage = "https://github.com/rpodgorny/unionfs-fuse";
47     license = licenses.bsd3;
48     platforms = platforms.unix;
49     maintainers = with maintainers; [ orivej ];
50   };