From cc73af1d10d122e9da968a3847b83c975b5f198f Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Fri, 2 Jan 2015 21:21:34 -0800 Subject: samba: Add version 4 as the default --- pkgs/servers/samba/3.x.nix | 89 +++++++++++++++++ pkgs/servers/samba/4.x-no-persistent-install.patch | 18 ++++ pkgs/servers/samba/4.x.nix | 109 +++++++++++++++++++++ pkgs/servers/samba/default.nix | 89 ----------------- 4 files changed, 216 insertions(+), 89 deletions(-) create mode 100644 pkgs/servers/samba/3.x.nix create mode 100644 pkgs/servers/samba/4.x-no-persistent-install.patch create mode 100644 pkgs/servers/samba/4.x.nix delete mode 100644 pkgs/servers/samba/default.nix (limited to 'pkgs/servers/samba') diff --git a/pkgs/servers/samba/3.x.nix b/pkgs/servers/samba/3.x.nix new file mode 100644 index 000000000000..b0b1b152e9b7 --- /dev/null +++ b/pkgs/servers/samba/3.x.nix @@ -0,0 +1,89 @@ +{ stdenv, fetchurl, readline, pam ? null, openldap ? null +, popt, iniparser, libunwind +, fam ? null , acl ? null, cups ? null +, useKerberos ? false, kerberos ? null, winbind ? true + +# 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" + +}: + +assert useKerberos -> kerberos != null; + +stdenv.mkDerivation rec { + name = "samba-3.6.24"; + + src = fetchurl { + url = "http://samba.org/samba/ftp/stable/${name}.tar.gz"; + sha256 = "19rln8m1k359bz6dhmlv39kzyjg7p296dz4y4mq1jwrlnw2bvl0i"; + }; + + buildInputs = [ readline pam openldap popt iniparser libunwind fam acl cups ] + ++ stdenv.lib.optional useKerberos kerberos; + + enableParallelBuilding = true; + + postPatch = + # XXX: Awful hack to allow cross-compilation. + '' sed -i source3/configure \ + -e 's/^as_fn_error .. \("cannot run test program while cross compiling\)/$as_echo \1/g' + ''; # " + + preConfigure = + '' cd source3 + export samba_cv_CC_NEGATIVE_ENUM_VALUES=yes + export libreplace_cv_HAVE_GETADDRINFO=yes + export ac_cv_file__proc_sys_kernel_core_pattern=no # XXX: true on Linux, false elsewhere + ''; + + configureFlags = + stdenv.lib.optionals (pam != null) [ "--with-pam" "--with-pam_smbpass" ] + ++ [ "--with-aio-support" + "--disable-swat" + "--with-configdir=${configDir}" + "--with-fhs" + "--localstatedir=/var" + ] + ++ (stdenv.lib.optional winbind "--with-winbind") + ++ (stdenv.lib.optional (stdenv.cc.libc != null) "--with-libiconv=${stdenv.cc.libc}"); + + # Need to use a DESTDIR because `make install' tries to write in /var and /etc. + installFlags = "DESTDIR=$(TMPDIR)/inst"; + + stripAllList = [ "bin" "sbin" ]; + + postInstall = + '' + mkdir -p $out + mv $TMPDIR/inst/$out/* $out/ + + mkdir -p "$out/lib/pkgconfig" + cp pkgconfig/*.pc "$out/lib/pkgconfig" + + mkdir -pv $out/lib/cups/backend + ln -sv ../../../bin/smbspool $out/lib/cups/backend/smb + mkdir -pv $out/etc/openldap/schema + cp ../examples/LDAP/samba.schema $out/etc/openldap/schema + + # For nsswitch. Glibc >= 2.1 looks for libnss_.so.2 (see man + # nsswitch.conf), so provide that too. + cp -v ../nsswitch/libnss_wins.so "$out/lib" + cp -v ../nsswitch/libnss_winbind.so "$out/lib" + (cd "$out/lib" && ln -s libnss_winbind.so libnss_winbind.so.2) + (cd "$out/lib" && ln -s libnss_wins.so libnss_wins.so.2) + '' # */ + + stdenv.lib.optionalString (configDir == "") "touch $out/lib/smb.conf"; + + meta = { + homepage = http://www.samba.org/; + description = "The standard Windows interoperability suite of programs for Linux and Unix"; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/servers/samba/4.x-no-persistent-install.patch b/pkgs/servers/samba/4.x-no-persistent-install.patch new file mode 100644 index 000000000000..68d0cf76aa55 --- /dev/null +++ b/pkgs/servers/samba/4.x-no-persistent-install.patch @@ -0,0 +1,18 @@ +diff --git a/dynconfig/wscript b/dynconfig/wscript +index aa4e66e..d53f433 100755 +--- a/dynconfig/wscript ++++ b/dynconfig/wscript +@@ -379,9 +379,9 @@ def build(bld): + cflags=cflags) + + # install some extra empty directories +- bld.INSTALL_DIRS("", "${CONFIGDIR} ${PRIVATE_DIR} ${LOGFILEBASE}"); +- bld.INSTALL_DIRS("", "${PRIVATE_DIR} ${PRIVILEGED_SOCKET_DIR}") +- bld.INSTALL_DIRS("", "${STATEDIR} ${CACHEDIR}"); ++ #bld.INSTALL_DIRS("", "${CONFIGDIR} ${PRIVATE_DIR} ${LOGFILEBASE}"); ++ #bld.INSTALL_DIRS("", "${PRIVATE_DIR} ${PRIVILEGED_SOCKET_DIR}") ++ #bld.INSTALL_DIRS("", "${STATEDIR} ${CACHEDIR}"); + + # these might be on non persistent storage +- bld.INSTALL_DIRS("", "${LOCKDIR} ${PIDDIR} ${SOCKET_DIR}") ++ #bld.INSTALL_DIRS("", "${LOCKDIR} ${PIDDIR} ${SOCKET_DIR}") diff --git a/pkgs/servers/samba/4.x.nix b/pkgs/servers/samba/4.x.nix new file mode 100644 index 000000000000..99d88c728a3c --- /dev/null +++ b/pkgs/servers/samba/4.x.nix @@ -0,0 +1,109 @@ +{ stdenv, fetchurl, python, pkgconfig, perl, libxslt, docbook_xsl_ns +, docbook_xml_dtd_42, readline, talloc, ntdb, tdb, tevent, ldb, popt, iniparser +, pythonPackages + +# source3/wscript optionals +, heimdal ? null # Samba only supports heimdal for kerberos although mit-krb5 is being worked on +, openldap ? null +, cups ? null +, pam ? null +, avahi ? null +, acl ? null +, libaio ? null +, fam ? null +, ctdb ? null +, ceph ? null +, glusterfs ? null + +# buildtools/wafsamba/wscript optionals +, libiconv ? null +, gettext ? null + +# source4/lib/tls/wscript optionals +, gnutls ? null +, libgcrypt ? null +, libgpgerror ? null + +# other optionals +, zlib ? null +, ncurses ? null +, libcap ? null +}: + +stdenv.mkDerivation rec { + name = "samba-4.1.14"; + + src = fetchurl { + url = "http://samba.org/samba/ftp/stable/${name}.tar.gz"; + sha256 = "1ficvglapxcw4zrgwkmmjbprsqrxks3ii29nblsr4wlrram4p8ay"; + }; + + patches = [ ./4.x-no-persistent-install.patch ]; + + buildInputs = [ + python pkgconfig perl libxslt docbook_xsl_ns docbook_xml_dtd_42 + readline talloc ntdb tdb tevent ldb popt iniparser pythonPackages.subunit + + heimdal openldap cups pam avahi acl libaio fam ctdb ceph glusterfs + + libiconv gettext + + gnutls libgcrypt libgpgerror + + zlib ncurses libcap + ]; + + enableParallelBuilding = true; + + configureFlags = [ + # source3/wscript options + "--with-static-modules=NONE" + "--with-shared-modules=ALL" + "--with-winbind" + ] ++ (if heimdal != null then [ "--with-ads" ] else [ "--without-ads" ]) + ++ (if openldap != null then [ "--with-ldap" ] else [ "--without-ldap" ]) + ++ (if cups != null then [ "--enable-cups" ] else [ "--disable-cups" ]) + ++ (if pam != null then [ "--with-pam" "--with-pam_smbpass" ] + else [ "--without-pam" "--without-pam_smbpass" ]) ++ [ + "--with-quotas" + "--with-sendfile-support" + "--with-utmp" + "--enable-pthreadpool" + ] ++ (if avahi != null then [ "--enable-avahi" ] else [ "--disable-avahi" ]) ++ [ + "--with-iconv" + ] ++ (if acl != null then [ "--with-acl-support" ] else [ "--without-acl-support" ]) ++ [ + "--with-dnsupdate" + "--with-syslog" + "--with-automount" + ] ++ (if libaio != null then [ "--with-aio-support" ] else [ "--without-aio-support" ]) + ++ (if fam != null then [ "--with-fam" ] else [ "--without-fam" ]) + ++ (if ctdb != null then [ "--with-cluster-support" "--with-ctdb-dir=${ctdb}" ] + else [ "--without-cluster-support" ]) + ++ (if ceph != null then [ "--with-libcephfs=${ceph}" ] else [ ]) + ++ (if glusterfs != null then [ "--enable-glusterfs" ] else [ "--disable-glusterfs" ]) ++ [ + # dynconfig/wscript options + "--enable-fhs" + "--localstatedir=/var" + + # buildtools/wafsamba/wscript options + "--bundled-libraries=${if heimdal != null then "NONE" else "com_err"}" + "--private-libraries=NONE" + "--builtin-libraries=replace" + ] ++ (if libiconv != null then [ "--with-libiconv=${libiconv}" ] else [ ]) + ++ (if gettext != null then [ "--with-gettext=${gettext}" ] else [ "--without-gettext" ]) ++ [ + # source4/lib/tls/wscript options + ] ++ (if gnutls != null && libgcrypt != null && libgpgerror != null + then [ "--enable-gnutls" ] else [ "--disable-gnutls" ]) ++ [ + # wscript options + ] ++ stdenv.lib.optional (heimdal == null) "--without-ad-dc"; + + stripAllList = [ "bin" "sbin" ]; + + meta = with stdenv.lib; { + homepage = http://www.samba.org/; + description = "The standard Windows interoperability suite of programs for Linux and Unix"; + license = licenses.gpl3; + maintainers = with maintainers; [ wkennington ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/servers/samba/default.nix b/pkgs/servers/samba/default.nix deleted file mode 100644 index b0b1b152e9b7..000000000000 --- a/pkgs/servers/samba/default.nix +++ /dev/null @@ -1,89 +0,0 @@ -{ stdenv, fetchurl, readline, pam ? null, openldap ? null -, popt, iniparser, libunwind -, fam ? null , acl ? null, cups ? null -, useKerberos ? false, kerberos ? null, winbind ? true - -# 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" - -}: - -assert useKerberos -> kerberos != null; - -stdenv.mkDerivation rec { - name = "samba-3.6.24"; - - src = fetchurl { - url = "http://samba.org/samba/ftp/stable/${name}.tar.gz"; - sha256 = "19rln8m1k359bz6dhmlv39kzyjg7p296dz4y4mq1jwrlnw2bvl0i"; - }; - - buildInputs = [ readline pam openldap popt iniparser libunwind fam acl cups ] - ++ stdenv.lib.optional useKerberos kerberos; - - enableParallelBuilding = true; - - postPatch = - # XXX: Awful hack to allow cross-compilation. - '' sed -i source3/configure \ - -e 's/^as_fn_error .. \("cannot run test program while cross compiling\)/$as_echo \1/g' - ''; # " - - preConfigure = - '' cd source3 - export samba_cv_CC_NEGATIVE_ENUM_VALUES=yes - export libreplace_cv_HAVE_GETADDRINFO=yes - export ac_cv_file__proc_sys_kernel_core_pattern=no # XXX: true on Linux, false elsewhere - ''; - - configureFlags = - stdenv.lib.optionals (pam != null) [ "--with-pam" "--with-pam_smbpass" ] - ++ [ "--with-aio-support" - "--disable-swat" - "--with-configdir=${configDir}" - "--with-fhs" - "--localstatedir=/var" - ] - ++ (stdenv.lib.optional winbind "--with-winbind") - ++ (stdenv.lib.optional (stdenv.cc.libc != null) "--with-libiconv=${stdenv.cc.libc}"); - - # Need to use a DESTDIR because `make install' tries to write in /var and /etc. - installFlags = "DESTDIR=$(TMPDIR)/inst"; - - stripAllList = [ "bin" "sbin" ]; - - postInstall = - '' - mkdir -p $out - mv $TMPDIR/inst/$out/* $out/ - - mkdir -p "$out/lib/pkgconfig" - cp pkgconfig/*.pc "$out/lib/pkgconfig" - - mkdir -pv $out/lib/cups/backend - ln -sv ../../../bin/smbspool $out/lib/cups/backend/smb - mkdir -pv $out/etc/openldap/schema - cp ../examples/LDAP/samba.schema $out/etc/openldap/schema - - # For nsswitch. Glibc >= 2.1 looks for libnss_.so.2 (see man - # nsswitch.conf), so provide that too. - cp -v ../nsswitch/libnss_wins.so "$out/lib" - cp -v ../nsswitch/libnss_winbind.so "$out/lib" - (cd "$out/lib" && ln -s libnss_winbind.so libnss_winbind.so.2) - (cd "$out/lib" && ln -s libnss_wins.so libnss_wins.so.2) - '' # */ - + stdenv.lib.optionalString (configDir == "") "touch $out/lib/smb.conf"; - - meta = { - homepage = http://www.samba.org/; - description = "The standard Windows interoperability suite of programs for Linux and Unix"; - platforms = stdenv.lib.platforms.linux; - }; -} -- cgit 1.4.1