Home

zed.drv @89a68629e88a19f08826e5c17bf96af6415ef7a3 - refs - log -
-
https://git.jolheiser.com/zed.drv.git
My Zed configuration as a Nix derivation
zed.drv / default.nix
- raw -
 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
{
  pkgs ? import <nixpkgs> { },
}:
let
  settings = import ./settings { inherit pkgs; };
  jsonSettings = pkgs.writeText "jolheiser-zed-settings.json" (builtins.toJSON settings);
  zed =
    x11:
    pkgs.symlinkJoin {
      name = "jolheiser-zed";
      paths = [ pkgs.zed-editor ];
      buildInputs = [ pkgs.makeWrapper ];
      postBuild = ''
        rm $out/bin/zeditor
        makeWrapper ${pkgs.lib.getExe pkgs.zed-editor} $out/bin/zeditor \
          ${pkgs.lib.optionalString x11 "--unset WAYLAND_DISPLAY"} \
          --run 'export ZED_DATA_DIR="''${XDG_DATA_HOME:-$HOME/.local/share}/jolheiser-zed"' \
          --run 'mkdir -p "$ZED_DATA_DIR/config"' \
          --run 'cp -f ${jsonSettings} "$ZED_DATA_DIR/config/settings.json"' \
          --add-flags "--user-data-dir \$ZED_DATA_DIR"
      '';
    };
in
{
  default = zed false;
  zed-wayland = zed false;
  zed-x11 = zed true;
}