commit b263b73244f72a6d2e492fe81c02150899597014
parent 1d91e9e5d0c094dd06e9b896bef61b04a6eb628c
Author: Nikolay Korotkiy <sikmir@disroot.org>
Date: Sun, 6 Nov 2022 18:00:24 +0300
Add chdk
Diffstat:
2 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -95,6 +95,10 @@ lib.makeScope newScope (
s2sphere = callPackage ./development/python-modules/s2sphere { };
xyzservices = callPackage ./development/python-modules/xyzservices { };
+ ### EMBEDDED
+
+ chdk = callPackage ./embedded/chdk { };
+
### EMBOX
embox-aarch64 = callPackage ./embox { arch = "aarch64"; };
diff --git a/pkgs/embedded/chdk/default.nix b/pkgs/embedded/chdk/default.nix
@@ -0,0 +1,47 @@
+{ lib, stdenv, fetchzip, gcc-arm-embedded, zip
+, platform ? null, platformsub ? null
+, fi2key ? null, fi2iv ? null
+}:
+
+let
+ version = "1.6.1";
+ revision = "6200"; # check on http://mighty-hoernsche.de/
+ branch = "release-${lib.replaceStrings [ "." ] [ "_" ] (lib.versions.majorMinor version)}";
+ optFI2 = fi2key != null && fi2iv != null;
+ batchBuild = platform == null || platformsub == null;
+in
+stdenv.mkDerivation rec {
+ pname = "chdk";
+ inherit version;
+
+ src = fetchzip {
+ url = "https://app.assembla.com/spaces/chdk/subversion/source/${revision}/branches/${branch}?_format=zip";
+ extension = "zip";
+ stripRoot = false;
+ hash = "sha256-m/sERI0Qrcwbv4VWUfLAVttD2KWpYtNpj6r6tXKs9PE=";
+ };
+
+ nativeBuildInputs = [ gcc-arm-embedded zip ];
+
+ buildFlags = [ "DEF_SVN_REF=${revision}" ]
+ ++ lib.optionals (optFI2 && !batchBuild) [ "OPT_FI2=1" "FI2KEY=${fi2key}" "FI2IV=${fi2iv}" ]
+ ++ lib.optionals (!batchBuild) [ "PLATFORM=${platform}" "PLATFORMSUB=${platformsub}" "firzipsubcomplete" ]
+ ++ lib.optional batchBuild "batch-zip-complete";
+
+ NIX_CFLAGS_COMPILE = "-Wno-format-security";
+
+ installPhase = ''
+ runHook preInstall
+ install -Dm644 bin/*.zip -t $out
+ runHook postInstall
+ '';
+
+ meta = with lib; {
+ description = "Canon Hack Development Kit";
+ homepage = "https://chdk.fandom.com/wiki/CHDK";
+ license = licenses.gpl2;
+ platforms = platforms.unix;
+ maintainers = [ maintainers.sikmir ];
+ skip.ci = true;
+ };
+}