electron{,-bin}: add passthru.dist attribute and use treewide (#313442)
This commit is contained in:
@@ -33,13 +33,13 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
ELECTRON_SKIP_BINARY_DOWNLOAD = 1;
|
||||
|
||||
postBuild = lib.optionalString stdenv.isDarwin ''
|
||||
cp -R ${electron}/Applications/Electron.app Electron.app
|
||||
cp -R ${electron.dist}/Electron.app Electron.app
|
||||
chmod -R u+w Electron.app
|
||||
'' + ''
|
||||
pnpm build
|
||||
./node_modules/.bin/electron-builder \
|
||||
--dir \
|
||||
-c.electronDist=${if stdenv.isDarwin then "." else "${electron}/libexec/electron"} \
|
||||
-c.electronDist=${if stdenv.isDarwin then "." else electron.dist} \
|
||||
-c.electronVersion=${electron.version}
|
||||
'';
|
||||
|
||||
|
||||
@@ -63,14 +63,14 @@ stdenv.mkDerivation rec {
|
||||
runHook preBuild
|
||||
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
cp -R ${electron}/Applications/Electron.app Electron.app
|
||||
cp -R ${electron.dist}/Electron.app Electron.app
|
||||
chmod -R u+w Electron.app
|
||||
export CSC_IDENTITY_AUTO_DISCOVERY=false
|
||||
sed -i "/afterSign/d" electron-builder-linux-mac.json
|
||||
'' + ''
|
||||
yarn --offline run electron-builder --dir \
|
||||
${if stdenv.isDarwin then "--config electron-builder-linux-mac.json" else ""} \
|
||||
-c.electronDist=${if stdenv.isDarwin then "." else "${electron}/libexec/electron"} \
|
||||
${lib.optionalString stdenv.isDarwin "--config electron-builder-linux-mac.json"} \
|
||||
-c.electronDist=${if stdenv.isDarwin then "." else electron.dist} \
|
||||
-c.electronVersion=${electron.version}
|
||||
|
||||
runHook postBuild
|
||||
|
||||
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
|
||||
yarnBuildScript = "electron-builder";
|
||||
yarnBuildFlags = [
|
||||
"--dir"
|
||||
"-c.electronDist=${electron}/libexec/electron"
|
||||
"-c.electronDist=${electron.dist}"
|
||||
"-c.electronVersion=${electron.version}"
|
||||
];
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ stdenv.mkDerivation rec {
|
||||
yarn run nextron build --no-pack
|
||||
yarn run electron-builder --dir \
|
||||
--config electron-builder.yml \
|
||||
-c.electronDist="${electron}/libexec/electron" \
|
||||
-c.electronDist="${electron.dist}" \
|
||||
-c.electronVersion=${electron.version}
|
||||
|
||||
runHook postBuild
|
||||
|
||||
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
|
||||
|
||||
npm exec electron-builder -- \
|
||||
--dir \
|
||||
-c.electronDist="${electron_30}/libexec/electron" \
|
||||
-c.electronDist="${electron_30.dist}" \
|
||||
-c.electronVersion="${electron_30.version}"
|
||||
|
||||
runHook postBuild
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
let
|
||||
inherit (darwin.apple_sdk.frameworks) Carbon CoreFoundation ApplicationServices OpenGL;
|
||||
|
||||
electronDist = electron + (if stdenv.isDarwin then "/Applications" else "/libexec/electron");
|
||||
in
|
||||
buildNpmPackage rec {
|
||||
pname = "jitsi-meet-electron";
|
||||
@@ -70,7 +68,7 @@ buildNpmPackage rec {
|
||||
'';
|
||||
|
||||
postBuild = ''
|
||||
cp -r ${electronDist} electron-dist
|
||||
cp -r ${electron.dist} electron-dist
|
||||
chmod -R u+w electron-dist
|
||||
|
||||
# npmRebuild is needed because robotjs won't be built on darwin otherwise
|
||||
|
||||
@@ -50,7 +50,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
yarn --offline electron-builder \
|
||||
--dir ${if stdenv.isDarwin then "--macos" else "--linux"} ${if stdenv.hostPlatform.isAarch64 then "--arm64" else "--x64"} \
|
||||
-c.electronDist=${electron}/libexec/electron \
|
||||
-c.electronDist=${electron.dist} \
|
||||
-c.electronVersion=${electron.version}
|
||||
|
||||
runHook postBuild
|
||||
|
||||
@@ -73,7 +73,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
yarn --offline run build
|
||||
yarn --offline run electron-builder --dir \
|
||||
--config .electron-builder.config.cjs \
|
||||
-c.electronDist=${electron}/libexec/electron \
|
||||
-c.electronDist=${electron.dist} \
|
||||
-c.electronVersion=${electron.version}
|
||||
|
||||
runHook postBuild
|
||||
|
||||
@@ -120,7 +120,7 @@ in buildNpmPackage rec {
|
||||
|
||||
npm exec electron-builder -- \
|
||||
--dir \
|
||||
-c.electronDist=${electron}/libexec/electron \
|
||||
-c.electronDist=${electron.dist} \
|
||||
-c.electronVersion=${electron.version}
|
||||
|
||||
popd
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
electron,
|
||||
}:
|
||||
|
||||
let
|
||||
electronDist = "${electron}/${if stdenv.isDarwin then "Applications" else "libexec/electron"}";
|
||||
in
|
||||
buildNpmPackage rec {
|
||||
pname = "blockbench";
|
||||
version = "4.10.4";
|
||||
@@ -45,7 +42,7 @@ buildNpmPackage rec {
|
||||
|
||||
postBuild = ''
|
||||
# electronDist needs to be modifiable on Darwin
|
||||
cp -r ${electronDist} electron-dist
|
||||
cp -r ${electron.dist} electron-dist
|
||||
chmod -R u+w electron-dist
|
||||
|
||||
npm exec electron-builder -- \
|
||||
|
||||
@@ -103,7 +103,7 @@ buildNpmPackage' rec {
|
||||
${
|
||||
if stdenv.isDarwin then
|
||||
''
|
||||
cp -r ${electron}/Applications/Electron.app ./
|
||||
cp -r ${electron.dist}/Electron.app ./
|
||||
find ./Electron.app -name 'Info.plist' | xargs -d '\n' chmod +rw
|
||||
|
||||
substituteInPlace electron-builder-config.js \
|
||||
@@ -121,7 +121,7 @@ buildNpmPackage' rec {
|
||||
''
|
||||
npm exec electron-builder -- \
|
||||
--dir \
|
||||
-c.electronDist=${electron}/libexec/electron \
|
||||
-c.electronDist=${electron.dist} \
|
||||
-c.electronVersion=${electron.version} \
|
||||
-c.npmRebuild=false
|
||||
''
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
electron,
|
||||
}:
|
||||
|
||||
let
|
||||
electronDist = electron + (if stdenv.isDarwin then "/Applications" else "/libexec/electron");
|
||||
in
|
||||
buildNpmPackage rec {
|
||||
pname = "caprine";
|
||||
version = "2.60.1";
|
||||
@@ -29,7 +26,7 @@ buildNpmPackage rec {
|
||||
nativeBuildInputs = [ copyDesktopItems ];
|
||||
|
||||
postBuild = ''
|
||||
cp -r ${electronDist} electron-dist
|
||||
cp -r ${electron.dist} electron-dist
|
||||
chmod -R u+w electron-dist
|
||||
|
||||
npm exec electron-builder -- \
|
||||
|
||||
@@ -79,7 +79,7 @@ buildNpmPackage {
|
||||
postBuild =
|
||||
lib.optionalString stdenv.isDarwin ''
|
||||
# electron-builder appears to build directly on top of Electron.app, by overwriting the files in the bundle.
|
||||
cp -r ${electron}/Applications/Electron.app ./
|
||||
cp -r ${electron.dist}/Electron.app ./
|
||||
find ./Electron.app -name 'Info.plist' | xargs -d '\n' chmod +rw
|
||||
|
||||
# Disable code signing during build on macOS.
|
||||
@@ -90,7 +90,7 @@ buildNpmPackage {
|
||||
+ ''
|
||||
npm exec electron-builder -- \
|
||||
--dir \
|
||||
-c.electronDist=${if stdenv.isDarwin then "./" else "${electron}/libexec/electron"} \
|
||||
-c.electronDist=${if stdenv.isDarwin then "./" else electron.dist} \
|
||||
-c.electronVersion=${electron.version} \
|
||||
-c.npmRebuild=false
|
||||
'';
|
||||
|
||||
@@ -56,7 +56,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
npm exec electron-builder -- \
|
||||
--dir \
|
||||
-c.electronDist="${electron}/libexec/electron" \
|
||||
-c.electronDist="${electron.dist}" \
|
||||
-c.electronVersion="${electron.version}"
|
||||
|
||||
runHook postBuild
|
||||
|
||||
@@ -13,9 +13,6 @@
|
||||
electron,
|
||||
}:
|
||||
|
||||
let
|
||||
electronDist = electron + (if stdenv.isDarwin then "/Applications" else "/libexec/electron");
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "koodo-reader";
|
||||
version = "1.6.7";
|
||||
@@ -52,7 +49,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
env.CSC_IDENTITY_AUTO_DISCOVERY = "false";
|
||||
|
||||
postBuild = ''
|
||||
cp -r ${electronDist} electron-dist
|
||||
cp -r ${electron.dist} electron-dist
|
||||
chmod -R u+w electron-dist
|
||||
yarn --offline run electron-builder --dir \
|
||||
-c.electronDist=electron-dist \
|
||||
@@ -117,7 +114,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
meta = {
|
||||
changelog = "https://github.com/troyeguo/koodo-reader/releases/tag/v${finalAttrs.version}";
|
||||
description = "A cross-platform ebook reader";
|
||||
description = "Cross-platform ebook reader";
|
||||
longDescription = ''
|
||||
A modern ebook manager and reader with sync and backup capacities
|
||||
for Windows, macOS, Linux and Web
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
makeDesktopItem,
|
||||
copyDesktopItems,
|
||||
}:
|
||||
let
|
||||
electronDist = electron + (if stdenv.isDarwin then "/Applications" else "/libexec/electron");
|
||||
in
|
||||
# NOTE mqtt-explorer has 3 yarn subpackages and uses relative links
|
||||
# between them, which makes it hard to package them via 3 `mkYarnPackage`
|
||||
# since the resulting `node_modules` directories don't have the same structure
|
||||
@@ -88,7 +85,7 @@ stdenv.mkDerivation rec {
|
||||
|
||||
patchShebangs {node_modules,app/node_modules,backend/node_modules}
|
||||
|
||||
cp -r ${electronDist} electron-dist
|
||||
cp -r ${electron.dist} electron-dist
|
||||
chmod -R u+w electron-dist
|
||||
|
||||
runHook postConfigure
|
||||
|
||||
@@ -32,8 +32,6 @@ let
|
||||
};
|
||||
|
||||
platformInfo = platformInfos.${stdenv.system};
|
||||
|
||||
electronDist = electron + (if stdenv.isDarwin then "/Applications" else "/libexec/electron");
|
||||
in
|
||||
buildNpmPackage rec {
|
||||
pname = "ride";
|
||||
@@ -109,7 +107,7 @@ buildNpmPackage rec {
|
||||
mkdir local-cache
|
||||
|
||||
# electron files need to be writable on Darwin
|
||||
cp -r ${electronDist} electron-dist
|
||||
cp -r ${electron.dist} electron-dist
|
||||
chmod -R u+w electron-dist
|
||||
|
||||
pushd electron-dist
|
||||
|
||||
@@ -101,7 +101,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
npm exec electron-builder -- \
|
||||
--dir \
|
||||
--config electron-builder-${platformId}.yml \
|
||||
-c.electronDist=${electron}/libexec/electron \
|
||||
-c.electronDist=${electron.dist} \
|
||||
-c.electronVersion=${electron.version}
|
||||
|
||||
runHook postBuild
|
||||
|
||||
@@ -87,7 +87,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
# electron builds must be writable on darwin
|
||||
preBuild = lib.optionalString stdenv.isDarwin ''
|
||||
cp -r ${electron}/Applications/Electron.app .
|
||||
cp -r ${electron.dist}/Electron.app .
|
||||
chmod -R u+w Electron.app
|
||||
'';
|
||||
|
||||
@@ -98,7 +98,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
pnpm exec electron-builder \
|
||||
--dir \
|
||||
-c.asarUnpack="**/*.node" \
|
||||
-c.electronDist=${if stdenv.isDarwin then "." else "${electron}/libexec/electron"} \
|
||||
-c.electronDist=${if stdenv.isDarwin then "." else electron.dist} \
|
||||
-c.electronVersion=${electron.version}
|
||||
|
||||
runHook postBuild
|
||||
|
||||
@@ -61,7 +61,7 @@ let
|
||||
patchShebangs node_modules
|
||||
|
||||
mkdir -p ~/.cache/electron/${electronDummyHash}
|
||||
cp -ra '${electron}/libexec/electron' "$TMPDIR/electron"
|
||||
cp -ra '${electron.dist}' "$TMPDIR/electron"
|
||||
chmod -R u+w "$TMPDIR/electron"
|
||||
(cd "$TMPDIR/electron" && zip -0Xr ~/.cache/electron/${electronDummyHash}/${electronDummyFilename} .)
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ let
|
||||
++ lib.optionals (lib.versionAtLeast version "17.0.0") [ libGL vulkan-loader ]
|
||||
);
|
||||
|
||||
linux = {
|
||||
linux = finalAttrs: {
|
||||
buildInputs = [ glib gtk3 ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
@@ -142,9 +142,11 @@ let
|
||||
rm "$out/libexec/electron/libvulkan.so.1"
|
||||
ln -s -t "$out/libexec/electron" "${lib.getLib vulkan-loader}/lib/libvulkan.so.1"
|
||||
'';
|
||||
|
||||
passthru.dist = finalAttrs.finalPackage + "/libexec/electron";
|
||||
};
|
||||
|
||||
darwin = {
|
||||
darwin = finalAttrs: {
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
unzip
|
||||
@@ -157,9 +159,12 @@ let
|
||||
mkdir -p $out/bin
|
||||
makeWrapper $out/Applications/Electron.app/Contents/MacOS/Electron $out/bin/electron
|
||||
'';
|
||||
|
||||
passthru.dist = finalAttrs.finalPackage + "/Applications";
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation (
|
||||
(common stdenv.hostPlatform) //
|
||||
(if stdenv.isDarwin then darwin else linux)
|
||||
stdenv.mkDerivation (finalAttrs:
|
||||
lib.recursiveUpdate
|
||||
(common stdenv.hostPlatform)
|
||||
((if stdenv.isDarwin then darwin else linux) finalAttrs)
|
||||
)
|
||||
|
||||
@@ -27,7 +27,7 @@ let
|
||||
|
||||
fetchedDeps = lib.mapAttrs (name: fetchdep) info.deps;
|
||||
|
||||
in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
|
||||
in ((chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
|
||||
packageName = "electron";
|
||||
inherit (info) version;
|
||||
buildTargets = [ "electron:electron_dist_zip" ];
|
||||
@@ -244,4 +244,9 @@ in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
|
||||
hydraPlatforms = lib.optionals (!(hasInfix "alpha" info.version) && !(hasInfix "beta" info.version)) ["aarch64-linux" "x86_64-linux"];
|
||||
timeout = 172800; # 48 hours (increased from the Hydra default of 10h)
|
||||
};
|
||||
})).overrideAttrs (finalAttrs: prevAttrs: {
|
||||
# this was the only way I could get the package to properly reference itself
|
||||
passthru = prevAttrs.passthru // {
|
||||
dist = finalAttrs.finalPackage + "/libexec/electron";
|
||||
};
|
||||
})
|
||||
|
||||
@@ -31,7 +31,7 @@ stdenv.mkDerivation {
|
||||
|
||||
passthru = {
|
||||
unwrapped = electron-unwrapped;
|
||||
inherit (electron-unwrapped) headers;
|
||||
inherit (electron-unwrapped) headers dist;
|
||||
};
|
||||
inherit (electron-unwrapped) meta;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
yarn --offline electron-builder \
|
||||
--dir \
|
||||
-c.electronDist=${electron}/libexec/electron \
|
||||
-c.electronDist=${electron.dist} \
|
||||
-c.electronVersion=${electron.version}
|
||||
|
||||
runHook postBuild
|
||||
|
||||
@@ -66,7 +66,7 @@ in {
|
||||
|
||||
npm exec electron-builder -- \
|
||||
--dir \
|
||||
-c.electronDist=${electron}/libexec/electron \
|
||||
-c.electronDist=${electron.dist} \
|
||||
-c.electronVersion=${electron.version} \
|
||||
-c.npmRebuild=false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user