summary refs log tree commit diff
path: root/pkgs/os-specific/linux/ndiswrapper/default.nix
blob: e989a7837f9e94cfb561990e54ee5e6589cf16d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ stdenv, fetchurl, kernel, perl, kmod }:

stdenv.mkDerivation {
  name = "ndiswrapper-1.59-${kernel.version}";

  hardeningDisable = [ "pic" ];

  patches = [ ./no-sbin.patch ];

  # need at least .config and include 
  kernel = kernel.dev;

  buildPhase = "
    echo make KBUILD=$(echo \$kernel/lib/modules/*/build);
    echo -n $kernel/lib/modules/*/build > kbuild_path
    export PATH=${kmod}/sbin:$PATH
    make KBUILD=$(echo \$kernel/lib/modules/*/build);
  ";

  installPhase = ''
    make install KBUILD=$(cat kbuild_path) DESTDIR=$out
    mv $out/usr/sbin/* $out/sbin/
    mv $out/usr/share $out/
    rm -r $out/usr

    patchShebangs $out/sbin
  '';

  # should we use unstable? 
  src = fetchurl {
    url = mirror://sourceforge/ndiswrapper/ndiswrapper-1.59.tar.gz;
    sha256 = "1g6lynccyg4m7gd7vhy44pypsn8ifmibq6rqgvc672pwngzx79b6";
  };

  buildInputs = [ perl ];

  meta = { 
    description = "Ndis driver wrapper for the Linux kernel";
    homepage = https://sourceforge.net/projects/ndiswrapper;
    license = "GPL";
    broken = true;
  };
}