1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

zed-editor: allow for nullable package (#7220)

(cherry picked from commit 1d595a5b64)
This commit is contained in:
isabel 2025-06-06 21:51:16 +01:00 committed by Austin Horstman
parent 6f656618eb
commit 3b955f5f0a

View file

@ -31,7 +31,7 @@ in
programs.zed-editor = { programs.zed-editor = {
enable = lib.mkEnableOption "Zed, the high performance, multiplayer code editor from the creators of Atom and Tree-sitter"; enable = lib.mkEnableOption "Zed, the high performance, multiplayer code editor from the creators of Atom and Tree-sitter";
package = lib.mkPackageOption pkgs "zed-editor" { }; package = lib.mkPackageOption pkgs "zed-editor" { nullable = true; };
extraPackages = mkOption { extraPackages = mkOption {
type = with types; listOf package; type = with types; listOf package;
@ -128,7 +128,7 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = home.packages = mkIf (cfg.package != null) (
if cfg.extraPackages != [ ] then if cfg.extraPackages != [ ] then
[ [
(pkgs.symlinkJoin { (pkgs.symlinkJoin {
@ -143,7 +143,8 @@ in
}) })
] ]
else else
[ cfg.package ]; [ cfg.package ]
);
home.file = mkIf (cfg.installRemoteServer && (cfg.package ? remote_server)) ( home.file = mkIf (cfg.installRemoteServer && (cfg.package ? remote_server)) (
let let
@ -184,5 +185,12 @@ in
} }
) cfg.themes ) cfg.themes
); );
assertions = [
{
assertion = cfg.extraPackages != [ ] -> cfg.package != null;
message = "{option}programs.zed-editor.extraPackages requires non null {option}programs.zed-editor.package";
}
];
}; };
} }