signal-desktop-from-src: simplify build process
This commit is contained in:
parent
19b0a62fee
commit
a6cc698c69
|
@ -164,7 +164,6 @@ let
|
||||||
buildNodejs = mkNodeJs buildPackages.nodejs;
|
buildNodejs = mkNodeJs buildPackages.nodejs;
|
||||||
|
|
||||||
# nodejs' = nodejs_latest;
|
# nodejs' = nodejs_latest;
|
||||||
yarn' = yarn.override { nodejs = nodejs'; };
|
|
||||||
buildYarn = buildPackages.yarn.override { nodejs = buildNodejs; };
|
buildYarn = buildPackages.yarn.override { nodejs = buildNodejs; };
|
||||||
|
|
||||||
# package.json locks electron to 25.y.z
|
# package.json locks electron to 25.y.z
|
||||||
|
@ -181,8 +180,6 @@ let
|
||||||
buildNpmArch = if stdenv.buildPlatform.isAarch64 then "arm64" else "x64";
|
buildNpmArch = if stdenv.buildPlatform.isAarch64 then "arm64" else "x64";
|
||||||
hostNpmArch = if stdenv.hostPlatform.isAarch64 then "arm64" else "x64";
|
hostNpmArch = if stdenv.hostPlatform.isAarch64 then "arm64" else "x64";
|
||||||
crossNpmArchExt = if buildNpmArch == hostNpmArch then "" else "-${hostNpmArch}";
|
crossNpmArchExt = if buildNpmArch == hostNpmArch then "" else "-${hostNpmArch}";
|
||||||
|
|
||||||
invokeYarn = "${buildYarn}/bin/yarn";
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "signal-desktop-from-src";
|
pname = "signal-desktop-from-src";
|
||||||
|
@ -214,7 +211,6 @@ stdenv.mkDerivation rec {
|
||||||
python3
|
python3
|
||||||
wrapGAppsHook
|
wrapGAppsHook
|
||||||
buildYarn
|
buildYarn
|
||||||
# yarn'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
|
@ -273,7 +269,7 @@ stdenv.mkDerivation rec {
|
||||||
export SOURCE_DATE_EPOCH=
|
export SOURCE_DATE_EPOCH=
|
||||||
|
|
||||||
export HOME=$NIX_BUILD_TOP
|
export HOME=$NIX_BUILD_TOP
|
||||||
${invokeYarn} config --offline set yarn-offline-mirror $yarnOfflineCache
|
yarn config --offline set yarn-offline-mirror $yarnOfflineCache
|
||||||
fixup_yarn_lock yarn.lock
|
fixup_yarn_lock yarn.lock
|
||||||
|
|
||||||
# prevent any attempt at downloading nodejs C headers
|
# prevent any attempt at downloading nodejs C headers
|
||||||
|
@ -288,12 +284,9 @@ stdenv.mkDerivation rec {
|
||||||
# yarn install creates the node_modules/ directory
|
# yarn install creates the node_modules/ directory
|
||||||
# --ignore-scripts tells yarn to not run the "install" or "postinstall" commands mentioned in dependencies' package.json
|
# --ignore-scripts tells yarn to not run the "install" or "postinstall" commands mentioned in dependencies' package.json
|
||||||
# since many of those require network access
|
# since many of those require network access
|
||||||
${invokeYarn} install --offline --frozen-lockfile --ignore-scripts
|
yarn install --offline --frozen-lockfile --ignore-scripts
|
||||||
patchShebangs node_modules/
|
patchShebangs node_modules/
|
||||||
# patchShebangs --build node_modules/{bufferutil/node_modules/node-gyp-build/,node-gyp-build,utf-8-validate/node_modules/node-gyp-build}
|
patchShebangs --build --update node_modules/{bufferutil/node_modules/node-gyp-build/,node-gyp-build,utf-8-validate/node_modules/node-gyp-build}
|
||||||
patchShebangs --build --update node_modules/bufferutil/node_modules/node-gyp-build/
|
|
||||||
patchShebangs --build --update node_modules/node-gyp-build/
|
|
||||||
patchShebangs --build --update node_modules/utf-8-validate/node_modules/node-gyp-build/
|
|
||||||
# patch these out to remove a runtime reference back to the build bash
|
# patch these out to remove a runtime reference back to the build bash
|
||||||
# (better, perhaps, would be for these build scripts to not be included in the asar...)
|
# (better, perhaps, would be for these build scripts to not be included in the asar...)
|
||||||
sed -i 's:#!.*/bin/bash:#!/bin/sh:g' node_modules/@swc/helpers/scripts/gen.sh
|
sed -i 's:#!.*/bin/bash:#!/bin/sh:g' node_modules/@swc/helpers/scripts/gen.sh
|
||||||
|
@ -307,16 +300,16 @@ stdenv.mkDerivation rec {
|
||||||
popd
|
popd
|
||||||
cp ${sqlcipherTarball} node_modules/@signalapp/better-sqlite3/deps/sqlcipher.tar.gz
|
cp ${sqlcipherTarball} node_modules/@signalapp/better-sqlite3/deps/sqlcipher.tar.gz
|
||||||
pushd node_modules/@signalapp/better-sqlite3
|
pushd node_modules/@signalapp/better-sqlite3
|
||||||
${invokeYarn} --offline build-release
|
yarn --offline build-release
|
||||||
popd
|
popd
|
||||||
pushd node_modules/@signalapp/libsignal-client
|
pushd node_modules/@signalapp/libsignal-client
|
||||||
${invokeYarn} node-gyp-build
|
yarn node-gyp-build
|
||||||
popd
|
popd
|
||||||
# there are more dependencies which had install/postinstall scripts, but it seems we can safely ignore them
|
# there are more dependencies which had install/postinstall scripts, but it seems we can safely ignore them
|
||||||
|
|
||||||
# run signal's own `postinstall`:
|
# run signal's own `postinstall`:
|
||||||
${invokeYarn} build:acknowledgments
|
yarn build:acknowledgments
|
||||||
${invokeYarn} patch-package
|
yarn patch-package
|
||||||
# yarn electron:install-app-deps # not necessary
|
# yarn electron:install-app-deps # not necessary
|
||||||
|
|
||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
|
@ -348,15 +341,15 @@ stdenv.mkDerivation rec {
|
||||||
# echo 'ignore-engines true' > .yarnrc
|
# echo 'ignore-engines true' > .yarnrc
|
||||||
|
|
||||||
# yarn generate:
|
# yarn generate:
|
||||||
${invokeYarn} build-module-protobuf --offline --frozen-lockfile
|
yarn build-module-protobuf --offline --frozen-lockfile
|
||||||
${invokeYarn} build:esbuild --offline --frozen-lockfile
|
yarn build:esbuild --offline --frozen-lockfile
|
||||||
${invokeYarn} sass
|
yarn sass
|
||||||
${invokeYarn} get-expire-time
|
yarn get-expire-time
|
||||||
${invokeYarn} copy-components
|
yarn copy-components
|
||||||
|
|
||||||
${invokeYarn} build:esbuild:prod --offline --frozen-lockfile
|
yarn build:esbuild:prod --offline --frozen-lockfile
|
||||||
|
|
||||||
${invokeYarn} build:release \
|
yarn build:release \
|
||||||
--linux --${hostNpmArch} \
|
--linux --${hostNpmArch} \
|
||||||
-c.electronDist=${electron'}/libexec/electron \
|
-c.electronDist=${electron'}/libexec/electron \
|
||||||
-c.electronVersion=${electron'.version} \
|
-c.electronVersion=${electron'.version} \
|
||||||
|
@ -405,7 +398,6 @@ stdenv.mkDerivation rec {
|
||||||
# TODO: prevent update to betas
|
# TODO: prevent update to betas
|
||||||
rev-prefix = "v";
|
rev-prefix = "v";
|
||||||
};
|
};
|
||||||
yarn = yarn';
|
|
||||||
nodejs = nodejs';
|
nodejs = nodejs';
|
||||||
buildYarn = buildYarn;
|
buildYarn = buildYarn;
|
||||||
buildNodejs = buildNodejs;
|
buildNodejs = buildNodejs;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user