1{ 2 stdenv, 3 fetchurl, 4 lib, 5}: 6 7{ version, src, ... }: 8 9let 10 artifacts = 11 lib.mapAttrs 12 (version: hash: rec { 13 file = fetchurl { 14 inherit url hash; 15 }; 16 url = 17 if lib.versionOlder version "v4_6_1" then 18 "https://storage.googleapis.com/simon-public-euw3/assets/sqlcipher/${version}.c" 19 else 20 "https://fsn1.your-objectstorage.com/simon-public/assets/sqlcipher/${version}.c"; 21 }) 22 { 23 v4_10_0 = "sha256-3njvCHy8Juj+WE3gXxeQ8+NIl9uHMegVTcZ00/LfKMs="; 24 v4_9_0 = "sha256-uqvW5BgMjCS0GzeEDeGskb4It0NkWjNUpyXpGlBSIlc="; 25 v4_8_0 = "sha256-nfYmi9PJlMbLqiFRksOIUXYHgD8LL2AVey9GCUc03Jw="; 26 v4_6_1 = "sha256-8kBJiy8g1odpBQQUF5A7f9g3+WStbJTARyfvAi84YVE="; 27 v4_5_7 = "sha256-lDgSEVGZcoruF7nAp0C2kr6TN7XllpMzMVi/R1XfGP4="; 28 v4_5_6 = "sha256-evZl3JUeyAfW0fGJ0EfFQs64Z/yRCZGeOeDGgXrFHFU="; 29 }; 30in 31stdenv.mkDerivation rec { 32 pname = "sqlcipher_flutter_libs"; 33 inherit version src; 34 inherit (src) passthru; 35 36 installPhase = '' 37 runHook preInstall 38 39 cp -r "$src" "$out" 40 _replace() { 41 # --replace-fail messes with the file if it fails (is empty afterwards) so we do this instead 42 if cat "$out/linux/CMakeLists.txt" | grep "$1" >/dev/null 2>/dev/null; then 43 substituteInPlace "$out/linux/CMakeLists.txt" --replace "$1" "file://$2" 44 else 45 return 2 46 fi 47 } 48 49 ${lib.concatMapAttrsStringSep " || " (_: v: ''_replace "${v.url}" "${v.file}"'') artifacts} || \ 50 (echo "unknown version of sqlcipher, please add to pkgs/development/compilers/dart/package-source-builders/sqlcipher_flutter_libs" && cat linux/CMakeLists.txt | grep "https://storage.*" -o && exit 2) 51 52 runHook postInstall 53 ''; 54 55 meta.sourceProvenance = [ lib.sourceTypes.binaryBytecode ]; 56}