Merge pull request #252557 from gmemstr/redisinsight

redisinsight: init at 2.30.0

authored by

Pierre Bourdon and committed by
GitHub
57a0c58e 4ea62924

+156
+154
pkgs/development/tools/redisinsight/default.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , makeWrapper 5 + , makeDesktopItem 6 + , fixup_yarn_lock 7 + , yarn 8 + , nodejs_18 9 + , python3 10 + , fetchYarnDeps 11 + , electron 12 + , desktopToDarwinBundle 13 + , nest-cli 14 + , libsass 15 + , buildPackages 16 + , pkg-config 17 + , sqlite 18 + , xdg-utils 19 + }: 20 + let 21 + nodejs = nodejs_18; 22 + in 23 + stdenv.mkDerivation (finalAttrs: { 24 + pname = "redisinsight-electron"; 25 + version = "2.30.0"; 26 + 27 + src = fetchFromGitHub { 28 + owner = "RedisInsight"; 29 + repo = "RedisInsight"; 30 + rev = "${finalAttrs.version}"; 31 + hash = "sha256-TzqbMycKcOlUSKvfghip/KdMRiwstkFP+iJG5/9JVlA="; 32 + }; 33 + 34 + offlineCache = fetchYarnDeps { 35 + yarnLock = finalAttrs.src + "/yarn.lock"; 36 + sha256 = "sha256-aDr5wxM/Rp3Tj09nPpLPJHSG5A73+4rAfrMCcxCr7so="; 37 + }; 38 + 39 + feOfflineCache = fetchYarnDeps { 40 + yarnLock = finalAttrs.src + "/redisinsight/yarn.lock"; 41 + sha256 = "sha256-O+8lNDrqPdxE+tgjpKbgm9Q66VlJaJgZRHlNyaFkumM="; 42 + }; 43 + 44 + apiOfflineCache = fetchYarnDeps { 45 + yarnLock = finalAttrs.src + "/redisinsight/api/yarn.lock"; 46 + sha256 = "sha256-2Tvck+9MDj6s+7jehUEyPfJiFFxbMOYDFD/Qgt2En6c="; 47 + }; 48 + 49 + nativeBuildInputs = [ yarn fixup_yarn_lock nodejs makeWrapper python3 nest-cli libsass pkg-config ] 50 + ++ lib.optionals stdenv.isDarwin [ desktopToDarwinBundle ]; 51 + 52 + buildInputs = [ sqlite xdg-utils ]; 53 + 54 + configurePhase = '' 55 + runHook preConfigure 56 + 57 + export HOME=$(mktemp -d) 58 + yarn config --offline set yarn-offline-mirror $offlineCache 59 + fixup_yarn_lock yarn.lock 60 + yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive 61 + 62 + yarn config --offline set yarn-offline-mirror $feOfflineCache 63 + fixup_yarn_lock redisinsight/yarn.lock 64 + yarn --offline --cwd redisinsight/ --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive 65 + 66 + yarn config --offline set yarn-offline-mirror $apiOfflineCache 67 + fixup_yarn_lock redisinsight/api/yarn.lock 68 + yarn --offline --cwd redisinsight/api/ --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive 69 + 70 + patchShebangs node_modules/ 71 + patchShebangs redisinsight/node_modules/ 72 + patchShebangs redisinsight/api/node_modules/ 73 + 74 + mkdir -p "$HOME/.node-gyp/${nodejs.version}" 75 + echo 9 >"$HOME/.node-gyp/${nodejs.version}/installVersion" 76 + ln -sfv "${nodejs}/include" "$HOME/.node-gyp/${nodejs.version}" 77 + export npm_config_nodedir=${nodejs} 78 + 79 + pushd redisinsight 80 + # Build the sqlite3 package. 81 + npm_config_node_gyp="${buildPackages.nodejs}/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" npm rebuild --verbose --sqlite=${sqlite.dev} sqlite3 82 + popd 83 + 84 + substituteInPlace redisinsight/api/config/default.ts \ 85 + --replace "process['resourcesPath']" "\"$out/share/redisinsight\"" \ 86 + 87 + runHook postConfigure 88 + ''; 89 + 90 + buildPhase = '' 91 + runHook preBuild 92 + yarn config --offline set yarn-offline-mirror $offlineCache 93 + 94 + pushd node_modules/node-sass 95 + LIBSASS_EXT=auto yarn run build --offline 96 + popd 97 + 98 + yarn --offline build:prod 99 + 100 + yarn --offline electron-builder \ 101 + --dir ${if stdenv.isDarwin then "--macos" else "--linux"} ${if stdenv.hostPlatform.isAarch64 then "--arm64" else "--x64"} \ 102 + -c.electronDist=${electron}/lib/electron \ 103 + -c.electronVersion=${electron.version} 104 + 105 + runHook postBuild 106 + ''; 107 + 108 + installPhase = '' 109 + runHook preInstall 110 + 111 + # resources 112 + mkdir -p "$out/share/redisinsight" 113 + mkdir -p "$out/share/redisinsight/static/resources/plugins" 114 + mkdir -p "$out/share/redisinsight/default" 115 + 116 + cp -r release/${if stdenv.isDarwin then "darwin-" else "linux-"}${lib.optionalString stdenv.hostPlatform.isAarch64 "arm64-"}unpacked/resources/{app.asar,app.asar.unpacked} $out/share/redisinsight/ 117 + cp -r resources/ $out/share/redisinsight 118 + 119 + # icons 120 + for icon in "$out/resources/icons/*.png"; do 121 + mkdir -p "$out/share/icons/hicolor/$(basename $icon .png)/apps" 122 + ln -s "$icon" "$out/share/icons/hicolor/$(basename $icon .png)/apps/redisinsight.png" 123 + done 124 + 125 + ln -s "${finalAttrs.desktopItem}/share/applications" "$out/share/applications" 126 + 127 + makeWrapper '${electron}/bin/electron' "$out/bin/redisinsight" \ 128 + --add-flags "$out/share/redisinsight/app.asar" \ 129 + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \ 130 + --chdir "$out/share/redisinsight" \ 131 + --argv0 "$out/share/redisinsight/app.asar" 132 + 133 + runHook postInstall 134 + ''; 135 + 136 + desktopItem = makeDesktopItem { 137 + name = "redisinsight"; 138 + exec = "redisinsight %u"; 139 + icon = "redisinsight"; 140 + desktopName = "RedisInsight"; 141 + genericName = "RedisInsight Redis Client"; 142 + comment = finalAttrs.meta.description; 143 + categories = [ "Development" ]; 144 + startupWMClass = "redisinsight"; 145 + }; 146 + 147 + meta = with lib; { 148 + description = "RedisInsight Redis client powered by Electron"; 149 + homepage = "https://github.com/RedisInsight/RedisInsight"; 150 + license = licenses.sspl; 151 + maintainers = with maintainers; [ gmemstr ]; 152 + platforms = [ "x86_64-linux" ]; 153 + }; 154 + })
+2
pkgs/top-level/all-packages.nix
··· 20085 20085 20086 20086 redis-plus-plus = callPackage ../development/libraries/redis-plus-plus { }; 20087 20087 20088 + redisinsight = callPackage ../development/tools/redisinsight { }; 20089 + 20088 20090 redo = callPackage ../development/tools/build-managers/redo { }; 20089 20091 20090 20092 redo-apenwarr = callPackage ../development/tools/build-managers/redo-apenwarr { };