at 18.03-beta 60 lines 2.5 kB view raw
1{ stdenv, fetchurl, pkgconfig, perl, utillinux, keyutils, nss, nspr, python2, 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 = "/run/wrappers/bin"; 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 /bin/mount ${utillinux}/bin/mount \ 21 --replace /bin/umount ${utillinux}/bin/umount \ 22 --replace /sbin/mount.ecryptfs_private ${wrapperDir}/mount.ecryptfs_private \ 23 --replace /sbin/umount.ecryptfs_private ${wrapperDir}/umount.ecryptfs_private \ 24 --replace /sbin/mount.ecryptfs $out/sbin/mount.ecryptfs \ 25 --replace /sbin/umount.ecryptfs $out/sbin/umount.ecryptfs \ 26 --replace /usr/bin/ecryptfs-rewrite-file $out/bin/ecryptfs-rewrite-file \ 27 --replace /usr/bin/ecryptfs-mount-private $out/bin/ecryptfs-mount-private \ 28 --replace /usr/bin/ecryptfs-setup-private $out/bin/ecryptfs-setup-private \ 29 --replace /sbin/cryptsetup ${cryptsetup}/sbin/cryptsetup \ 30 --replace /sbin/dmsetup ${lvm2}/sbin/dmsetup \ 31 --replace /sbin/unix_chkpwd ${wrapperDir}/unix_chkpwd \ 32 --replace /bin/bash ${bash}/bin/bash 33 done 34 ''; 35 36 nativeBuildInputs = [ pkgconfig ]; 37 buildInputs = [ perl nss nspr python2 pam intltool makeWrapper ]; 38 propagatedBuildInputs = [ coreutils gettext cryptsetup lvm2 rsync keyutils which ]; 39 40 postInstall = '' 41 FILES="$(grep -r '/bin/sh' $out/bin -l)" 42 for file in $FILES; do 43 wrapProgram $file \ 44 --prefix PATH ":" "${coreutils}/bin" \ 45 --prefix PATH ":" "${gettext}/bin" \ 46 --prefix PATH ":" "${rsync}/bin" \ 47 --prefix PATH ":" "${keyutils}/bin" \ 48 --prefix PATH ":" "${which}/bin" \ 49 --prefix PATH ":" "${lsof}/bin" \ 50 --prefix PATH ":" "$out/bin" 51 done 52 ''; 53 54 meta = with stdenv.lib; { 55 description = "Enterprise-class stacked cryptographic filesystem"; 56 license = licenses.gpl2Plus; 57 maintainers = with maintainers; [ obadz ]; 58 platforms = platforms.linux; 59 }; 60}