# Need help building an electron application in a Nix dev shell

**URL:** https://discourse.nixos.org/t/need-help-building-an-electron-application-in-a-nix-dev-shell/80769
**Category:** Help
**Created:** [October 26, 2026, 4:25am UTC](https://discourse.nixos.org/t/need-help-building-an-electron-application-in-a-nix-dev-shell/80769 "2026-10-26T04:25:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![millysoose](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/m/f14d63/32.png) [@millysoose](https://discourse.nixos.org/u/millysoose)
#### Post date: [October 26, 2026, 4:25am UTC](https://discourse.nixos.org/t/need-help-building-an-electron-application-in-a-nix-dev-shell/80769/1 "2026-10-26T04:25:01Z")

</div>

Hi, I am working with a team of other amateurs to develop an electron application for a senior design project. I thought it would be nice to use Nix to create an isolated cross-platform virtual environment. This is what that currently looks like:

```auto
{
  description = "A basic flake providing a devShell";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
  };

  outputs = { nixpkgs, ... }: {
    devShells = builtins.mapAttrs (system: pkgs: {
      default = pkgs.mkShell {
        packages = with pkgs; [
          nodejs
          electron
          teamtype
        ];
        shellHook = ''
          # Forces npm to use the Nix-patched Electron binary
          export ELECTRON_OVERRIDE_DIST_PATH="${pkgs.electron}/bin"
        '';
      };
    }) nixpkgs.legacyPackages;
  };
}

```

It worked great until I added [electron-builder](https://www.electron.build/docs) as an npm package. Electron-builder tries to download other tools which is of course not patched for Nix. And there doesn’t seem to be any way to tell electron-builder to use the equivalent Nix packages.

So from what I read I need to use a FHS environment. But we might have a team member who uses MacOS which doesn’t work with FHS under Nix. So what would you guys recommend for this situation? Thanks.

---

<div class="post-metadata">

### Author: ![millysoose](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/m/f14d63/32.png) [@millysoose](https://discourse.nixos.org/u/millysoose)
#### Post date: [October 26, 2026, 6:33am UTC](https://discourse.nixos.org/t/need-help-building-an-electron-application-in-a-nix-dev-shell/80769/2 "2026-10-26T06:33:29Z")

</div>

Okay as you can all see below I created a FHS environment just for building and confirmed it works. But is it possible to modify my non-FHS devshell to enter this environment whenever “electron-builder” is executed, and run it there instead? That way nobody ever has to run nix develop .#build.

```auto
{
  description = "A basic flake providing a devShell";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
  };

  outputs = { nixpkgs, ... }: {
    devShells = builtins.mapAttrs (
      system: pkgs:
      let
        devShell = pkgs.mkShell {
          packages = with pkgs; [
            nodejs
            electron
            teamtype
          ];
          shellHook = ''
            export ELECTRON_OVERRIDE_DIST_PATH="${pkgs.electron}/bin"
          '';
        };
      in
      {
        build =
          if pkgs.stdenv.hostPlatform.isLinux then
            (pkgs.buildFHSEnv {
              name = "electron-builder-env";
              targetPkgs =
                pkgs: with pkgs; [
                  nodejs
                  zlib
                ];
            }).env
          else
            devShell;
        default = devShell;
      }
    ) nixpkgs.legacyPackages;
  };
}

```
