Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 143 lines 3.4 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 wrapQtAppsHook, 6 qmake, 7 pkg-config, 8 qtbase, 9 qtsvg, 10 qttools, 11 qtserialport, 12 qtwayland, 13 qt5compat, 14 boost, 15 libngspice, 16 libgit2, 17 quazip, 18 clipper, 19}: 20 21let 22 # SHA256 of the fritzing-parts HEAD on the master branch, 23 # which contains the latest stable parts definitions 24 partsSha = "76235099ed556e52003de63522fdd74e61d53a36"; 25 26 parts = fetchFromGitHub { 27 owner = "fritzing"; 28 repo = "fritzing-parts"; 29 rev = partsSha; 30 hash = "sha256-1QVcPbRBOSYnNFsp7B2OyPXYuPaINRv9yEqGZFd662Y="; 31 }; 32 33 # Header-only library 34 svgpp = fetchFromGitHub { 35 owner = "svgpp"; 36 repo = "svgpp"; 37 tag = "v1.3.1"; 38 hash = "sha256-nW0ns06XWfUi22nOKZzFKgAOHVIlQqChW8HxUDOFMh4="; 39 }; 40in 41 42stdenv.mkDerivation { 43 pname = "fritzing"; 44 version = "1.0.4"; 45 46 src = fetchFromGitHub { 47 owner = "fritzing"; 48 repo = "fritzing-app"; 49 rev = "a8c6ef7cf66f7a42b9b233d6137f1b70a9573a25"; 50 hash = "sha256-a/bWAUeDPj3g8BECOlXuqyCi4JgGLLs1605m380Drt0="; 51 }; 52 53 patches = [ 54 # Fix build with Qt >= 6.9 55 ./fix-stricter-types.patch 56 ]; 57 58 nativeBuildInputs = [ 59 qmake 60 pkg-config 61 qttools 62 wrapQtAppsHook 63 ]; 64 65 buildInputs = [ 66 qtbase 67 qtsvg 68 qtserialport 69 qt5compat 70 boost 71 libgit2 72 quazip 73 libngspice 74 clipper 75 ] 76 ++ lib.optionals stdenv.hostPlatform.isLinux [ 77 qtwayland 78 ]; 79 80 postPatch = '' 81 # Use packaged quazip, libgit and ngspice 82 sed -i "/pri\/quazipdetect.pri/d" phoenix.pro 83 sed -i "/pri\/spicedetect.pri/d" phoenix.pro 84 substituteInPlace pri/libgit2detect.pri \ 85 --replace-fail 'LIBGIT_STATIC = true' 'LIBGIT_STATIC = false' 86 87 #TODO: Do not hardcode SHA. 88 substituteInPlace src/fapplication.cpp \ 89 --replace-fail 'PartsChecker::getSha(dir.absolutePath());' '"${partsSha}";' 90 91 substituteInPlace phoenix.pro \ 92 --replace-fail "6.5.10" "${qtbase.version}" 93 94 substituteInPlace src/simulation/ngspice_simulator.cpp \ 95 --replace-fail 'path + "/" + libName' '"${libngspice}/lib/libngspice.so"' 96 97 mkdir parts 98 cp -a ${parts}/* parts/ 99 ''; 100 101 env = { 102 NIX_CFLAGS_COMPILE = lib.concatStringsSep " " [ 103 "-I${lib.getDev quazip}/include/QuaZip-Qt${lib.versions.major qtbase.version}-${quazip.version}" 104 "-I${svgpp}/include" 105 "-I${clipper}/include/polyclipping" 106 ]; 107 NIX_LDFLAGS = "-lquazip1-qt${lib.versions.major qtbase.version}"; 108 }; 109 110 qmakeFlags = [ 111 "phoenix.pro" 112 ]; 113 114 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' 115 mkdir $out/Applications 116 mv $out/bin/Fritzing.app $out/Applications/Fritzing.app 117 cp FritzingInfo.plist $out/Applications/Fritzing.app/Contents/Info.plist 118 makeWrapper $out/Applications/Fritzing.app/Contents/MacOS/Fritzing $out/bin/Fritzing 119 ''; 120 121 postFixup = '' 122 # generate the parts.db file 123 QT_QPA_PLATFORM=offscreen "$out/bin/Fritzing" \ 124 -db "$out/share/fritzing/parts/parts.db" \ 125 -pp "$out/share/fritzing/parts" \ 126 -folder "$out/share/fritzing" 127 ''; 128 129 meta = { 130 description = "Open source prototyping tool for Arduino-based projects"; 131 homepage = "https://fritzing.org"; 132 license = with lib.licenses; [ 133 gpl3 134 cc-by-sa-30 135 ]; 136 maintainers = with lib.maintainers; [ 137 robberer 138 muscaln 139 ]; 140 platforms = lib.platforms.unix; 141 mainProgram = "Fritzing"; 142 }; 143}