Problems building electron

A sudo nixos-rebuild switch --flake fails because Electron 28/27 fail to build.

building the system configuration...
error: builder for '/nix/store/fbd4wbgknpgns5pcr6h5xnyrmagnqi2n-electron-unwrapped-28.2.10.drv' failed with exit code 1;
       last 10 log lines:
       > applying in src: enable_partition_alloc_ref_count_size.patch
       > applying in src: ensure_an_axcontext_before_painting.patch
       > applying in src: safely_crash_on_dangling_profile.patch
       > applying in src: prevent_mojotrap_event_re-ordering.patch
       > applying in src: m122_cherry_pick_cve-2024-25062_libxml_fix.patch
       > applying in src: allowlist_devtools_for_file_access_permission.patch
       > applying in src: update_crashpad_to_37afd37401253ebcebcf6e07ce15c8cfecb1a1cc.patch
       > applying in src: m122_webcodecs_disable_async_videoframe_readback_to_mitigate_a.patch
       > error: src/content/test/data/gpu/webcodecs/copyTo.html: No such file or directory
       > /nix/store/ym5fm2km11rn0fb6z6n6zd16fwi5p159-stdenv-linux/setup: line 131: pop_var_context: head of shell_variables not a function context
       For full logs, run 'nix log /nix/store/fbd4wbgknpgns5pcr6h5xnyrmagnqi2n-electron-unwrapped-28.2.10.drv'.
error: 1 dependencies of derivation '/nix/store/p0nsdrxfxz6lprhgb219wv8svwmxnb73-electron-28.2.10.drv' failed to build
error: 1 dependencies of derivation '/nix/store/h3g7x3lqkiaxl62r388rbm0rm5brx0rz-bitwarden-desktop-2024.3.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/1ynsd8m20q0d1cnrav82gmmh4p7q8x96-user-environment.drv' failed to build
error: 1 dependencies of derivation '/nix/store/kjsc99669sdplg9d1c0k7n92qhmnmmdg-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/3xz7al886vdpddfjz6570q49xcna67ap-nixos-system-pie-24.05.20240408.4cba8b5.drv' failed to build

The output of nix log /nix/store/fbd4wbgknpgns5pcr6h5xnyrmagnqi2n-electron-unwrapped-28.2.10.drv gives the following:

warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/fbd4wbgknpgns5pcr6h5xnyrmagnqi2n-electron-unwrapped-28.2.10.drv^*'
@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpackPhase completed in 3 minutes 37 seconds
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
applying patch /nix/store/qn9vd010ylciqv44d6wahrmkshysqphl-cross-compile.patch
patching file build/toolchain/linux/unbundle/BUILD.gn
applying patch /nix/store/fjrcvjbm60cyssfsh24y1fjhb3m4af9g-no-build-timestamps.patch
patching file build/compute_build_timestamp.py
Hunk #1 succeeded at 101 (offset 7 lines).
applying patch /nix/store/6vy0aq93la5bw5rbqp6ckjxy5mjk6zzy-widevine-79.patch
patching file third_party/widevine/cdm/BUILD.gn
Hunk #1 succeeded at 22 with fuzz 2 (offset 8 lines).
applying patch /nix/store/kysac7gkm7480yqa85v494kh4vycc97q-angle-wayland-include-protocol.patch
patching file third_party/angle/BUILD.gn
Hunk #1 succeeded at 588 (offset 99 lines).
Hunk #2 succeeded at 1183 (offset 104 lines).
patching file third_party/angle/src/third_party/volk/BUILD.gn
applying patch /nix/store/p57bs1svsz91d2vm41knifi2j327zlxs-chromium-initial-prefs.patch
patching file chrome/browser/first_run/first_run_internal_linux.cc
applying patch /nix/store/838ngmr2y2bplcvkjvgjn1gdjhyayqmg-chromium-120-llvm-17.patch
patching file build/config/compiler/BUILD.gn
applying patch /nix/store/cdzsrjbhi7h3dfis0jnb52kj1cva7qk2-b9bef8e9555645fc91fab705bec697214a39dbc1.patch
patching file build/config/linux/atspi2/BUILD.gn
yarn config v1.22.22
success Set "yarn-offline-mirror" to "/nix/store/xi7gvn71f2zk3h1lw2ljcn5h9s9cqmwq-offline".
Done in 0.11s.
yarn install v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @electron/lint-roller@1.10.0" has incorrect peer dependency "typescript@^4.5.5".
[4/4] Building fresh packages...
warning Ignored scripts due to flag.
Done in 23.24s.
applying in src: build_gn.patch
applying in src: dcheck.patch
applying in src: accelerator.patch
applying in src: blink_file_path.patch
applying in src: blink_local_frame.patch
applying in src: can_create_window.patch
applying in src: disable_hidden.patch
applying in src: dom_storage_limits.patch
applying in src: render_widget_host_view_base.patch
applying in src: render_widget_host_view_mac.patch
applying in src: webview_cross_drag.patch
applying in src: gin_enable_disable_v8_platform.patch
applying in src: enable_reset_aspect_ratio.patch
applying in src: boringssl_build_gn.patch
applying in src: pepper_plugin_support.patch
applying in src: gtk_visibility.patch
applying in src: resource_file_conflict.patch
applying in src: scroll_bounce_flag.patch
applying in src: mas_blink_no_private_api.patch
applying in src: mas_no_private_api.patch
applying in src: mas-cgdisplayusesforcetogray.patch
applying in src: mas_disable_remote_layer.patch
applying in src: mas_disable_remote_accessibility.patch
applying in src: mas_disable_custom_window_frame.patch
applying in src: mas_avoid_usage_of_private_macos_apis.patch
applying in src: mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch
applying in src: add_didinstallconditionalfeatures.patch
applying in src: desktop_media_list.patch
applying in src: proxy_config_monitor.patch
applying in src: gritsettings_resource_ids.patch
applying in src: isolate_holder.patch
applying in src: notification_provenance.patch
applying in src: dump_syms.patch
applying in src: command-ismediakey.patch
applying in src: printing.patch
applying in src: support_mixed_sandbox_with_zygote.patch
applying in src: unsandboxed_ppapi_processes_skip_zygote.patch
applying in src: build_add_electron_tracing_category.patch
applying in src: worker_context_will_destroy.patch
applying in src: frame_host_manager.patch
applying in src: crashpad_pid_check.patch
applying in src: network_service_allow_remote_certificate_verification_logic.patch
applying in src: disable_color_correct_rendering.patch
applying in src: add_contentgpuclient_precreatemessageloop_callback.patch
applying in src: picture-in-picture.patch
applying in src: disable_compositor_recycling.patch
applying in src: allow_new_privileges_in_unsandboxed_child_processes.patch
applying in src: expose_setuseragent_on_networkcontext.patch
applying in src: feat_add_set_theme_source_to_allow_apps_to.patch
applying in src: add_webmessageportconverter_entangleandinjectmessageportchannel.patch
applying in src: ignore_rc_check.patch
applying in src: remove_usage_of_incognito_apis_in_the_spellchecker.patch
applying in src: allow_disabling_blink_scheduler_throttling_per_renderview.patch
applying in src: hack_plugin_response_interceptor_to_point_to_electron.patch
applying in src: feat_add_support_for_overriding_the_base_spellchecker_download_url.patch
applying in src: feat_enable_offscreen_rendering_with_viz_compositor.patch
applying in src: gpu_notify_when_dxdiag_request_fails.patch
applying in src: feat_allow_embedders_to_add_observers_on_created_hunspell.patch
applying in src: feat_add_onclose_to_messageport.patch
applying in src: allow_in-process_windows_to_have_different_web_prefs.patch
applying in src: refactor_expose_cursor_changes_to_the_webcontentsobserver.patch
applying in src: crash_allow_setting_more_options.patch
applying in src: upload_list_add_loadsync_method.patch
applying in src: allow_setting_secondary_label_via_simplemenumodel.patch
applying in src: feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch
applying in src: fix_patch_out_profile_refs_in_accessibility_ui.patch
applying in src: skip_atk_toolchain_check.patch
applying in src: worker_feat_add_hook_to_notify_script_ready.patch
applying in src: chore_provide_iswebcontentscreationoverridden_with_full_params.patch
applying in src: fix_properly_honor_printing_page_ranges.patch
applying in src: export_gin_v8platform_pageallocator_for_usage_outside_of_the_gin.patch
applying in src: fix_export_zlib_symbols.patch
applying in src: web_contents.patch
applying in src: webview_fullscreen.patch
applying in src: disable_unload_metrics.patch
applying in src: fix_add_check_for_sandbox_then_result.patch
applying in src: extend_apply_webpreferences.patch
applying in src: build_libc_as_static_library.patch
applying in src: build_do_not_depend_on_packed_resource_integrity.patch
applying in src: refactor_restore_base_adaptcallbackforrepeating.patch
applying in src: hack_to_allow_gclient_sync_with_host_os_mac_on_linux_in_ci.patch
applying in src: logging_win32_only_create_a_console_if_logging_to_stderr.patch
applying in src: fix_media_key_usage_with_globalshortcuts.patch
applying in src: feat_expose_raw_response_headers_from_urlloader.patch
applying in src: process_singleton.patch
applying in src: add_ui_scopedcliboardwriter_writeunsaferawdata.patch
applying in src: feat_add_data_parameter_to_processsingleton.patch
applying in src: load_v8_snapshot_in_browser_process.patch
applying in src: fix_adapt_exclusive_access_for_electron_needs.patch
applying in src: fix_aspect_ratio_with_max_size.patch
applying in src: fix_crash_when_saving_edited_pdf_files.patch
applying in src: port_autofill_colors_to_the_color_pipeline.patch
applying in src: fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch
applying in src: build_make_libcxx_abi_unstable_false_for_electron.patch
applying in src: introduce_ozoneplatform_electron_can_call_x11_property.patch
applying in src: make_gtk_getlibgtk_public.patch
applying in src: build_disable_print_content_analysis.patch
applying in src: custom_protocols_plzserviceworker.patch
applying in src: feat_filter_out_non-shareable_windows_in_the_current_application_in.patch
applying in src: disable_freezing_flags_after_init_in_node.patch
applying in src: short-circuit_permissions_checks_in_mediastreamdevicescontroller.patch
applying in src: chore_add_electron_deps_to_gitignores.patch
applying in src: chore_allow_chromium_to_handle_synthetic_mouse_events_for_touch.patch
applying in src: add_maximized_parameter_to_linuxui_getwindowframeprovider.patch
applying in src: add_electron_deps_to_license_credits_file.patch
applying in src: fix_crash_loading_non-standard_schemes_in_iframes.patch
applying in src: create_browser_v8_snapshot_file_name_fuse.patch
applying in src: feat_configure_launch_options_for_service_process.patch
applying in src: feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch
applying in src: fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch
applying in src: preconnect_manager.patch
applying in src: fix_remove_caption-removing_style_call.patch
applying in src: build_allow_electron_to_use_exec_script.patch
applying in src: build_only_use_the_mas_build_config_in_the_required_components.patch
applying in src: chore_introduce_blocking_api_for_electron.patch
applying in src: chore_patch_out_partition_attribute_dcheck_for_webviews.patch
applying in src: expose_v8initializer_codegenerationcheckcallbackinmainthread.patch
applying in src: chore_patch_out_profile_methods_in_profile_selections_cc.patch
applying in src: add_gin_converter_support_for_arraybufferview.patch
applying in src: chore_defer_usb_service_getdevices_request_until_usb_service_is.patch
applying in src: refactor_expose_hostimportmoduledynamically_and.patch
applying in src: feat_expose_documentloader_setdefersloading_on_webdocumentloader.patch
applying in src: fix_remove_profiles_from_spellcheck_service.patch
applying in src: chore_patch_out_profile_methods_in_chrome_browser_pdf.patch
applying in src: chore_patch_out_profile_methods_in_titlebar_config.patch
applying in src: fix_disabling_background_throttling_in_compositor.patch
applying in src: fix_select_the_first_menu_item_when_opened_via_keyboard.patch
applying in src: fix_return_v8_value_from_localframe_requestexecutescript.patch
applying in src: fix_harden_blink_scriptstate_maybefrom.patch
applying in src: chore_add_buildflag_guard_around_new_include.patch
applying in src: fix_use_delegated_generic_capturer_when_available.patch
applying in src: build_remove_ent_content_analysis_assert.patch
applying in src: fix_activate_background_material_on_windows.patch
applying in src: fix_move_autopipsettingshelper_behind_branding_buildflag.patch
applying in src: revert_remove_the_allowaggressivethrottlingwithwebsocket_feature.patch
applying in src: fix_handle_no_top_level_aura_window_in_webcontentsimpl.patch
applying in src: feat_allow_passing_of_objecttemplate_to_objecttemplatebuilder.patch
applying in src: chore_remove_check_is_test_on_script_injection_tracker.patch
applying in src: crash_gpu_process_and_clear_shader_cache_when_skia_reports.patch
applying in src: revert_same_party_cookie_attribute_removal.patch
applying in src: fix_restore_original_resize_performance_on_macos.patch
applying in src: fix_font_flooding_in_dev_tools.patch
applying in src: feat_allow_code_cache_in_custom_schemes.patch
applying in src: enable_partition_alloc_ref_count_size.patch
applying in src: ensure_an_axcontext_before_painting.patch
applying in src: safely_crash_on_dangling_profile.patch
applying in src: prevent_mojotrap_event_re-ordering.patch
applying in src: m122_cherry_pick_cve-2024-25062_libxml_fix.patch
applying in src: allowlist_devtools_for_file_access_permission.patch
applying in src: update_crashpad_to_37afd37401253ebcebcf6e07ce15c8cfecb1a1cc.patch
applying in src: m122_webcodecs_disable_async_videoframe_readback_to_mitigate_a.patch
error: src/content/test/data/gpu/webcodecs/copyTo.html: No such file or directory
/nix/store/ym5fm2km11rn0fb6z6n6zd16fwi5p159-stdenv-linux/setup: line 131: pop_var_context: head of shell_variables not a function context

I thought well I’ll just use do it with the Flatpak version for now. But commenting bitwarden-desktop gives an error again, now with Electron 27 to build Logseq.

building the system configuration...
error: builder for '/nix/store/40qn9m7i28j5wbd4dn2ghv3fpp8hs5y1-electron-unwrapped-27.3.9.drv' failed with exit code 1;
       last 10 log lines:
       > applying in src: cherry-pick-4a98f9e304be.patch
       > applying in src: fix_racy_iterator_use_in_node_addconnection.patch
       > applying in src: fix_a_crash_when_a_bmp_image_contains_an_unnecessary_eof_code.patch
       > applying in src: m120_ipcz_fix_a_few_weak_asserts.patch
       > applying in src: prevent_mojotrap_event_re-ordering.patch
       > applying in src: m122_cherry_pick_cve-2024-25062_libxml_fix.patch
       > applying in src: update_crashpad_to_37afd37401253ebcebcf6e07ce15c8cfecb1a1cc.patch
       > applying in src: m122_webcodecs_disable_async_videoframe_readback_to_mitigate_a.patch
       > error: src/content/test/data/gpu/webcodecs/copyTo.html: No such file or directory
       > /nix/store/ym5fm2km11rn0fb6z6n6zd16fwi5p159-stdenv-linux/setup: line 131: pop_var_context: head of shell_variables not a function context
       For full logs, run 'nix log /nix/store/40qn9m7i28j5wbd4dn2ghv3fpp8hs5y1-electron-unwrapped-27.3.9.drv'.
error: 1 dependencies of derivation '/nix/store/ppxwfh6827azdf6p8axb26jbbblq44y2-electron-27.3.9.drv' failed to build
error: 1 dependencies of derivation '/nix/store/w0lym3sgb2p6x452hxw5ihh2w78rjlpa-logseq-0.10.8.drv' failed to build
error: 1 dependencies of derivation '/nix/store/h2z2cqxi3x869my6z9whkhakyz8v2m7a-user-environment.drv' failed to build
error: 1 dependencies of derivation '/nix/store/9acyy2r3v9kg5hs02k2a103319yh93n7-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/5c5k4hyqms77k9v6sl9wcav07zbpzbh7-nixos-system-pie-24.05.20240408.4cba8b5.drv' failed to build

nix log /nix/store/40qn9m7i28j5wbd4dn2ghv3fpp8hs5y1-electron-unwrapped-27.3.9.drv gives the same sort of log with the same errors and warnings. Especially:

warning " > @electron/lint-roller@1.10.0" has incorrect peer dependency "typescript@^4.5.5".
[4/4] Building fresh packages...
warning Ignored scripts due to flag.

Commenting Logseq now triggers Obsidian to build same Electron version as Bitwarden, wich fails again.

I don’t know if this is a problem with Nixpkgs or with my configuration.

Help is much appreciated!

1 Like

Is it possible your nix store is corrupted?

Electron should probably not be attempting to build locally in the first place, though, what version of NixOS are you using? Any --impure?

I don’t know, how can I check that?

I am using NixOS unstable.

As far as I can tell I don’t use impure.

These two subcommands of nix store:

1 Like

Looooks like an upstream bug: electron: exclude patch of removed tests (#302544) · NixOS/nixpkgs@76b199e · GitHub

Already been fixed, you’ll have to wait for that commit to make it through the pipeline. Usually takes a few days, there’s a handy website you can check to see if it’s finished, I’ll get a link for you.

1 Like

Check for 302544 on https://nixtracker.org/

1 Like

Thanks, I was having the same problem. I’ll book mark that website.

Thanks!

However, my nix store seems indeed corrupted…

I ran nix store verify --all and got 4 untrusted and 4 corrupted paths:

path '/nix/store/bl4f68x3l9dkkr7l2blbj4jsdhvm81bs-nix-wallpaper-simple-blue.png' is untrusted
path '/nix/store/bzjd66sdi85rwj7kd3zcdsi52xzhx69c-nix-wallpaper-simple-dark-gray.png' is untrusted
path '/nix/store/fikh9lqcr2vfz3ncq3sihqzhjw482yps-mbrola-voices-3.3' is untrusted
path '/nix/store/q74idm55v5km2pp9yh5qhzc4cw639kp4-cantarell-fonts-0.303.1' is untrusted
path '/nix/store/xdcrw5sxfs9ij1ka584v96jndndcl8r5-source' was modified! expected hash 'sha256:007f7asjimqxrqrxxflni1amffay8b2z6vppijcq156f7a1vrjma', got 'sha256:05k9i3hi33n2mgpwwl6dmx5n5vwazspkdz24078xar1c693w20nr'
path '/nix/store/l5zkz4acvqb6s0mq1q1kjcx5s3n9bj1m-source' was modified! expected hash 'sha256:10gr5xw2dpq4m7qvkww7k1s9yvy4b9n0dvnc7xvnia4piyhqzcdh', got 'sha256:08j5fifjv93dl4gpri9igzrx41g8in4wk98c2s1m5jihnxc17mc1'
path '/nix/store/4g8y2b68c719b2r34zv2qya7hh77zc70-source' was modified! expected hash 'sha256:0nzd7svk8nxr2nryr0ggqi956mmmw7lgj0lmb506r3196nwlh91l', got 'sha256:1nnhh8frz9bzjssk4f04jmwzxlidfpvb4lhxjrval8gnxz881hd8'
path '/nix/store/yxh0sfxnmvdm6apzd6n775n7lw14qb4v-source' was modified! expected hash 'sha256:1wb5h32l8gi2s19ch4f9663fw2sz8lgxwj0m22qqwi857s7cd85w', got 'sha256:06j6fppqvhz8brid99mqskbvgqlvw76klprg1s792l9y43z1is0p'

But I could not repair the corrupted paths. nix store repair /nix/store/xdcrw5sxfs9ij1ka584v96jndndcl8r5-source gave me error: operation 'repairPath' is not supported by store 'daemon'. Same for the other corrupted paths.

Maybe open a separate post for that and mark this one as solved for now; I suspect a bunch of people will come here with the same question about electron.

Also I actually don’t know why those commands fail, you’re more likely to get a proper answer in a new thread with an appropriate title.

1 Like