nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 115 lines 3.3 kB view raw
1{ 2 lib, 3 stdenv, 4 copyDesktopItems, 5 buildNpmPackage, 6 electron, 7 fetchFromGitLab, 8 makeBinaryWrapper, 9 makeDesktopItem, 10 nix-update-script, 11}: 12buildNpmPackage (finalAttrs: { 13 pname = "gridtracker2"; 14 version = "2.260101.3"; 15 16 src = fetchFromGitLab { 17 owner = "gridtracker.org"; 18 repo = "gridtracker2"; 19 tag = "v${finalAttrs.version}"; 20 hash = "sha256-Gtz5/caaDAIwG/vqtOO9w5ouysAIzQgD7GcTvXri8T8="; 21 }; 22 23 npmDepsHash = "sha256-8bhOfLLsNSK+/mXku5ukLr65bfk+RwC3SyOGRHndqVQ="; 24 25 nativeBuildInputs = [ 26 makeBinaryWrapper 27 copyDesktopItems 28 ]; 29 30 env.ELECTRON_SKIP_BINARY_DOWNLOAD = true; 31 32 makeCacheWritable = true; 33 34 desktopItems = [ 35 (makeDesktopItem { 36 name = "GridTracker2"; 37 desktopName = "GridTracker2"; 38 exec = "gridtracker2 %U"; 39 terminal = false; 40 type = "Application"; 41 icon = "gridtracker2"; 42 startupWMClass = "GridTracker2"; 43 comment = "A warehouse of amateur radio information"; 44 categories = [ 45 "HamRadio" 46 "Network" 47 ]; 48 }) 49 ]; 50 51 buildPhase = '' 52 runHook preBuild 53 '' 54 + lib.optionalString stdenv.hostPlatform.isDarwin '' 55 # electronDist needs to be modifiable on Darwin 56 cp -r ${electron.dist} electron-dist 57 chmod -R u+w electron-dist 58 59 # Disable code signing during build on macOS. 60 # https://github.com/electron-userland/electron-builder/blob/fa6fc16/docs/code-signing.md#how-to-disable-code-signing-during-the-build-process-on-macos 61 export CSC_IDENTITY_AUTO_DISCOVERY=false 62 63 npm exec electron-builder -- \ 64 --dir \ 65 -c.electronDist=electron-dist \ 66 -c.electronVersion=${electron.version} 67 '' 68 + lib.optionalString stdenv.hostPlatform.isLinux '' 69 npm exec electron-builder -- \ 70 --dir \ 71 -c.electronDist=${electron.dist} \ 72 -c.electronVersion=${electron.version} 73 '' 74 + '' 75 runHook postBuild 76 ''; 77 78 installPhase = '' 79 runHook preInstall 80 81 '' 82 + lib.optionalString stdenv.hostPlatform.isLinux '' 83 install -Dvm644 -t "$out/share/gridtracker2/resources" \ 84 ./dist/linux*/resources/* 85 install -Dvm644 -t "$out/share/gridtracker2/locales" \ 86 ./dist/linux*/locales/* 87 install -Dvm644 ./resources/icon.png \ 88 "$out/share/pixmaps/gridtracker2.png" 89 90 makeWrapper ${lib.getExe electron} $out/bin/gridtracker2 \ 91 --add-flags $out/share/gridtracker2/resources/app.asar \ 92 --add-flags "--no-sandbox --disable-gpu-sandbox" \ 93 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \ 94 --inherit-argv0 95 '' 96 + lib.optionalString stdenv.hostPlatform.isDarwin '' 97 mkdir -p $out/Applications $out/bin 98 cp -r dist/mac*/GridTracker2.app $out/Applications 99 ln -s $out/Applications/GridTracker2.app/Contents/MacOS/GridTracker2 $out/bin/gridtracker2 100 '' 101 + '' 102 runHook postInstall 103 ''; 104 105 passthru.updateScript = nix-update-script { }; 106 107 meta = { 108 description = "Warehouse of amateur radio information"; 109 homepage = "https://gridtracker.org/"; 110 license = lib.licenses.bsd3; 111 platforms = electron.meta.platforms; 112 maintainers = with lib.maintainers; [ Cryolitia ]; 113 mainProgram = "gridtracker2"; 114 }; 115})