mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-15 17:50:53 +00: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:
parent
83002f1846
commit
4d8d8c385e
1 changed files with 23 additions and 1 deletions
|
@ -22,6 +22,13 @@ in {
|
||||||
|
|
||||||
package = mkPackageOption pkgs "zed-editor" { };
|
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 {
|
userSettings = mkOption {
|
||||||
type = jsonFormat.type;
|
type = jsonFormat.type;
|
||||||
default = { };
|
default = { };
|
||||||
|
@ -76,7 +83,22 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
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 != { }) {
|
xdg.configFile."zed/settings.json" = (mkIf (mergedSettings != { }) {
|
||||||
source = jsonFormat.generate "zed-user-settings" mergedSettings;
|
source = jsonFormat.generate "zed-user-settings" mergedSettings;
|
||||||
|
|
Loading…
Reference in a new issue