nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at netboot-syslinux-multiplatform 120 lines 3.1 kB view raw
1{ lib 2, stdenv 3, fetchurl 4, autoPatchelfHook 5, qt4 6, udev 7, config 8, acceptLicense ? config.segger-jlink.acceptLicense or false 9}: 10 11let 12 supported = { 13 x86_64-linux = { 14 name = "x86_64"; 15 sha256 = "90aa7e4f5eae6e60fd41978111b3ff124ba0269562d0d0ec3110d3cb4bb51fe2"; 16 }; 17 i686-linux = { 18 name = "i386"; 19 sha256 = "18aea42cd17591cada78af7cba0f94a9d851e9d29995b6c8e1e7033d0af35d1c"; 20 }; 21 aarch64-linux = { 22 name = "arm64"; 23 sha256 = "db410c1df80748827b4e25ff3abceee29e28305a0a7e30e4e39bb5c7e32f1aa2"; 24 }; 25 armv7l-linux = { 26 name = "arm"; 27 sha256 = "abcdaf44aeb2ad4e769709ec4fe971e259b23d297a98f58199c7bdf26db82e84"; 28 }; 29 }; 30 31 platform = supported.${stdenv.system} or (throw "unsupported platform ${stdenv.system}"); 32 33 version = "766"; 34 35 url = "https://www.segger.com/downloads/jlink/JLink_Linux_V${version}_${platform.name}.tgz"; 36 37in stdenv.mkDerivation { 38 pname = "segger-jlink"; 39 inherit version; 40 41 src = 42 assert !acceptLicense -> throw '' 43 Use of the "SEGGER JLink Software and Documentation pack" requires the 44 acceptance of the following licenses: 45 46 - SEGGER Downloads Terms of Use [1] 47 - SEGGER Software Licensing [2] 48 49 You can express acceptance by setting acceptLicense to true in your 50 configuration. Note that this is not a free license so it requires allowing 51 unfree licenses as well. 52 53 configuration.nix: 54 nixpkgs.config.allowUnfree = true; 55 nixpkgs.config.segger-jlink.acceptLicense = true; 56 57 config.nix: 58 allowUnfree = true; 59 segger-jlink.acceptLicense = true; 60 61 [1]: ${url} 62 [2]: https://www.segger.com/purchase/licensing/ 63 ''; 64 fetchurl { 65 inherit url; 66 inherit (platform) sha256; 67 curlOpts = "--data accept_license_agreement=accepted"; 68 }; 69 70 # Currently blocked by patchelf bug 71 # https://github.com/NixOS/patchelf/pull/275 72 #runtimeDependencies = [ udev ]; 73 74 nativeBuildInputs = [ autoPatchelfHook ]; 75 buildInputs = [ qt4 udev ]; 76 77 dontConfigure = true; 78 dontBuild = true; 79 80 installPhase = '' 81 runHook preInstall 82 83 # Install binaries 84 mkdir -p $out/bin 85 mv J* $out/bin 86 87 # Install libraries 88 mkdir -p $out/lib 89 mv libjlinkarm.so* $out/lib 90 # This library is opened via dlopen at runtime 91 for libr in $out/lib/*; do 92 ln -s $libr $out/bin 93 done 94 95 # Install docs and examples 96 mkdir -p $out/share/docs 97 mv Doc/* $out/share/docs 98 mkdir -p $out/share/examples 99 mv Samples/* $out/share/examples 100 101 # Install udev rule 102 mkdir -p $out/lib/udev/rules.d 103 mv 99-jlink.rules $out/lib/udev/rules.d/ 104 105 runHook postInstall 106 ''; 107 108 preFixup = '' 109 # Workaround to setting runtime dependecy 110 patchelf --add-needed libudev.so.1 $out/lib/libjlinkarm.so 111 ''; 112 113 meta = with lib; { 114 description = "J-Link Software and Documentation pack"; 115 homepage = "https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack"; 116 license = licenses.unfree; 117 platforms = attrNames supported; 118 maintainers = with maintainers; [ FlorianFranzen stargate01 ]; 119 }; 120}