summaryrefslogtreecommitdiffstats
path: root/pkgs/development/tools/electron/wrapper.nix
blob: 5f4b61abc575ade91b897c862d0931a56878579a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
  stdenv,
  electron-unwrapped,
  wrapGAppsHook3,
  makeWrapper,
  gsettings-desktop-schemas,
  glib,
  gtk3,
  gtk4,
}:

stdenv.mkDerivation {
  pname = "electron";
  inherit (electron-unwrapped) version;

  nativeBuildInputs = [
    wrapGAppsHook3
    makeWrapper
  ];
  buildInputs = [
    # needed for GSETTINGS_SCHEMAS_PATH
    gsettings-desktop-schemas
    glib
    gtk3
    gtk4
  ];
  dontWrapGApps = true;

  buildCommand = ''
    gappsWrapperArgsHook
    mkdir -p $out/bin
    makeWrapper "${electron-unwrapped}/libexec/electron/electron" "$out/bin/electron" \
      "''${gappsWrapperArgs[@]}" \
      --set CHROME_DEVEL_SANDBOX $out/libexec/electron/chrome-sandbox

    ln -s ${electron-unwrapped}/libexec $out/libexec
  '';

  passthru = {
    unwrapped = electron-unwrapped;
    inherit (electron-unwrapped) headers dist;
  };

  __structuredAttrs = true;
  strictDeps = true;

  inherit (electron-unwrapped) meta;
}