summary refs log blame commit diff
path: root/pkgs/os-specific/linux/kmod-blacklist-ubuntu/default.nix
blob: b894908eb13cca346eb43a94186ce5c33b0f587b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                         
   
                                  


                                     
 
                  

                                                                                               

    

                   
                                  


                                                                               
 

                                                             

                                                                   


                                                    

          
                                                            


                                                               
{ stdenv, fetchurl, gnugrep, findutils }:
let
  version = "18-3ubuntu1"; # Vivid
in
stdenv.mkDerivation {
  name = "kmod-blacklist-${version}";

  src = fetchurl {
    url = "https://launchpad.net/ubuntu/+archive/primary/+files/kmod_${version}.debian.tar.xz";
    sha256 = "14ypc1ij9rjnkz4zklbxpgf0ac1bnqlx0mjv0pjjvrrf857fiq94";
  };

  installPhase = ''
    mkdir "$out"
    for f in modprobe.d/*.conf; do
      echo "''\n''\n## file: "`basename "$f"`"''\n''\n" >> "$out"/modprobe.conf
      cat "$f" >> "$out"/modprobe.conf
    done

    substituteInPlace "$out"/modprobe.conf \
      --replace /sbin/lsmod /run/booted-system/sw/bin/lsmod \
      --replace /sbin/rmmod /run/booted-system/sw/bin/rmmod \
      --replace /sbin/modprobe /run/booted-system/sw/bin/modprobe \
      --replace " grep " " ${gnugrep}/bin/grep " \
      --replace " xargs " " ${findutils}/bin/xargs "
  '';

  meta = {
    homepage = http://packages.ubuntu.com/source/saucy/kmod;
    description = "Linux kernel module blacklists from Ubuntu";
  };
}