liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

default.nix (1015B)


      1 { stdenv, buildPackages, libnl, ...} :
      2 let switchDotH = buildPackages.fetchurl {
      3   url = "https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob_plain;f=target/linux/generic/files/include/uapi/linux/switch.h;hb=99a188828713d6ff9c541590b08d4e63ef52f6d7";
      4   sha256 = "15kmhhcpd84y4f45rf8zai98c61jyvkc37p90pcxirna01x33wi8";
      5   name="switch.h";
      6 };
      7 in stdenv.mkDerivation {
      8   src = buildPackages.fetchFromGitHub {
      9     owner = "jekader";
     10     repo = "swconfig";
     11     rev = "66c760893ecdd1d603a7231fea9209daac57b610";
     12     sha256 = "0hi2rj1a1fbvr5n1090q1zzigjyxmn643jzrwngw4ij0g82za3al";
     13   };
     14   name = "swconfig";
     15   buildInputs = [ buildPackages.pkg-config ];
     16   nativeBuildInputs = [ libnl ];
     17   CFLAGS="-O2 -Ifrom_kernel -I${libnl.dev}/include/libnl3";
     18   LDFLAGS="-L${libnl.out}/lib";
     19 
     20   patchPhase = ''
     21     mkdir -p from_kernel/linux
     22     cp ${switchDotH} from_kernel/linux/switch.h
     23   '';
     24 
     25   buildPhase = ''
     26     make swconfig
     27     $STRIP swconfig
     28   '';
     29   installPhase = ''
     30     mkdir -p $out/bin
     31     cp swconfig $out/bin
     32   '';
     33 }