default.nix (1609B)
1 { 2 lib, 3 stdenv, 4 fetchzip, 5 gcc-arm-embedded, 6 zip, 7 platform ? null, 8 platformsub ? null, 9 fi2key ? null, 10 fi2iv ? null, 11 }: 12 13 let 14 version = "1.6.1"; 15 revision = "6261"; # check on http://mighty-hoernsche.de/ 16 branch = "release-${lib.replaceStrings [ "." ] [ "_" ] (lib.versions.majorMinor version)}"; 17 optFI2 = fi2key != null && fi2iv != null; 18 batchBuild = platform == null || platformsub == null; 19 in 20 stdenv.mkDerivation { 21 pname = "chdk"; 22 inherit version; 23 24 src = fetchzip { 25 url = "https://app.assembla.com/spaces/chdk/subversion/source/${revision}/branches/${branch}?_format=zip"; 26 extension = "zip"; 27 stripRoot = false; 28 hash = "sha256-VNkPju3nVxk1g5SzRZok5994JVupySbO7KZsD6sgXo8="; 29 }; 30 31 nativeBuildInputs = [ 32 gcc-arm-embedded 33 zip 34 ]; 35 36 buildFlags = 37 [ 38 "DEF_SVN_REF=${revision}" 39 "HOSTCC=${stdenv.cc.targetPrefix}cc" 40 ] 41 ++ lib.optionals (optFI2 && !batchBuild) [ 42 "OPT_FI2=1" 43 "FI2KEY=${fi2key}" 44 "FI2IV=${fi2iv}" 45 ] 46 ++ lib.optionals (!batchBuild) [ 47 "PLATFORM=${platform}" 48 "PLATFORMSUB=${platformsub}" 49 "firzipsubcomplete" 50 ] 51 ++ lib.optional batchBuild "batch-zip-complete"; 52 53 env.NIX_CFLAGS_COMPILE = "-Wno-format-security"; 54 55 installPhase = '' 56 runHook preInstall 57 install -Dm644 bin/*.zip -t $out 58 runHook postInstall 59 ''; 60 61 meta = { 62 description = "Canon Hack Development Kit"; 63 homepage = "https://chdk.fandom.com/wiki/CHDK"; 64 license = lib.licenses.gpl2; 65 platforms = lib.platforms.unix; 66 maintainers = [ lib.maintainers.sikmir ]; 67 skip.ci = true; 68 }; 69 }