1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2025-01-30 21:05:02 +01:00

zed-editor: add installRemoteServer option

This commit is contained in:
Gaetan Lepage 2025-01-17 16:40:11 +01:00 committed by Robert Helgesson
parent 0a64a209aa
commit 1b4f2a4816
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
3 changed files with 45 additions and 0 deletions

View file

@ -80,6 +80,21 @@ in {
Use the name of a repository in the [extension list](https://github.com/zed-industries/extensions/tree/main/extensions). Use the name of a repository in the [extension list](https://github.com/zed-industries/extensions/tree/main/extensions).
''; '';
}; };
installRemoteServer = mkOption {
type = types.bool;
default = false;
example = true;
description = ''
Whether to symlink the Zed's remote server binary to the expected
location. This allows remotely connecting to this system from a
distant Zed client.
For more information, consult the
["Remote Server" section](https://wiki.nixos.org/wiki/Zed#Remote_Server)
in the wiki.
'';
};
}; };
}; };
@ -101,6 +116,15 @@ in {
else else
[ cfg.package ]; [ cfg.package ];
home.file = mkIf (cfg.installRemoteServer && (cfg.package ? remote_server))
(let
inherit (cfg.package) version remote_server;
binaryName = "zed-remote-server-stable-${version}";
in {
".zed_server/${binaryName}".source =
lib.getExe' remote_server binaryName;
});
xdg.configFile."zed/settings.json" = (mkIf (mergedSettings != { }) { xdg.configFile."zed/settings.json" = (mkIf (mergedSettings != { }) {
source = jsonFormat.generate "zed-user-settings" mergedSettings; source = jsonFormat.generate "zed-user-settings" mergedSettings;
}); });

View file

@ -1,5 +1,6 @@
{ {
zed-extensions = ./extensions.nix; zed-extensions = ./extensions.nix;
zed-install-remote-server = ./install-remote-server.nix;
zed-keymap = ./keymap.nix; zed-keymap = ./keymap.nix;
zed-settings = ./settings.nix; zed-settings = ./settings.nix;
} }

View file

@ -0,0 +1,20 @@
{ config, ... }:
{
programs.zed-editor = {
enable = true;
package = config.lib.test.mkStubPackage { version = "57"; } // {
remote_server = config.lib.test.mkStubPackage {
buildScript = ''
mkdir -p $out/bin
touch $out/bin/zed-remote-server-stable-57
'';
};
};
installRemoteServer = true;
};
nmt.script = ''
assertFileExists "home-files/.zed_server/zed-remote-server-stable-57"
'';
}