22 opts = removeAttrs dep ["fetcher"];
23 in pkgs.${dep.fetcher} opts;
25 in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
26 packageName = "electron";
27 inherit (info) version;
28 buildTargets = [ "electron:electron_dist_zip" ];
30 nativeBuildInputs = base.nativeBuildInputs ++ [ nodejs yarn fixup_yarn_lock unzip npmHooks.npmConfigHook ];
31 buildInputs = base.buildInputs ++ [ libnotify ];
33 electronOfflineCache = fetchYarnDeps {
34 yarnLock = (fetchdep info.deps."src/electron") + "/yarn.lock";
35 sha256 = info.electron_yarn_hash;
37 npmDeps = fetchNpmDeps {
38 src = fetchdep info.deps."src";
39 sourceRoot = "source/third_party/node";
40 hash = info.chromium_npm_hash;
45 patches = base.patches ++ lib.optional (lib.versionOlder info.version "28")
47 name = "version.patch";
48 src = if lib.versionAtLeast info.version "27" then ./version.patch else ./version-old.patch;
49 inherit (info) version;
56 lib.concatStrings (lib.mapAttrsToList (path: dep: ''
57 mkdir -p ${builtins.dirOf path}
58 cp -r ${fetchdep dep}/. ${path}
66 npmRoot = "third_party/node";
69 mkdir -p third_party/jdk/current/bin
71 echo 'build_with_chromium = true' >> build/config/gclient_args.gni
72 echo 'checkout_google_benchmark = false' >> build/config/gclient_args.gni
73 echo 'checkout_android = false' >> build/config/gclient_args.gni
74 echo 'checkout_android_prebuilts_build_tools = false' >> build/config/gclient_args.gni
75 echo 'checkout_android_native_support = false' >> build/config/gclient_args.gni
76 echo 'checkout_ios_webkit = false' >> build/config/gclient_args.gni
77 echo 'checkout_nacl = false' >> build/config/gclient_args.gni
78 echo 'checkout_openxr = false' >> build/config/gclient_args.gni
79 echo 'checkout_rts_model = false' >> build/config/gclient_args.gni
80 echo 'checkout_src_internal = false' >> build/config/gclient_args.gni
81 echo 'cros_boards = ""' >> build/config/gclient_args.gni
82 echo 'cros_boards_with_qemu_images = ""' >> build/config/gclient_args.gni
83 echo 'generate_location_tags = true' >> build/config/gclient_args.gni
85 echo 'LASTCHANGE=${info.deps."src".rev}-refs/heads/master@{#0}' > build/util/LASTCHANGE
86 echo "$SOURCE_DATE_EPOCH" > build/util/LASTCHANGE.committime
88 cat << EOF > gpu/config/gpu_lists_version.h
89 /* Generated by lastchange.py, do not edit.*/
90 #ifndef GPU_CONFIG_GPU_LISTS_VERSION_H_
91 #define GPU_CONFIG_GPU_LISTS_VERSION_H_
92 #define GPU_LISTS_VERSION "${info.deps."src".rev}"
93 #endif // GPU_CONFIG_GPU_LISTS_VERSION_H_
96 cat << EOF > skia/ext/skia_commit_hash.h
97 /* Generated by lastchange.py, do not edit.*/
98 #ifndef SKIA_EXT_SKIA_COMMIT_HASH_H_
99 #define SKIA_EXT_SKIA_COMMIT_HASH_H_
100 #define SKIA_COMMIT_HASH "${info.deps."src/third_party/skia".rev}-"
101 #endif // SKIA_EXT_SKIA_COMMIT_HASH_H_
104 echo -n '${info.deps."src/third_party/dawn".rev}' > gpu/webgpu/DAWN_VERSION
108 export HOME=$TMPDIR/fake_home
109 yarn config --offline set yarn-offline-mirror $electronOfflineCache
110 fixup_yarn_lock yarn.lock
111 yarn install --offline --frozen-lockfile --ignore-scripts --no-progress --non-interactive
116 PATH=$PATH:${lib.makeBinPath (with pkgsBuildHost; [ jq git ])}
117 config=src/electron/patches/config.json
118 for key in $(jq -r "keys[]" $config)
120 value=$(jq -r ".\"$key\"" $config)
122 for patch in $(cat $key/.patches)
124 git apply -p1 --directory=$value $key/$patch
133 grep patch update_npm_deps | sh
135 '' + (base.preConfigure or "");
138 # build/args/release.gn
139 is_component_build = false;
140 is_official_build = true;
141 rtc_use_h264 = proprietary_codecs;
142 is_component_ffmpeg = true;
145 is_electron_build = true;
146 root_extra_deps = [ "//electron" ];
147 node_module_version = info.modules;
148 v8_promise_internal_field_count = 1;
149 v8_embedder_string = "-electron.0";
150 v8_enable_snapshot_native_code_counters = false;
151 v8_scriptormodule_legacy_lifetime = true;
152 v8_enable_javascript_promise_hooks = true;
153 enable_cdm_host_verification = false;
154 proprietary_codecs = true;
155 ffmpeg_branding = "Chrome";
156 enable_printing = true;
157 angle_enable_vulkan_validation_layers = false;
158 dawn_enable_vulkan_validation_layers = false;
159 enable_pseudolocales = false;
160 allow_runtime_configurable_key_storage = true;
161 enable_cet_shadow_stack = false;
165 enable_widevine = false;
166 use_perfetto_client_library = false;
167 enable_check_raw_ptr_fields = false;
168 } // lib.optionalAttrs (lib.versionOlder info.version "26") {
169 use_gnome_keyring = false;
170 } // lib.optionalAttrs (lib.versionAtLeast info.version "28") {
171 override_electron_version = info.version;
175 mkdir -p $libExecPath
176 unzip -d $libExecPath out/Release/dist.zip
179 requiredSystemFeatures = [ "big-parallel" ];
183 headers = stdenv.mkDerivation rec {
184 name = "node-v${info.node}-headers.tar.xz";
185 nativeBuildInputs = [ python3 ];
186 src = fetchdep info.deps."src/third_party/electron_node";
197 description = "Cross platform desktop application shell";
198 homepage = "https://github.com/electron/electron";
199 platforms = lib.platforms.linux;
200 license = licenses.mit;
201 maintainers = with maintainers; [ yuka ];
202 mainProgram = "electron";
203 hydraPlatforms = lib.optionals (!(hasInfix "alpha" info.version) && !(hasInfix "beta" info.version)) ["aarch64-linux" "x86_64-linux"];
204 timeout = 172800; # 48 hours (increased from the Hydra default of 10h)