1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-28 04:39:48 +01:00

zed-editor: add extraPackages option

Add extraPackages option to make for example language servers
available to Zed without having to add them to `home.packages` or
similar.
This commit is contained in:
Ingo Reitz 2024-11-24 21:15:57 +01:00 committed by GitHub
parent 83002f1846
commit 4d8d8c385e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,6 +22,13 @@ in {
package = mkPackageOption pkgs "zed-editor" { };
extraPackages = mkOption {
type = with types; listOf package;
default = [ ];
example = literalExpression "[ pkgs.nixd ]";
description = "Extra packages available to Zed.";
};
userSettings = mkOption {
type = jsonFormat.type;
default = { };
@ -76,7 +83,22 @@ in {
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
home.packages = if cfg.extraPackages != [ ] then
[
(pkgs.symlinkJoin {
name =
"${lib.getName cfg.package}-wrapped-${lib.getVersion cfg.package}";
paths = [ cfg.package ];
preferLocalBuild = true;
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/zeditor \
--suffix PATH : ${lib.makeBinPath cfg.extraPackages}
'';
})
]
else
[ cfg.package ];
xdg.configFile."zed/settings.json" = (mkIf (mergedSettings != { }) {
source = jsonFormat.generate "zed-user-settings" mergedSettings;