mirror of
https://github.com/nix-community/home-manager
synced 2025-01-30 12:55:02 +01:00
zed-editor: add installRemoteServer option
This commit is contained in:
parent
0a64a209aa
commit
1b4f2a4816
3 changed files with 45 additions and 0 deletions
|
@ -80,6 +80,21 @@ in {
|
|||
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
|
||||
[ 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 != { }) {
|
||||
source = jsonFormat.generate "zed-user-settings" mergedSettings;
|
||||
});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
zed-extensions = ./extensions.nix;
|
||||
zed-install-remote-server = ./install-remote-server.nix;
|
||||
zed-keymap = ./keymap.nix;
|
||||
zed-settings = ./settings.nix;
|
||||
}
|
||||
|
|
20
tests/modules/programs/zed-editor/install-remote-server.nix
Normal file
20
tests/modules/programs/zed-editor/install-remote-server.nix
Normal 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"
|
||||
'';
|
||||
}
|
Loading…
Add table
Reference in a new issue