about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/filesystems/relfs/default.nix
blob: 04a15dfa22be3909122bbea79f0b77b1766b66dc (plain) (blame)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{ stdenv, fetchcvs, ocaml, fuse, postgresql, pcre
, libuuid, gnome_vfs, pkgconfig, GConf }:

stdenv.mkDerivation rec {
	name = "relfs-2008.03.05";

	src = fetchcvs {
		cvsRoot = ":pserver:anonymous@relfs.cvs.sourceforge.net:/cvsroot/relfs";
		module = "relfs";
		date = "2008-03-05";
		sha256 = "949f8eff7e74ff2666cccf8a1efbfcce8d54bc41bec6ad6db8c029de7ca832a3";
	};

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [ ocaml fuse postgresql pcre libuuid gnome_vfs GConf ];

  buildPhase = ''
    cd deps
		sed -e 's/^CPP/#&/ ; s/^# CPP=gcc/CPP=gcc/' -i Makefile.camlidl
		make
		cd ../src
		sed -e 's/NULL\\|FALSE/0/g' -i Mimetype_lib.c
		sed -e 's@/usr/local/@'\$out/'@' -i Makefile
		sed -e '/install:/a\\\tmkdir -p '\$out'/share' -i Makefile
		make
		mkdir -p \$out/bin
		echo '
		  createuser -A -D \$1
			dropdb relfs_\$1 ;
			rm -rf /tmp/relfs-\$1-tmp;
			mkdir /tmp/relfs-\$1-tmp;
			USER=\$1 relfs -f -s /tmp/relfs-\$1-tmp  &
			sleep 1 &&
			kill -15 \''${!};
			rm -rf /tmp/relfs-\$1-tmp ;
			psql -d relfs_\$1 <<< \"ALTER DATABASE relfs_\$1 OWNER TO \$1;
				ALTER TABLE obj OWNER TO \$1;
				ALTER TABLE obj_mimetype OWNER TO \$1;
				ALTER TABLE membership OWNER TO \$1;\"' > \$out/bin/relfs_grant;
		chmod a+x \$out/bin/relfs_grant;
  '';

	meta = with stdenv.lib; {
		description = "A relational filesystem on top of FUSE";
    homepage = http://relfs.sourceforge.net;
    license = licenses.gpl2;
    maintainers = [ maintainers.raskin ];
    platforms = platforms.linux;
    broken = true;
	};
}