diff options
Diffstat (limited to 'pkgs/by-name/ri/ride/package.nix')
-rw-r--r-- | pkgs/by-name/ri/ride/package.nix | 76 |
1 files changed, 27 insertions, 49 deletions
diff --git a/pkgs/by-name/ri/ride/package.nix b/pkgs/by-name/ri/ride/package.nix index 9706b388dbf7..f2f8ca1a978a 100644 --- a/pkgs/by-name/ri/ride/package.nix +++ b/pkgs/by-name/ri/ride/package.nix @@ -4,7 +4,7 @@ buildNpmPackage, fetchFromGitHub, fetchpatch, - substituteAll, + replaceVars, jq, moreutils, zip, @@ -12,27 +12,9 @@ copyDesktopItems, makeDesktopItem, electron, - cctools, + apple-sdk_11, }: -let - platformInfos = { - "x86_64-linux" = { - zipSuffix = "linux-x64"; - buildCmd = "linux"; - }; - "x86_64-darwin" = { - zipSuffix = "darwin-x64"; - buildCmd = "osx"; - }; - "aarch64-darwin" = { - zipSuffix = "darwin-arm64"; - buildCmd = "osxarm"; - }; - }; - - platformInfo = platformInfos.${stdenv.system}; -in buildNpmPackage rec { pname = "ride"; version = "4.5.4097"; @@ -40,7 +22,7 @@ buildNpmPackage rec { src = fetchFromGitHub { owner = "Dyalog"; repo = "ride"; - rev = "v${version}"; + rev = "refs/tags/v${version}"; hash = "sha256-xR+HVC1JVrPkgPhIJZxdTVG52+QbanmD1c/uO5l84oc="; }; @@ -53,11 +35,10 @@ buildNpmPackage rec { url = "https://github.com/Dyalog/ride/commit/de42ebbd5036cfe0c7e6604296e87cc57ac9d365.patch"; hash = "sha256-5iKSNcxOOo2fKNvy3Rv+AlH3psYhLWLWUY0l8M6mAD4="; }) - # Fix info in the "about" page, set electron version, set local-cache as zipdir - (substituteAll { - src = ./mk.patch; - version = version; - electron_version = electron.version; + + # Fix info in the "about" page, enable asar, add option to build for the detected system + (replaceVars ./mk.patch { + inherit version; }) ]; @@ -84,35 +65,32 @@ buildNpmPackage rec { popd ''; - nativeBuildInputs = - [ - zip - makeWrapper - ] - ++ lib.optionals (!stdenv.isDarwin) [ copyDesktopItems ] - ++ lib.optionals stdenv.isDarwin [ cctools ]; + nativeBuildInputs = [ + zip + makeWrapper + ] ++ lib.optionals stdenv.hostPlatform.isLinux [ copyDesktopItems ]; - env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; + buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_11 ]; - # Fix error: no member named 'aligned_alloc' in the global namespace - env.NIX_CFLAGS_COMPILE = lib.optionalString ( - stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinSdkVersion "11.0" - ) "-D_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION=1"; + env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; - npmBuildFlags = platformInfo.buildCmd; + # our patch adds the platform detecting build option + npmBuildFlags = "self"; - # This package uses electron-packager instead of electron-builder - # Here, we create a local cache of electron zip-files, so electron-packager can copy from it postConfigure = '' - mkdir local-cache - # electron files need to be writable on Darwin cp -r ${electron.dist} electron-dist chmod -R u+w electron-dist pushd electron-dist - zip -qr ../local-cache/electron-v${electron.version}-${platformInfo.zipSuffix}.zip * + zip -0Xqr ../electron.zip * popd + + rm -r electron-dist + + # force electron-packager to use our electron instead of downloading it, even if it is a different version + substituteInPlace node_modules/electron-packager/src/index.js \ + --replace-fail 'await this.getElectronZipPath(downloadOpts)' '"electron.zip"' ''; installPhase = '' @@ -122,19 +100,19 @@ buildNpmPackage rec { install -Dm644 ThirdPartyNotices.txt -t $out/share/doc/ride - ${lib.optionalString (!stdenv.isDarwin) '' + ${lib.optionalString stdenv.hostPlatform.isLinux '' install -Dm644 $src/D.png $out/share/icons/hicolor/64x64/apps/ride.png install -Dm644 $src/D.svg $out/share/icons/hicolor/scalable/apps/ride.svg mkdir -p $out/share/ride cp -r locales resources{,.pak} $out/share/ride - makeWrapper ${lib.getExe electron} $out/bin/ride \ + makeShellWrapper ${lib.getExe electron} $out/bin/ride \ --add-flags $out/share/ride/resources/app.asar \ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \ --inherit-argv0 ''} - ${lib.optionalString stdenv.isDarwin '' + ${lib.optionalString stdenv.hostPlatform.isDarwin '' mkdir -p $out/Applications cp -r Ride-*.app $out/Applications makeWrapper $out/Applications/Ride-*.app/Contents/MacOS/Ride-* $out/bin/ride @@ -161,7 +139,7 @@ buildNpmPackage rec { ]; meta = { - changelog = "https://github.com/Dyalog/ride/releases/tag/${src.rev}"; + changelog = "https://github.com/Dyalog/ride/releases/tag/v${version}"; description = "Remote IDE for Dyalog APL"; homepage = "https://github.com/Dyalog/ride"; license = lib.licenses.mit; @@ -170,6 +148,6 @@ buildNpmPackage rec { tomasajt markus1189 ]; - platforms = lib.attrNames platformInfos; + platforms = electron.meta.platforms; }; } |