working 100% offline build
This commit is contained in:
292
flake.nix
292
flake.nix
@@ -90,11 +90,11 @@
|
|||||||
# substituteInPlace lib/cli.js \
|
# substituteInPlace lib/cli.js \
|
||||||
# --replace 'yield (_fs || _load_fs()).unlink' '// yield (_fs || _load_fs()).unlink'
|
# --replace 'yield (_fs || _load_fs()).unlink' '// yield (_fs || _load_fs()).unlink'
|
||||||
# '';
|
# '';
|
||||||
preFixup = (upstream.preFixup or "") + ''
|
# preFixup = (upstream.preFixup or "") + ''
|
||||||
substituteInPlace $out/libexec/yarn/lib/cli.js --replace \
|
# substituteInPlace $out/libexec/yarn/lib/cli.js --replace \
|
||||||
"this.reporter.verbose(this.reporter.lang('verboseFileRemoveExtraneous', _loc6));" \
|
# "this.reporter.verbose(this.reporter.lang('verboseFileRemoveExtraneous', _loc6));" \
|
||||||
"if (false)"
|
# "if (false)"
|
||||||
'';
|
# '';
|
||||||
});
|
});
|
||||||
electronDeps = with pkgs; [
|
electronDeps = with pkgs; [
|
||||||
# packages which electron dynamically links against
|
# packages which electron dynamically links against
|
||||||
@@ -368,76 +368,78 @@
|
|||||||
tar -xzf ./scripts/prebuild.tar.gz
|
tar -xzf ./scripts/prebuild.tar.gz
|
||||||
popd
|
popd
|
||||||
cp ${sqlcipher} node_modules/@signalapp/better-sqlite3/deps/sqlcipher.tar.gz
|
cp ${sqlcipher} node_modules/@signalapp/better-sqlite3/deps/sqlcipher.tar.gz
|
||||||
pushd node_modules/@signalapp/libsignal-client
|
|
||||||
yarn node-gyp-build
|
|
||||||
popd
|
|
||||||
pushd node_modules/@signalapp/mock-server/node_modules/@signalapp/libsignal-client
|
|
||||||
yarn node-gyp-build
|
|
||||||
popd
|
|
||||||
pushd node_modules/bufferutil
|
|
||||||
yarn node-gyp-build
|
|
||||||
popd
|
|
||||||
pushd node_modules/bufferutil
|
|
||||||
yarn node-gyp-build
|
|
||||||
popd
|
|
||||||
pushd node_modules/mac-screen-capture-permissions
|
|
||||||
yarn prebuild-install || node install.js
|
|
||||||
popd
|
|
||||||
pushd node_modules/playwright
|
|
||||||
node install.js
|
|
||||||
popd
|
|
||||||
pushd node_modules/utf-8-validate
|
|
||||||
yarn node-gyp-build
|
|
||||||
popd
|
|
||||||
|
|
||||||
pushd node_modules/@babel/runtime-corejs3/node_modules/core-js-pure
|
# pushd node_modules/@signalapp/libsignal-client
|
||||||
node -e "try{require('./postinstall')}catch(e){}"
|
# yarn node-gyp-build
|
||||||
popd
|
# popd
|
||||||
pushd node_modules/@swc/core
|
# pushd node_modules/@signalapp/mock-server/node_modules/@signalapp/libsignal-client
|
||||||
node postinstall.js
|
# yarn node-gyp-build
|
||||||
popd
|
# popd
|
||||||
pushd node_modules/@storybook/builder-manager/node_modules/esbuild
|
# pushd node_modules/bufferutil
|
||||||
node install.js
|
# yarn node-gyp-build
|
||||||
popd
|
# popd
|
||||||
pushd node_modules/@storybook/core-common/node_modules/esbuild
|
# pushd node_modules/bufferutil
|
||||||
node install.js
|
# yarn node-gyp-build
|
||||||
popd
|
# popd
|
||||||
pushd node_modules/core-js-pure
|
# pushd node_modules/mac-screen-capture-permissions
|
||||||
node -e "try{require('./postinstall')}catch(e){}"
|
# yarn prebuild-install || node install.js
|
||||||
popd
|
# popd
|
||||||
pushd node_modules/core-js
|
# pushd node_modules/playwright
|
||||||
node scripts/postinstall || echo "ignore"
|
# node install.js
|
||||||
popd
|
# popd
|
||||||
pushd node_modules/danger/node_modules/core-js
|
# pushd node_modules/utf-8-validate
|
||||||
node -e "try{require('./postinstall')}catch(e){}"
|
# yarn node-gyp-build
|
||||||
popd
|
# popd
|
||||||
pushd node_modules/electron
|
|
||||||
node install.js
|
# pushd node_modules/@babel/runtime-corejs3/node_modules/core-js-pure
|
||||||
popd
|
# node -e "try{require('./postinstall')}catch(e){}"
|
||||||
pushd node_modules/esbuild
|
# popd
|
||||||
node install.js
|
# pushd node_modules/@swc/core
|
||||||
popd
|
# node postinstall.js
|
||||||
pushd node_modules/protobufjs
|
# popd
|
||||||
node scripts/postinstall
|
# pushd node_modules/@storybook/builder-manager/node_modules/esbuild
|
||||||
popd
|
# node install.js
|
||||||
pushd node_modules/websocket/node_modules/es5-ext
|
# popd
|
||||||
node -e "try{require('./_postinstall')}catch(e){}"
|
# pushd node_modules/@storybook/core-common/node_modules/esbuild
|
||||||
popd
|
# node install.js
|
||||||
|
# popd
|
||||||
|
# pushd node_modules/core-js-pure
|
||||||
|
# node -e "try{require('./postinstall')}catch(e){}"
|
||||||
|
# popd
|
||||||
|
# pushd node_modules/core-js
|
||||||
|
# node scripts/postinstall || echo "ignore"
|
||||||
|
# popd
|
||||||
|
# pushd node_modules/danger/node_modules/core-js
|
||||||
|
# node -e "try{require('./postinstall')}catch(e){}"
|
||||||
|
# popd
|
||||||
|
# pushd node_modules/electron
|
||||||
|
# node install.js
|
||||||
|
# popd
|
||||||
|
# pushd node_modules/esbuild
|
||||||
|
# node install.js
|
||||||
|
# popd
|
||||||
|
# pushd node_modules/protobufjs
|
||||||
|
# node scripts/postinstall
|
||||||
|
# popd
|
||||||
|
# pushd node_modules/websocket/node_modules/es5-ext
|
||||||
|
# node -e "try{require('./_postinstall')}catch(e){}"
|
||||||
|
# popd
|
||||||
|
|
||||||
# run signal's own `postinstall`:
|
# run signal's own `postinstall`:
|
||||||
yarn build:acknowledgments
|
yarn build:acknowledgments
|
||||||
yarn patch-package
|
yarn patch-package
|
||||||
yarn electron:install-app-deps
|
# yarn electron:install-app-deps
|
||||||
|
|
||||||
# N.B.: `yarn install` ships node_modules/@signalapp/better-sqlite3/build/Release/better_sqlite3.node
|
# N.B.: `yarn install` ships node_modules/@signalapp/better-sqlite3/build/Release/better_sqlite3.node
|
||||||
# also build/Release/obj.target/better_sqlite3.noe
|
# specifically, better-sqlite3's package.json install script does that
|
||||||
|
# also build/Release/obj.target/better_sqlite3.node
|
||||||
# also libcrypto.a, libsignal_tokenizer.a
|
# also libcrypto.a, libsignal_tokenizer.a
|
||||||
# - both of these for x64 and aarch64
|
# - both of these for x64 and aarch64
|
||||||
# also sqlite3.a
|
# also sqlite3.a
|
||||||
# remove build/Release to remove allof those prebuilts
|
# remove build/Release to remove all of those prebuilts
|
||||||
rm -rf node_modules/@signalapp/better-sqlite3/build/Release
|
# rm -rf node_modules/@signalapp/better-sqlite3/build/Release
|
||||||
|
|
||||||
npm rebuild @signalapp/better-sqlite3 --offline
|
# npm rebuild @signalapp/better-sqlite3 --offline
|
||||||
|
|
||||||
# yarn generate --offline --frozen-lockfile
|
# yarn generate --offline --frozen-lockfile
|
||||||
# apparently this isn't equivalent to `yarn generate --offline --frozen-lockfile`!
|
# apparently this isn't equivalent to `yarn generate --offline --frozen-lockfile`!
|
||||||
@@ -462,6 +464,60 @@
|
|||||||
echo "launch signal with: ${electron-bin}/bin/electron ./release/linux-unpacked/resources/app.asar" # same as libexec
|
echo "launch signal with: ${electron-bin}/bin/electron ./release/linux-unpacked/resources/app.asar" # same as libexec
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
reproducible7 = with pkgs; writeShellScriptBin "reproducible7" ''
|
||||||
|
set -x
|
||||||
|
clean
|
||||||
|
link-caches
|
||||||
|
|
||||||
|
# prevent node-gyp from trying to download nodejs headers
|
||||||
|
# mkdir -p "$HOME/.node-gyp/${nodejs_18_15_0.version}"
|
||||||
|
# echo 9 > "$HOME/.node-gyp/${nodejs_18_15_0.version}/installVersion"
|
||||||
|
# ln -sfv "$(pwd)/include" "$HOME/.node-gyp/${nodejs_18_15_0.version}"
|
||||||
|
# export npm_config_nodedir=${nodejs_18_15_0}
|
||||||
|
|
||||||
|
# export npm_config_nodedir=${nodejs_18_15_0}
|
||||||
|
|
||||||
|
tar xzf ${electron-bin.headers}
|
||||||
|
export npm_config_nodedir=$(pwd)/node_headers
|
||||||
|
|
||||||
|
yarn install --frozen-lockfile --ignore-scripts
|
||||||
|
|
||||||
|
cp ${ringrtcPrebuild} node_modules/@signalapp/ringrtc/scripts/prebuild.tar.gz
|
||||||
|
pushd node_modules/@signalapp/ringrtc/
|
||||||
|
tar -xzf ./scripts/prebuild.tar.gz
|
||||||
|
popd
|
||||||
|
cp ${sqlcipher} node_modules/@signalapp/better-sqlite3/deps/sqlcipher.tar.gz
|
||||||
|
pushd node_modules/@signalapp/better-sqlite3
|
||||||
|
yarn --offline build-release
|
||||||
|
popd
|
||||||
|
|
||||||
|
# run signal's own `postinstall`:
|
||||||
|
yarn build:acknowledgments
|
||||||
|
yarn patch-package
|
||||||
|
# yarn electron:install-app-deps
|
||||||
|
|
||||||
|
# yarn generate --offline --frozen-lockfile
|
||||||
|
# apparently this isn't equivalent to `yarn generate --offline --frozen-lockfile`!
|
||||||
|
yarn build-module-protobuf --offline --frozen-lockfile
|
||||||
|
yarn build:esbuild --offline --frozen-lockfile
|
||||||
|
yarn sass
|
||||||
|
yarn get-expire-time
|
||||||
|
yarn copy-components
|
||||||
|
|
||||||
|
yarn build:esbuild:prod --offline --frozen-lockfile
|
||||||
|
# this fails during the "fuse" process, which is ok to skip
|
||||||
|
yarn build:release \
|
||||||
|
-c.electronDist=${electron-bin}/libexec/electron \
|
||||||
|
-c.electronVersion=${electron-bin.version} \
|
||||||
|
--dir \
|
||||||
|
|| true
|
||||||
|
|
||||||
|
# patch-interpreter release/linux-unpacked/signal-desktop
|
||||||
|
|
||||||
|
# electron-bin (26.3.0) DOES support default flags (i.e. zygote)
|
||||||
|
echo "launch signal with: ${electron-bin}/bin/electron ./release/linux-unpacked/resources/app.asar"
|
||||||
|
'';
|
||||||
|
|
||||||
LD_LIBRARY_PATH = builtins.concatStringsSep ":" (builtins.map
|
LD_LIBRARY_PATH = builtins.concatStringsSep ":" (builtins.map
|
||||||
(pkg: "${pkgs.lib.getLib pkg}/lib")
|
(pkg: "${pkgs.lib.getLib pkg}/lib")
|
||||||
(electronDeps ++ _7zaDeps ++ fpmDeps)
|
(electronDeps ++ _7zaDeps ++ fpmDeps)
|
||||||
@@ -481,6 +537,7 @@
|
|||||||
reproducible4
|
reproducible4
|
||||||
reproducible5
|
reproducible5
|
||||||
reproducible6
|
reproducible6
|
||||||
|
reproducible7
|
||||||
|
|
||||||
# yarn
|
# yarn
|
||||||
# nodejs
|
# nodejs
|
||||||
@@ -514,6 +571,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
packages.yarn_18_15_0 = yarn_18_15_0;
|
packages.yarn_18_15_0 = yarn_18_15_0;
|
||||||
|
packages.sqlcipher = sqlcipher;
|
||||||
|
packages.ringrtcPrebuild = ringrtcPrebuild;
|
||||||
packages.signal-desktop-from-src = with pkgs; stdenv.mkDerivation {
|
packages.signal-desktop-from-src = with pkgs; stdenv.mkDerivation {
|
||||||
pname = "signal-desktop-from-src";
|
pname = "signal-desktop-from-src";
|
||||||
version = "6.36.0";
|
version = "6.36.0";
|
||||||
@@ -529,10 +588,8 @@
|
|||||||
# ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
|
# ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
|
||||||
};
|
};
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
clean
|
|
||||||
reproducible4
|
|
||||||
|
|
||||||
fixup_yarn_lock
|
fixup_yarn_lock
|
||||||
|
makeWrapper
|
||||||
nodejs_18_15_0 # needed for `yarn install` bettersqlite step
|
nodejs_18_15_0 # needed for `yarn install` bettersqlite step
|
||||||
python3
|
python3
|
||||||
yarn_18_15_0
|
yarn_18_15_0
|
||||||
@@ -547,20 +604,89 @@
|
|||||||
fixup_yarn_lock yarn.lock
|
fixup_yarn_lock yarn.lock
|
||||||
|
|
||||||
# prevent node-gyp from trying to download nodejs headers
|
# prevent node-gyp from trying to download nodejs headers
|
||||||
mkdir -p "$HOME/.node-gyp/${nodejs_18_15_0.version}"
|
# THIS BREAKS better-sqlite ABI
|
||||||
echo 9 > "$HOME/.node-gyp/${nodejs_18_15_0.version}/installVersion"
|
# mkdir -p "$HOME/.node-gyp/${nodejs_18_15_0.version}"
|
||||||
ln -sfv "$(pwd)/include" "$HOME/.node-gyp/${nodejs_18_15_0.version}"
|
# echo 9 > "$HOME/.node-gyp/${nodejs_18_15_0.version}/installVersion"
|
||||||
export npm_config_nodedir=${nodejs_18_15_0}
|
# ln -sfv "$(pwd)/include" "$HOME/.node-gyp/${nodejs_18_15_0.version}"
|
||||||
|
# export npm_config_nodedir=${nodejs_18_15_0}
|
||||||
|
|
||||||
|
tar xzf ${electron-bin.headers}
|
||||||
|
export npm_config_nodedir=$(pwd)/node_headers
|
||||||
|
|
||||||
# optional flags: --no-progress --non-interactive
|
# optional flags: --no-progress --non-interactive
|
||||||
# yarn install creates the node_modules/ directory
|
# yarn install creates the node_modules/ directory
|
||||||
yarn install --offline --frozen-lockfile --ignore-scripts
|
yarn install --offline --frozen-lockfile --ignore-scripts
|
||||||
|
patchShebangs node_modules/
|
||||||
|
|
||||||
|
# manually emulate install scripts for key dependencies
|
||||||
cp ${ringrtcPrebuild} node_modules/@signalapp/ringrtc/scripts/prebuild.tar.gz
|
cp ${ringrtcPrebuild} node_modules/@signalapp/ringrtc/scripts/prebuild.tar.gz
|
||||||
|
pushd node_modules/@signalapp/ringrtc/
|
||||||
|
tar -xzf ./scripts/prebuild.tar.gz
|
||||||
|
popd
|
||||||
cp ${sqlcipher} node_modules/@signalapp/better-sqlite3/deps/sqlcipher.tar.gz
|
cp ${sqlcipher} node_modules/@signalapp/better-sqlite3/deps/sqlcipher.tar.gz
|
||||||
patchShebangs node_modules/
|
pushd node_modules/@signalapp/better-sqlite3
|
||||||
# N.B.: without patched yarn, this deletes the prebuild.tar.gz i just installed
|
yarn --offline build-release
|
||||||
yarn install --offline --frozen-lockfile --verbose
|
popd
|
||||||
patchShebangs node_modules/
|
pushd node_modules/@signalapp/libsignal-client
|
||||||
|
yarn node-gyp-build
|
||||||
|
popd
|
||||||
|
pushd node_modules/@signalapp/mock-server/node_modules/@signalapp/libsignal-client
|
||||||
|
yarn node-gyp-build
|
||||||
|
popd
|
||||||
|
pushd node_modules/bufferutil
|
||||||
|
yarn node-gyp-build
|
||||||
|
popd
|
||||||
|
pushd node_modules/bufferutil
|
||||||
|
yarn node-gyp-build
|
||||||
|
popd
|
||||||
|
# pushd node_modules/mac-screen-capture-permissions
|
||||||
|
# yarn prebuild-install || node install.js
|
||||||
|
# popd
|
||||||
|
# pushd node_modules/playwright
|
||||||
|
# node install.js
|
||||||
|
# popd
|
||||||
|
pushd node_modules/utf-8-validate
|
||||||
|
yarn node-gyp-build
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd node_modules/@babel/runtime-corejs3/node_modules/core-js-pure
|
||||||
|
node -e "try{require('./postinstall')}catch(e){}"
|
||||||
|
popd
|
||||||
|
pushd node_modules/@swc/core
|
||||||
|
node postinstall.js
|
||||||
|
popd
|
||||||
|
pushd node_modules/@storybook/builder-manager/node_modules/esbuild
|
||||||
|
node install.js
|
||||||
|
popd
|
||||||
|
pushd node_modules/@storybook/core-common/node_modules/esbuild
|
||||||
|
node install.js
|
||||||
|
popd
|
||||||
|
pushd node_modules/core-js-pure
|
||||||
|
node -e "try{require('./postinstall')}catch(e){}"
|
||||||
|
popd
|
||||||
|
pushd node_modules/core-js
|
||||||
|
node scripts/postinstall || echo "ignore"
|
||||||
|
popd
|
||||||
|
pushd node_modules/danger/node_modules/core-js
|
||||||
|
node -e "try{require('./postinstall')}catch(e){}"
|
||||||
|
popd
|
||||||
|
# pushd node_modules/electron
|
||||||
|
# node install.js
|
||||||
|
# popd
|
||||||
|
pushd node_modules/esbuild
|
||||||
|
node install.js
|
||||||
|
popd
|
||||||
|
pushd node_modules/protobufjs
|
||||||
|
node scripts/postinstall
|
||||||
|
popd
|
||||||
|
pushd node_modules/websocket/node_modules/es5-ext
|
||||||
|
node -e "try{require('./_postinstall')}catch(e){}"
|
||||||
|
popd
|
||||||
|
|
||||||
|
# run signal's own `postinstall`:
|
||||||
|
yarn build:acknowledgments
|
||||||
|
yarn patch-package
|
||||||
|
yarn electron:install-app-deps
|
||||||
|
|
||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
'';
|
'';
|
||||||
@@ -570,6 +696,11 @@
|
|||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
# rebuild better-sqlite to avoid using prebuilts
|
||||||
|
# - experiment to fix `_ZN2v812api_internal18GlobalizeReferenceEPNS_8internal7IsolateEPm` undefined symbol (doesn't fix)
|
||||||
|
# rm -rf node_modules/@signalapp/better-sqlite3/build/Release
|
||||||
|
# npm rebuild @signalapp/better-sqlite3 --offline
|
||||||
|
|
||||||
# yarn generate
|
# yarn generate
|
||||||
yarn build-module-protobuf --offline --frozen-lockfile
|
yarn build-module-protobuf --offline --frozen-lockfile
|
||||||
yarn build:esbuild --offline --frozen-lockfile
|
yarn build:esbuild --offline --frozen-lockfile
|
||||||
@@ -591,7 +722,16 @@
|
|||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
cp -R ./release $out
|
# cp -R ./release $out
|
||||||
|
|
||||||
|
# directory structure follows the original `signal-desktop` nix package
|
||||||
|
mkdir -p $out/lib/Signal
|
||||||
|
cp -R release/linux-unpacked/* $out/lib/Signal
|
||||||
|
mkdir $out/bin
|
||||||
|
makeWrapper ${electron-bin}/bin/electron $out/bin/signal-desktop \
|
||||||
|
--add-flags $out/lib/Signal/resources/app.asar \
|
||||||
|
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
|
||||||
|
--inherit-argv0
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
Reference in New Issue
Block a user