2010-04-28 09:39:01 +00:00
|
|
|
{ stdenv, fetchurl, readline, pam, openldap, popt, iniparser, libunwind, fam
|
2011-04-14 07:25:06 +00:00
|
|
|
, acl, cups
|
2010-09-26 05:07:41 +00:00
|
|
|
, useKerberos ? false, kerberos ? null, winbind ? true
|
2009-04-26 11:06:41 +00:00
|
|
|
|
|
|
|
# Eg. smbclient and smbspool require a smb.conf file.
|
|
|
|
# If you set configDir to "" an empty configuration file
|
|
|
|
# $out/lib/smb.conf is is created for you.
|
|
|
|
#
|
|
|
|
# configDir defaults to "/etc/samba" so that smbpassword picks up
|
|
|
|
# the location of its passwd db files from the system configuration file
|
|
|
|
# /etc/samba/smb.conf. That's why nixos touches /etc/samba/smb.conf even if you
|
|
|
|
# don't enable the samba upstart service.
|
|
|
|
, configDir ? "/etc/samba"
|
2007-05-28 15:40:17 +00:00
|
|
|
|
2010-09-26 05:07:41 +00:00
|
|
|
}:
|
2010-12-06 18:59:07 +00:00
|
|
|
|
2010-09-26 05:07:41 +00:00
|
|
|
let
|
2010-12-06 18:59:07 +00:00
|
|
|
|
|
|
|
useWith = flag: option: if flag then "--with-"+option else "";
|
|
|
|
|
2010-09-26 05:07:41 +00:00
|
|
|
in
|
2010-12-06 18:59:07 +00:00
|
|
|
|
2008-01-28 19:46:27 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2011-10-21 19:30:32 +00:00
|
|
|
name = "samba-3.6.1";
|
2007-05-28 15:40:17 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2009-04-04 00:59:55 +00:00
|
|
|
url = "http://us3.samba.org/samba/ftp/stable/${name}.tar.gz";
|
2011-10-21 19:30:32 +00:00
|
|
|
sha256 = "0r6mbghja357xhpada5djg0gpczi50f18ap53hdn8b7y0amz5c65";
|
2007-05-28 15:40:17 +00:00
|
|
|
};
|
|
|
|
|
2011-04-14 07:25:06 +00:00
|
|
|
buildInputs = [ readline pam openldap popt iniparser libunwind fam acl cups ]
|
2010-04-28 09:39:01 +00:00
|
|
|
++ stdenv.lib.optional useKerberos kerberos;
|
2008-03-11 17:01:55 +00:00
|
|
|
|
2011-04-13 15:31:22 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2010-12-06 18:59:07 +00:00
|
|
|
preConfigure = "cd source3";
|
2008-11-07 13:05:05 +00:00
|
|
|
|
2008-03-11 17:01:55 +00:00
|
|
|
configureFlags = ''
|
|
|
|
--with-pam
|
|
|
|
--with-aio-support
|
2009-04-03 10:02:30 +00:00
|
|
|
--with-pam_smbpass
|
2009-04-04 00:59:55 +00:00
|
|
|
--disable-swat
|
2009-04-26 11:06:41 +00:00
|
|
|
--with-configdir=${configDir}
|
2010-12-06 18:59:07 +00:00
|
|
|
--with-fhs
|
|
|
|
--localstatedir=/var
|
|
|
|
${useWith winbind "winbind"}
|
2009-04-04 00:59:55 +00:00
|
|
|
${if stdenv.gcc.libc != null then "--with-libiconv=${stdenv.gcc.libc}" else ""}
|
2008-01-28 19:46:27 +00:00
|
|
|
'';
|
2010-12-06 18:59:07 +00:00
|
|
|
|
|
|
|
# Need to use a DESTDIR because `make install' tries to write in /var and /etc.
|
|
|
|
installFlags = "DESTDIR=$(TMPDIR)/inst";
|
|
|
|
|
2011-08-10 20:19:36 +00:00
|
|
|
stripAllList = [ "bin" "sbin" ];
|
|
|
|
|
2010-12-06 18:59:07 +00:00
|
|
|
postInstall =
|
|
|
|
''
|
|
|
|
mkdir -p $out
|
|
|
|
mv $TMPDIR/inst/$out/* $out/
|
|
|
|
|
|
|
|
mkdir -pv $out/lib/cups/backend
|
|
|
|
ln -sv ../../../bin/smbspool $out/lib/cups/backend/smb
|
2011-04-13 15:31:22 +00:00
|
|
|
mkdir -pv $out/etc/openldap/schema
|
|
|
|
cp ../examples/LDAP/samba.schema $out/etc/openldap/schema
|
2010-12-06 18:59:07 +00:00
|
|
|
'' # */
|
|
|
|
+ stdenv.lib.optionalString (configDir == "") "touch $out/lib/smb.conf";
|
2007-05-28 15:40:17 +00:00
|
|
|
}
|