Skip to content

discord: cannot use custom updater endpoints #519923

Open

Description

@fxzzi

Nixpkgs version

  • Unstable (26.05)

Describe the bug

After the merge of #507728 i am no longer able to use custom updater endpoints within the discord settings.json.

Discord claims to check the updater endpoint but never actually uses it in any way as far as I can tell. I am using the custom update endpoint sheltupdate as it allows me to bundle a more up to date version of vencord with my discord install.

The relevant bug report at their own repo leads me to believe its an issue with our derivation, as the maintainer of sheltupdate does not seem to face the same problem as me.

Steps to reproduce

  1. install discord from nixpkgs.
  2. modify your discord settings at ~/.config/discord/settings.json, replacing it with the below:
{
  "SKIP_HOST_UPDATE": true,
  "openH264Enabled": true,
  "BACKGROUND_COLOR": "#121214",
  "offloadAdmControls": true,
  "UPDATE_ENDPOINT": "https://inject.shelter.uwu.network/shelter",
  "NEW_UPDATE_ENDPOINT": "https://inject.shelter.uwu.network/shelter/",
  "chromiumSwitches": {}
}
  1. attempt to launch discord, and notice that shelter is not loaded in any way.

Expected behaviour

It's expected that shelter should be loaded and its settings should be available in the discord settings page, however no sign of shelter being enabled is seen. I also attempted the other endpoints, like vencord and equicord without success.

Screenshots

No response

Relevant log output

Discord 1.0.137
App ready
(node:294421) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `discord --trace-deprecation ...` to show where the warning was created)
Starting app.
Starting updater.
5/13/2026, 9:42:48 PM GMT+1 [Modules] Modules initializing
5/13/2026, 9:42:48 PM GMT+1 [Modules] Distribution: remote
5/13/2026, 9:42:48 PM GMT+1 [Modules] Host updates: disabled
5/13/2026, 9:42:48 PM GMT+1 [Modules] Module updates: enabled
5/13/2026, 9:42:48 PM GMT+1 [Modules] Module install path: /home/faaris/.config/discord/1.0.137/modules
5/13/2026, 9:42:48 PM GMT+1 [Modules] Module installed file path: /home/faaris/.config/discord/1.0.137/modules/installed.json
5/13/2026, 9:42:48 PM GMT+1 [Modules] Module download path: /home/faaris/.config/discord/1.0.137/modules/pending
splashScreen.initSplash(false)
blackbox: 5/13/2026, 9:42:48 PM GMT+1 0 

----------------------------------------------
blackbox: 5/13/2026, 9:42:48 PM GMT+1 1 Discord starting: {"newUpdater":true,"releaseChannel":"stable","sentryDist":"stable-linux-x64","sentryRelease":"discord-desktop-3d62416eb8a36cef8fead5a94b899dc91ea1acb3","version":"1.0.137"}, modulepath: /home/faaris/.config/discord/module_data
blackbox: 5/13/2026, 9:42:48 PM GMT+1 2 ✅ webContents.created web1 ""
blackbox: 5/13/2026, 9:42:48 PM GMT+1 3 ✅ window.created win1 "discord"
(electron) 'console-message' arguments are deprecated and will be removed. Please use Event<WebContentsConsoleMessageEventParams> object instead.
21:42:48.715 › splashScreenPreload: signalReady
splashScreen: SPLASH_SCREEN_READY
splashScreen.webContentsSend: SPLASH_SCREEN_QUOTE SPLASH_SCREEN_QUOTE [ 'Hold Tight — Loading Discord' ]
5/13/2026, 9:42:48 PM GMT+1 [Modules] No updates to install
splashScreen: no-pending-updates
5/13/2026, 9:42:48 PM GMT+1 [Modules] Host is up to date.
5/13/2026, 9:42:48 PM GMT+1 [Modules] Checking for module updates at https://inject.shelter.uwu.network/shelter/modules/stable/versions.json
splashScreen: checking-for-updates
splashScreen.updateSplashState checking-for-updates checking-for-updates {}
splashScreen.webContentsSend: SPLASH_UPDATE_STATE SPLASH_UPDATE_STATE [ { status: 'checking-for-updates' } ]
21:42:48.732 › splashScreenPreload: onStateUpdate: {"status":"checking-for-updates"}
blackbox: 5/13/2026, 9:42:48 PM GMT+1 4 ✅ webContents.did-finish-load web1
5/13/2026, 9:42:49 PM GMT+1 [Modules] No module updates available.
splashScreen: update-check-finished true 0 false
splashScreen.launchMainWindow: false
Optional module ./ElectronTestRpc was not included.
Clearing GPU cache...
splashScreen.updateSplashState launching launching {}
splashScreen.webContentsSend: SPLASH_UPDATE_STATE SPLASH_UPDATE_STATE [ { status: 'launching' } ]
blackbox: 5/13/2026, 9:42:49 PM GMT+1 5 ✅ webContents.created web2 ""
21:42:49.245 › splashScreenPreload: onStateUpdate: {"status":"launching"}
Clearing code cache...
blackbox: 5/13/2026, 9:42:49 PM GMT+1 6 ✅ window.created win2 "Discord"
[ConnectivityTester guso46] Sending DNS query: idt-guso46-mp4j0i44.loc-en-gb.chk-webapp.res-ok.dur-0.v1.dc-telemetry.net
21:42:49.673 › [FAST CONNECT] wss://gateway.discord.gg/?encoding=etf&v=9&compress=zstd-stream, encoding: etf, version: 9
blackbox: 5/13/2026, 9:42:49 PM GMT+1 7 ✅ webContents.did-finish-load web2
21:42:49.771 › [libdiscore] [experiment_manager] Loaded experiments from cache
21:42:49.814 › [libdiscore] [BlockedDomainsStore] Deserialized 42825 hashes, revision 2873
21:42:50.002 › Initializing voice engine with audio subsystem: standard
[2026-05-13 21:42:50.033] [info] Wayland idle manager initialized successfully
21:42:50.117 › [DatabaseManager] active user changed (now: 321614457623019520, was: null, was: undefined)
legacyModuleUpdater: installed-module discord_krisp 1 1 true
legacyModuleUpdater: installed-module discord_game_utils 1 1 true
21:42:50.214 › [default] [BUILD INFO] Release Channel: stable, Build Number: 543408, Version Hash: ddcdb40b9acd36de0ee65ba818777f6f4eae83df
21:42:50.231 › [CloudSyncUtils] CloudSync is not supported on this platform
legacyModuleUpdater: installed-module discord_rpc 1 1 true
21:42:50.360 › [default] [NATIVE INFO] host 1.0.137, modules: discord_cloudsync: 1, discord_desktop_core: 1, discord_dispatch: 1, discord_erlpack: 1, discord_game_utils: 1, discord_krisp: 1, discord_modules: 1, discord_rpc: 1, discord_spellcheck: 1, discord_utils: 1, discord_voice: 1, discord_zstd: 1, build: null
mainScreen.UpdaterEvents: UPDATER_HISTORY_QUERY_AND_TRUNCATE
ipcMain.on(IPCEvents.APP_ASYNC_INDEX_TSX_LOADED) false false
splashScreen.pageReady
21:42:50.365 › [libdiscore] The answer for life the universe and everything is: 42
21:42:50.368 › [FAST CONNECT] sending identify
21:42:50.369 › [Spellchecker] sh is not a valid locale.
mainScreen.UpdaterEvents: UPDATER_HISTORY_QUERY_AND_TRUNCATE
Main process startup timing:
|  index-init:                                     101.67
|  index-init-duration:                            141.23 (39.56)
|  bootstrap-gpuflags:                             140.26
|  bootstrap-gpuflags-duration:                    143.11 (2.85)
|  bootstrap-startapp:                             229.55
|  bootstrap-startupdate:                          230.50
|  bootstrap-startupdate-duration:                 1279.21 (1048.71)
|  splash-window-launch:                           242.67
|  splash-window-loadurl-duration:                 263.90 (21.23)
|  splash-window-duration:                         2517.02 (2274.35)
|  splash-screen-ready:                            771.42
|  splash-update-complete:                         1279.04
|  splash-launch-mainwindow:                       1279.12
|  bootstrap-coremodule-startup:                   1279.22
|  bootstrap-coremodule-startup-duration:          1298.88 (19.66)
|  coremodule-index-startup:                       1285.46
|  coremodule-index-startup-duration:              1298.87 (13.41)
|  mainscreen-launch-window:                       1295.74
|  mainscreen-launch-window-duration:              1316.47 (20.73)
|  mainscreen-launch-window-misc-setup:            1310.03
|  mainscreen-launch-window-misc-setup-duration:   1311.80 (1.77)
|  mainscreen-loadmainpage:                        1312.32
|  mainscreen-loadmainpage-duration:               2414.16 (1101.84)
|  splash-destroy-splashwindow:                    2416.77
|  bootstrap-coremodule-show-mainwin:              2416.88
blackbox: 5/13/2026, 9:42:50 PM GMT+1 8 window.close win1
blackbox: 5/13/2026, 9:42:50 PM GMT+1 9 webContents.destroyed web1
blackbox: 5/13/2026, 9:42:50 PM GMT+1 10 window.closed win1
21:42:50.675 › [MediaEngineStore] Failed to load Krisp module: Failed to setup Krisp module, error code: -3
21:42:50.678 › [AVError] AV error reported: noise-canceller-error {"underlyingError":"NoiseCancellerError.KRISP_INIT_ERROR_UNSIGNED"}
21:42:50.831 › [PostMessageTransport] Protocol error: event data should be an Array!
21:42:50.831 › [PostMessageTransport] Protocol error: event data should be an Array!
21:42:50.832 › [Spellchecker] Switching to en-GB (available)
mainScreen.UpdaterEvents: UPDATER_HISTORY_QUERY_AND_TRUNCATE
21:42:50.854 › [RPCServer:WSS] Starting on 6463
mainScreen.UpdaterEvents: UPDATER_HISTORY_QUERY_AND_TRUNCATE
21:42:50.858 › [RPCServer:IPC] Starting on /run/user/1000/discord-ipc-0
21:42:50.859 › [MediaEngineStore] OpenH264 is ready [object Object]
21:42:50.964 › [ConnectionStore] Socket is reconnecting because of starting new session
21:42:50.965 › [GatewaySocket] .connect() called, new state is WILL_RECONNECT
21:42:50.965 › [GatewaySocket] Setting connection state to WILL_RECONNECT
21:42:50.965 › [GatewaySocket] Setting connection state to CONNECTING
21:42:50.965 › [GatewaySocket] [CONNECT] wss://gateway.discord.gg, encoding: etf, version: 9, compression: zstd-stream
21:42:50.965 › [GatewaySocket] [FAST CONNECT] successfully took over websocket, state: [object Object]
21:42:50.965 › [GatewaySocket] [CONNECTED] wss://gateway.discord.gg/?encoding=etf&v=9&compress=zstd-stream in 0 ms
21:42:50.965 › [ConnectionStore] handleIdentify called [object Object]
21:42:50.965 › [GatewaySocket] Setting connection state to IDENTIFYING
21:42:50.966 › [GatewaySocket] [IDENTIFY, fast-connect]
21:42:50.966 › [GatewaySocket] [HELLO] via 
gateway-prd-arm-us-east1-d-kqc4: 0, heartbeat interval: 41250, took 1 ms
21:42:50.996 › [MediaEngineStore] OpenH264 cleanup [object Object]
21:42:51.235 › [GatewaySocket] [READY] took 270ms, as 1ec9f5129a39d08edc6feef9d7655acc
21:42:51.235 › [GatewaySocket] 
gateway-prd-arm-us-east1-d-kqc4: 378.286
|  id_created: 2.14
|  session_lookup_time: 0.357
|  session_lookup_finished: 0.011
|  sessions-prd-gcp-us-east1-d-158: 357.106
|  |  start_session: 296.188
|  |  |  prd-rpc-5858c9fb7f-fl7qq: 185.241
|  |  |  |  get_user: 7.017
|  |  |  |  get_guilds: 66.564
|  |  |  |  user_settings_proto: 0.057
|  |  |  |  relationships: 33.61
|  |  |  |  game_relationships: 0.005
|  |  |  |  friend_suggestion: 0.043
|  |  |  |  connections: 0.231
|  |  |  |  serialized_read_states: 0.009
|  |  |  |  send_scheduled_deletion_message: 0.014
|  |  |  |  sanitize_premium_perks: 0.002
|  |  |  |  guild_join_requests: 0.001
|  |  |  |  user_guild_settings: 0.001
|  |  |  |  serialized_private_channels: 0.001
|  |  |  |  user_segments: 2.853
|  |  |  |  game_invites: 0.013
|  |  |  |  blocker_ids: 0.002
|  |  |  |  affine_user_ids: 0.012
|  |  |  |  experiments: 52.258
|  |  |  |  required_action: 0.013
|  |  |  |  authorized_ip_coro: 0.003
|  |  |  |  pending_payments: 8.757
|  |  |  |  apex_experiments: 76.729
|  |  |  |  sessions_experiments: 0.005
|  |  |  |  played_application_ids: 0.008
|  |  |  |  linked_users: 0.002
|  |  |  |  ad_personalization_toggles_disabled: 0.004
|  |  |  |  regional_feature_config: 0.003
|  |  starting_guild_connect: 0.143
|  |  presence_started: 0.369
|  |  guilds_started: 2.551
|  |  lobbies_started: 0.002
|  |  guilds_connect: 51.602
|  |  presence_connect: 0
|  |  connect_finished: 52.024
|  |  build_ready: 5.262
|  |  clean_ready: 0.003
|  |  optimize_ready: 0.467
|  |  split_ready: 0.075
21:42:51.235 › [GatewaySocket] Setting connection state to SESSION_ESTABLISHED
21:42:51.235 › [GatewaySocket] Updating resume url to wss://gateway-us-east1-d.discord.gg
21:42:51.280 › [Flux] Dispatching CONNECTION_OPEN
21:42:51.284 › [AuthenticationStore] handleConnectionOpen called [object Object]
21:42:51.286 › [DatabaseManager] removing database (user: 321614457623019520, database: undefined)
21:42:51.286 › [DatabaseManager] added database (321614457623019520 → null)
21:42:51.296 › [NativeDispatchUtils] Tried getting Dispatch instance before instantiated
21:42:51.367 › [MessageActionCreators] Fetching messages for 1070436481912549497 between undefined and undefined. jump={"jumpType":"ANIMATED"}
21:42:51.372 › [OverlayRenderStore] setOverlayEnabled: not supported
21:42:51.682 › [MessageActionCreators] Fetched 10 messages for 1070436481912549497 isBefore:false isAfter:false
21:42:51.682 › [ChannelMessages] loadComplete: resetting state for channelId=1070436481912549497, sending.length=0
21:42:51.684 › [GatewaySocket] [READY_SUPPLEMENTAL] took 720ms
21:42:51.684 › [GatewaySocket] Setting connection state to SESSION_ESTABLISHED
mainScreen.UpdaterEvents: CHECK_FOR_UPDATES UPDATE_NOT_AVAILABLE
5/13/2026, 9:42:53 PM GMT+1 [Modules] Host is up to date.
5/13/2026, 9:42:53 PM GMT+1 [Modules] Checking for module updates at https://inject.shelter.uwu.network/shelter/modules/stable/versions.json
21:42:53.766 › [OverlayKeybindExperimentManager] Experiments initializing...
21:42:53.788 › [OverlayKeybindExperimentManager] Experiments initialized
21:42:53.791 › [libdiscore] [Cache] Set cache for key: experiments_snapshot
5/13/2026, 9:42:53 PM GMT+1 [Modules] No module updates available.
legacyModuleUpdater: update-check-finished

Additional context

No response

System metadata

  • system: "x86_64-linux"
  • host os: Linux 7.0.4-xanmod1, NixOhEss, 26.05 (Yarara), 26.05.20260513.13c1852
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.34.7
  • nixpkgs: /nix/store/y778kz293p8mm2za75ndah3cblq1z1rk-source

Notify maintainers

notifying @FlameFlag for work on the PR which caused the problems.


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Activity

  1. added
    0.kind: bug
    on May 13, 2026
  2. fxzzi commented on May 13, 2026

    @fxzzi
    MemberAuthor

    after further discussions, it seems that discord on nix is still attempting to use the v1 updater API which is no longer available as per these links:

    https://discord.com/api/modules/stable/versions.json
    https://inject.shelter.uwu.network/shelter/modules/stable/versions.json

    is there some way to allow discord to use the v2 API?

    I am running discord with the disableUpdates attr set to false, as I manually set SKIP_HOST_UPDATE to true. The logs above are taken in this state. If I also add SKIP_MODULE_UPDATE I'm able to get at least OpenASAR to work, but this of course disables the client from even using the shelter module endpoint in any way.

    Any help here would be appreciated. My current workaround has been to enable both SKIP_HOST_UPDATE and SKIP_MODULE_UPDATE, update openASAR, and override equicord to the latest available tag, instead of using the sheltupdate endpoints. This creates extra hassle for me though and it'd be nice if I could get this working.

  3. 4evy commented on May 13, 2026

    @4evy
    Member

    Just to clear up the timeline a bit: when #507728 was merged on 2026-04-24, only the non-stable Linux variants had moved to Discord’s new distro layout: PTB, Canary, and Development. Stable Linux was still using the old/legacy tarball layout at that point, and Darwin was still on the old path too

    The PR that moved stable Linux (and all darwin variants) to the distro layout was #515876, merged on 2026-05-13

    That said, after looking into this more

    The issue seems to be that Discord’s Linux native updater assumes the app is running from Discord’s own app-<version> directory layout. We install/run Discord from the nix store instead, so paths.getRootPath() ends up null and Discord’s native updater never initializes. When that happens, Discord falls back to the legacy module updater

  4. 4evy commented on May 13, 2026

    @4evy
    Member

    @fxzzi Could you try using this discord override and let me know if "solves" it for you?

    (pkgs.discord.overrideAttrs (old: {
      nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.asar ];
    
      postInstall = (old.postInstall or "") + ''
        asar extract "$out/opt/Discord/resources/app.asar" app.asar.unpacked
    
        substituteInPlace app.asar.unpacked/bundle.js \
          --replace-fail \
            'if(bootstrapConstants.USE_NEW_UPDATER&&!isStandaloneModules&&tryInitUpdater(buildInfo,bootstrapConstants.NEW_UPDATE_ENDPOINT,bootstrapConstants.USE_RUST_BSPATCH))' \
            'if(bootstrapConstants.USE_NEW_UPDATER&&!isStandaloneModules&&(!settings?.get("SKIP_HOST_UPDATE")||bootstrapConstants.NEW_UPDATE_ENDPOINT!=="https://updates.discord.com/")&&tryInitUpdater(buildInfo,bootstrapConstants.NEW_UPDATE_ENDPOINT,bootstrapConstants.USE_RUST_BSPATCH))' \
          --replace-fail \
            'let paths=__webpack_require__(7215),rootPath=paths.getRootPath(),userDataPath=paths.getUserData();if(null==rootPath)return!1;' \
            'let paths=__webpack_require__(7215),rootPath=paths.getRootPath()??(repositoryUrl!=="https://updates.discord.com/"?paths.getUserData():null),userDataPath=paths.getUserData();if(null==rootPath)return!1;' \
          --replace-fail \
            'await newUpdater.startCurrentVersion(queryOptions)' \
            'await newUpdater.startCurrentVersion(queryOptions,{allowObsoleteHost:bootstrapConstants.NEW_UPDATE_ENDPOINT!=="https://updates.discord.com/"&&__webpack_require__(9122).getSettings()?.get("SKIP_HOST_UPDATE")})'
    
        rm "$out/opt/Discord/resources/app.asar"
        asar pack app.asar.unpacked "$out/opt/Discord/resources/app.asar"
        rm -rf app.asar.unpacked
      '';
    }))
  5. fxzzi commented on May 13, 2026

    @fxzzi
    MemberAuthor

    thanks for the reply!

    yeah!!! this seems to work now :) now using the update endpoint without problems.
    Doesn't work with openasar at the same time though: substitute(): ERROR: file 'app.asar.unpacked/bundle.js' does not exist

  6. 4evy commented on May 14, 2026

    @4evy
    Member

    @fxzzi Nice, glad the custom endpoint path works

    The OpenASAR failure is a separate "interaction": withOpenASAR replaces Discord’s upstream resources/app.asar, so the override no longer has Discord’s bundle.js to patch

    OpenASAR ships its own updater implementation under updater/updater.js/splash/index.js

  7. 4evy commented on Aug 19, 2026

    @4evy
    Member

    Hey, it's been some time. I've looked into this again, and the May override is outdated

    It still applies the same two patches, but it matches minified bundle.js text. That text moves whenever Discord ships a new host, so the override dies on the next update

    I switched to a small hook Discord loads before bundle.js. The hook patches those same two call sites when Node compiles the updater, so you don't have to chase webpack IDs after every release. Official endpoints stay on stock behavior. A custom NEW_UPDATE_ENDPOINT gets a user-data root and allowObsoleteHost when SKIP_HOST_UPDATE is set

    OpenASAR still replaces app.asar, so this hook never runs there, patch OpenASAR's own updater.js and splash/index.js in the OpenASAR package instead

    Linux pkgs.discord is a buildFHSEnv now. overrideAttrs on that wrapper cannot see resources/app.asar, so we patch unwrappedDiscord instead

    Save this as say discord-custom-updater-overlay.nix next to your config and import it:

    {
      pkgs,
      discordPackage ? pkgs.discord,
    }:
    
    let
      inherit (pkgs) asar writeText;
    
      updaterHook = writeText "updater-hook.js" ''
        "use strict";
    
        if (globalThis.__nixpkgsDiscordUpdaterHook) {
          return;
        }
        globalThis.__nixpkgsDiscordUpdaterHook = true;
    
        const Module = require("module");
        const origCompile = Module.prototype._compile;
        const official = "https://updates.discord.com/";
    
        Module.prototype._compile = function (content, filename) {
          if (typeof content !== "string") {
            return origCompile.call(this, content, filename);
          }
    
          if (
            !content.includes("getRootPath") &&
            !content.includes("startCurrentVersion")
          ) {
            return origCompile.call(this, content, filename);
          }
    
          content = content
            .replace(
              /rootPath=([\w$]+)\.getRootPath\(\),userDataPath=\1\.getUserData\(\);if\(null==rootPath\)return!1;/,
              `rootPath=$1.getRootPath()??(repositoryUrl!=="''${official}"?$1.getUserData():null),userDataPath=$1.getUserData();if(null==rootPath)return!1;`,
            )
            .replace(
              /await ([\w$]+)\.startCurrentVersion\(([\w$]+)\)(?!\s*\{)/,
              `await $1.startCurrentVersion($2,{allowObsoleteHost:bootstrapConstants.NEW_UPDATE_ENDPOINT!=="''${official}"&&appSettings.getSettings()?.get("SKIP_HOST_UPDATE")})`,
            )
            .replace(
              "const root_path = paths.getRootPath();",
              `const root_path = paths.getRootPath() ?? (repository_url !== "''${official}" ? paths.getUserData() : null);`,
            )
            .replace(
              "await inst.startCurrentVersion({});",
              `await inst.startCurrentVersion({}, { allowObsoleteHost: require("../Constants").NEW_UPDATE_ENDPOINT !== "''${official}" && settings.get("SKIP_HOST_UPDATE") });`,
            );
    
          return origCompile.call(this, content, filename);
        };
      '';
    
      updaterMain = writeText "updater-main.js" ''
        "use strict";
        require("./updater-hook.js");
        require("./bundle.js");
      '';
    
      injectHook = ''
        resources=""
        for d in "$out"/opt/*/resources; do
          if [ -d "$d" ]; then
            resources="$d"
            break
          fi
        done
    
        host_asar=""
        if [ -n "$resources" ] && [ -f "$resources/_app.asar" ]; then
          host_asar="$resources/_app.asar"
        elif [ -n "$resources" ] && [ -f "$resources/app.asar" ]; then
          host_asar="$resources/app.asar"
        fi
    
        if [ -z "$host_asar" ]; then
          echo "custom-updater: no packed app.asar; skipping"
        else
          unpack=app.asar.unpacked
          rm -rf "$unpack"
          ${asar}/bin/asar extract "$host_asar" "$unpack"
          if [ ! -f "$unpack/bundle.js" ]; then
            echo "custom-updater: asar has no bundle.js (OpenASAR?); skipping hook inject"
          else
            cp ${updaterHook} "$unpack/updater-hook.js"
            cp ${updaterMain} "$unpack/updater-main.js"
            substituteInPlace "$unpack/package.json" \
              --replace-fail '"main": "bundle.js"' '"main": "updater-main.js"'
            rm -f "$host_asar"
            ${asar}/bin/asar pack "$unpack" "$host_asar"
            echo "custom-updater: injected updater hook into $host_asar"
          fi
          rm -rf "$unpack"
        fi
      '';
    
      patchOpenasar =
        openasar:
        openasar.overrideAttrs (old: {
          postPatch = (old.postPatch or "") + ''
            substituteInPlace ./src/updater/updater.js \
              --replace-fail \
                "const root_path = paths.getRootPath();" \
                "const root_path = paths.getRootPath() ?? (repository_url !== 'https://updates.discord.com/' ? paths.getUserData() : null);"
            substituteInPlace ./src/splash/index.js \
              --replace-fail \
                "await inst.startCurrentVersion({});" \
                "await inst.startCurrentVersion({}, { allowObsoleteHost: require('../Constants').NEW_UPDATE_ENDPOINT !== 'https://updates.discord.com/' && settings.get('SKIP_HOST_UPDATE') });"
          '';
        });
    
      enableCustomUpdater =
        discordPkg:
        discordPkg.override {
          unwrappedDiscord = discordPkg.unwrappedDiscord.overrideAttrs (old: {
            nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ asar ];
            postInstall = (old.postInstall or "") + injectHook;
          });
        };
    
    in
    {
      inherit enableCustomUpdater patchOpenasar;
      discord = enableCustomUpdater discordPackage;
    }

    Stock Discord:

    let
      custom = import ./discord-custom-updater-overlay.nix { inherit pkgs; };
    in
    {
      environment.systemPackages = [
        (custom.enableCustomUpdater (pkgs.discord.override { disableUpdates = false; }))
      ];
    }

    With OpenASAR:

    let
      custom = import ./discord-custom-updater-overlay.nix { inherit pkgs; };
    in
    {
      environment.systemPackages = [
        (custom.enableCustomUpdater (pkgs.discord.override {
          disableUpdates = false;
          withOpenASAR = true;
          openasar = custom.patchOpenasar pkgs.openasar;
        }))
      ];
    }

    Keep SKIP_HOST_UPDATE in ~/.config/discord/settings.json. Without it, Discord still tries to replace the nix-store host

  8. fxzzi commented on Aug 24, 2026

    @fxzzi
    MemberAuthor

    thanks for this, i gave it a try and it worked :)

    is there any chance for this to be upstreamed to nixpkgs / openasar? I'm continuing to use your nixcord repo for now as it allows me to keep the equicord / vencord up to date.

  9. 4evy commented on Aug 24, 2026

    @4evy
    Member

    @fxzzi glad to hear it works and that you're enjoying Nixcord too! Unfortunately, I'll be traveling again (like today), so I'll be pretty busy

    I'm still not sure how upstreamable this is (there may be a better approach, and I need to look into it more)

    If you have any ideas on your side, let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions