at 16.09-beta 59 lines 2.5 kB view raw
1{ stdenv, fetchurl, pkgconfig, perl, utillinux, keyutils, nss, nspr, python, pam 2, intltool, makeWrapper, coreutils, bash, gettext, cryptsetup, lvm2, rsync, which, lsof }: 3 4stdenv.mkDerivation rec { 5 name = "ecryptfs-${version}"; 6 version = "111"; 7 8 src = fetchurl { 9 url = "http://launchpad.net/ecryptfs/trunk/${version}/+download/ecryptfs-utils_${version}.orig.tar.gz"; 10 sha256 = "0zwq19siiwf09h7lwa7n7mgmrr8cxifp45lmwgcfr8c1gviv6b0i"; 11 }; 12 13 # TODO: replace wrapperDir below with from <nixos> config.security.wrapperDir; 14 wrapperDir = "/var/setuid-wrappers"; 15 16 postPatch = '' 17 FILES="$(grep -r '/bin/sh' src/utils -l; find src -name \*.c)" 18 for file in $FILES; do 19 substituteInPlace "$file" \ 20 --replace /sbin/mount.ecryptfs_private ${wrapperDir}/mount.ecryptfs_private \ 21 --replace /sbin/umount.ecryptfs_private ${wrapperDir}/umount.ecryptfs_private \ 22 --replace /sbin/mount.ecryptfs $out/sbin/mount.ecryptfs \ 23 --replace /sbin/umount.ecryptfs $out/sbin/umount.ecryptfs \ 24 --replace /usr/bin/ecryptfs-rewrite-file $out/bin/ecryptfs-rewrite-file \ 25 --replace /usr/bin/ecryptfs-mount-private $out/bin/ecryptfs-mount-private \ 26 --replace /usr/bin/ecryptfs-setup-private $out/bin/ecryptfs-setup-private \ 27 --replace /sbin/cryptsetup ${cryptsetup}/sbin/cryptsetup \ 28 --replace /sbin/dmsetup ${lvm2}/sbin/dmsetup \ 29 --replace /bin/mount ${utillinux}/bin/mount \ 30 --replace /bin/umount ${utillinux}/bin/umount \ 31 --replace /sbin/unix_chkpwd ${wrapperDir}/unix_chkpwd \ 32 --replace /bin/bash ${bash}/bin/bash 33 done 34 ''; 35 36 buildInputs = [ pkgconfig perl nss nspr python pam intltool makeWrapper ]; 37 propagatedBuildInputs = [ coreutils gettext cryptsetup lvm2 rsync keyutils which ]; 38 39 postInstall = '' 40 FILES="$(grep -r '/bin/sh' $out/bin -l)" 41 for file in $FILES; do 42 wrapProgram $file \ 43 --prefix PATH ":" "${coreutils}/bin" \ 44 --prefix PATH ":" "${gettext}/bin" \ 45 --prefix PATH ":" "${rsync}/bin" \ 46 --prefix PATH ":" "${keyutils}/bin" \ 47 --prefix PATH ":" "${which}/bin" \ 48 --prefix PATH ":" "${lsof}/bin" \ 49 --prefix PATH ":" "$out/bin" 50 done 51 ''; 52 53 meta = with stdenv.lib; { 54 description = "Enterprise-class stacked cryptographic filesystem"; 55 license = licenses.gpl2Plus; 56 maintainers = with maintainers; [ obadz ]; 57 platforms = platforms.linux; 58 }; 59}