Merge pull request #250627 from TomaSajt/ride

ride: init at 4.5.4097

authored by Pol Dellaiera and committed by GitHub 7c3c7835 032b636d

+186
+34
pkgs/by-name/ri/ride/mk.patch
··· 1 + diff --git a/mk b/mk 2 + index a5baa0f8..37cac28e 100755 3 + --- a/mk 4 + +++ b/mk 5 + @@ -25,7 +25,7 @@ const rm = (x) => { 6 + }; 7 + const pj = JSON.parse(rf('package.json')); 8 + // v:version string - "x.y.z" where z is the number of commits since the beginning of the project 9 + -const v = `${pj.version.replace(/\.0$/, '')}.${sh('git rev-list --count HEAD')}`; 10 + +const v = "@version@"; 11 + const isDyalogBuild = /^dyalog/.test(pj.name); 12 + const tasks = { }; 13 + 14 + @@ -36,8 +36,8 @@ const b = (f) => { 15 + const vi = { 16 + versionInfo: { 17 + version: v, 18 + - date: sh('git show -s HEAD --pretty=format:%ci'), 19 + - rev: sh('git rev-parse HEAD'), 20 + + date: 'unknown', 21 + + rev: 'nixpkgs', 22 + }, 23 + }; 24 + wf('_/version.js', `D=${JSON.stringify(vi)}`); 25 + @@ -50,6 +50,9 @@ const incl = new RegExp('^$' 26 + + '|^/style($|/(fonts|img)|.*\\.css$)'); 27 + const pkg = (x, y, f) => { 28 + rq('electron-packager')({ 29 + + asar: true, 30 + + electronZipDir: "local-cache", 31 + + electronVersion: "@electron_version@", 32 + dir: '.', 33 + platform: x, 34 + arch: y,
+152
pkgs/by-name/ri/ride/package.nix
··· 1 + { 2 + lib, 3 + stdenv, 4 + buildNpmPackage, 5 + fetchFromGitHub, 6 + substituteAll, 7 + jq, 8 + moreutils, 9 + zip, 10 + makeWrapper, 11 + copyDesktopItems, 12 + makeDesktopItem, 13 + electron_27, 14 + }: 15 + 16 + let 17 + platformInfos = { 18 + "x86_64-linux" = { 19 + zipSuffix = "linux-x64"; 20 + buildCmd = "linux"; 21 + }; 22 + "x86_64-darwin" = { 23 + zipSuffix = "darwin-x64"; 24 + buildCmd = "osx"; 25 + }; 26 + "aarch64-darwin" = { 27 + zipSuffix = "darwin-arm64"; 28 + buildCmd = "osxarm"; 29 + }; 30 + }; 31 + 32 + platformInfo = platformInfos.${stdenv.system}; 33 + 34 + # Electron 27 is the latest version that works as of RIDE version 4.5.4097 35 + electron = electron_27; 36 + in 37 + buildNpmPackage rec { 38 + pname = "ride"; 39 + version = "4.5.4097"; 40 + 41 + src = fetchFromGitHub { 42 + owner = "Dyalog"; 43 + repo = "ride"; 44 + rev = "v${version}"; 45 + hash = "sha256-xR+HVC1JVrPkgPhIJZxdTVG52+QbanmD1c/uO5l84oc="; 46 + }; 47 + 48 + npmDepsHash = "sha256-EG3pZkjDGBI2dDaQZ6351+oU4xfHd6HNB8eD7ErpYIg="; 49 + 50 + patches = [ 51 + # Fix info in the "about" page, set electron version, set local-cache as zipdir 52 + (substituteAll { 53 + src = ./mk.patch; 54 + version = version; 55 + electron_version = electron.version; 56 + }) 57 + ]; 58 + 59 + postPatch = '' 60 + # Remove spectron (it would download electron-chromedriver binaries) 61 + ${jq}/bin/jq 'del(.devDependencies.spectron)' package.json | ${moreutils}/bin/sponge package.json 62 + 63 + pushd style 64 + 65 + # Remove non-deterministic glob ordering 66 + sed -i "/\*\*/d" layout.less light-theme.less dark-theme.less 67 + 68 + # Individually include all files that were previously globbed 69 + shopt -s globstar 70 + for file in less/layout/**/*.less; do 71 + echo "@import '$file';" >> layout.less 72 + done 73 + for file in less/colour/**/*.less; do 74 + echo "@import '$file';" >> light-theme.less 75 + echo "@import '$file';" >> dark-theme.less 76 + done 77 + shopt -u globstar 78 + 79 + popd 80 + ''; 81 + 82 + nativeBuildInputs = [ 83 + zip 84 + makeWrapper 85 + copyDesktopItems 86 + ]; 87 + 88 + env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; 89 + 90 + npmBuildFlags = platformInfo.buildCmd; 91 + 92 + # This package uses electron-packager instead of electron-builder 93 + # Here, we create a local cache of electron zip-files, so electron-packager can copy from it 94 + postConfigure = '' 95 + mkdir local-cache 96 + cp -r --no-preserve=all ${electron}/libexec/electron electron 97 + pushd electron 98 + zip -qr ../local-cache/electron-v${electron.version}-${platformInfo.zipSuffix}.zip * 99 + popd 100 + ''; 101 + 102 + installPhase = '' 103 + runHook preInstall 104 + 105 + install -Dm644 D.png $out/share/icons/hicolor/64x64/apps/ride.png 106 + install -Dm644 D.svg $out/share/icons/hicolor/scalable/apps/ride.svg 107 + 108 + pushd _/ride*/* 109 + 110 + install -Dm644 ThirdPartyNotices.txt -t $out/share/doc/ride 111 + 112 + mkdir -p $out/share/ride 113 + cp -r locales resources{,.pak} $out/share/ride 114 + makeWrapper ${lib.getExe electron} $out/bin/ride \ 115 + --add-flags $out/share/ride/resources/app.asar \ 116 + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \ 117 + --inherit-argv0 118 + 119 + popd 120 + 121 + runHook postInstall 122 + ''; 123 + 124 + desktopItems = [ 125 + (makeDesktopItem { 126 + name = "ride"; 127 + exec = "ride"; 128 + icon = "ride"; 129 + desktopName = "RIDE"; 130 + categories = [ 131 + "Development" 132 + "IDE" 133 + ]; 134 + comment = meta.description; 135 + terminal = false; 136 + }) 137 + ]; 138 + 139 + meta = { 140 + broken = stdenv.isDarwin; 141 + changelog = "https://github.com/Dyalog/ride/releases/tag/${src.rev}"; 142 + description = "Remote IDE for Dyalog APL"; 143 + homepage = "https://github.com/Dyalog/ride"; 144 + license = lib.licenses.mit; 145 + mainProgram = "ride"; 146 + maintainers = with lib.maintainers; [ 147 + tomasajt 148 + markus1189 149 + ]; 150 + platforms = lib.attrNames platformInfos; 151 + }; 152 + }