lol
1{ stdenv, autoconf, automake, libtool, coreutils, gawk
2, configFile ? "all"
3
4# Kernel dependencies
5, kernel ? null
6
7# Version specific parameters
8, version, src, patches
9, ...
10}:
11
12with stdenv.lib;
13let
14 buildKernel = any (n: n == configFile) [ "kernel" "all" ];
15 buildUser = any (n: n == configFile) [ "user" "all" ];
16in
17
18assert any (n: n == configFile) [ "kernel" "user" "all" ];
19assert buildKernel -> kernel != null;
20
21stdenv.mkDerivation rec {
22 name = "spl-${configFile}-${version}${optionalString buildKernel "-${kernel.version}"}";
23
24 inherit version src patches;
25
26 buildInputs = [ autoconf automake libtool ];
27
28 preConfigure = ''
29 ./autogen.sh
30
31 substituteInPlace ./module/spl/spl-generic.c --replace /usr/bin/hostid hostid
32 substituteInPlace ./module/spl/spl-module.c --replace /bin/mknod mknod
33
34 substituteInPlace ./module/spl/spl-generic.c --replace "PATH=/sbin:/usr/sbin:/bin:/usr/bin" "PATH=${coreutils}:${gawk}:/bin"
35 substituteInPlace ./module/splat/splat-vnode.c --replace "PATH=/sbin:/usr/sbin:/bin:/usr/bin" "PATH=${coreutils}:/bin"
36 substituteInPlace ./module/splat/splat-linux.c --replace "PATH=/sbin:/usr/sbin:/bin:/usr/bin" "PATH=${coreutils}:/bin"
37 '';
38
39 configureFlags = [
40 "--with-config=${configFile}"
41 ] ++ optionals buildKernel [
42 "--with-linux=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source"
43 "--with-linux-obj=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
44 ];
45
46 enableParallelBuilding = true;
47
48 meta = {
49 description = "Kernel module driver for solaris porting layer (needed by in-kernel zfs)";
50
51 longDescription = ''
52 This kernel module is a porting layer for ZFS to work inside the linux
53 kernel.
54 '';
55
56 homepage = http://zfsonlinux.org/;
57 platforms = platforms.linux;
58 license = licenses.gpl2Plus;
59 maintainers = with maintainers; [ jcumming wizeman wkennington ];
60 };
61}