about summary refs log tree commit diff
path: root/pkgs/servers/samba/3.x.nix
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2015-01-02 21:21:34 -0800
committerWilliam A. Kennington III <william@wkennington.com>2015-01-03 21:45:16 -0800
commitcc73af1d10d122e9da968a3847b83c975b5f198f (patch)
tree6ea376347df5aad92fe3fbc7c85be476422891c9 /pkgs/servers/samba/3.x.nix
parentc9d963c4e64fed7c13e91df86c31927ed0d48877 (diff)
downloadnixlib-cc73af1d10d122e9da968a3847b83c975b5f198f.tar
nixlib-cc73af1d10d122e9da968a3847b83c975b5f198f.tar.gz
nixlib-cc73af1d10d122e9da968a3847b83c975b5f198f.tar.bz2
nixlib-cc73af1d10d122e9da968a3847b83c975b5f198f.tar.lz
nixlib-cc73af1d10d122e9da968a3847b83c975b5f198f.tar.xz
nixlib-cc73af1d10d122e9da968a3847b83c975b5f198f.tar.zst
nixlib-cc73af1d10d122e9da968a3847b83c975b5f198f.zip
samba: Add version 4 as the default
Diffstat (limited to 'pkgs/servers/samba/3.x.nix')
-rw-r--r--pkgs/servers/samba/3.x.nix89
1 files changed, 89 insertions, 0 deletions
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_<name>.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;
+  };
+}