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)

This commit is contained in:
isabel 2025-06-06 21:51:16 +01:00 committed by GitHub
parent 96482a538e
commit 1d595a5b64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -41,7 +41,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;
@ -138,7 +138,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 {
@ -153,7 +153,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
@ -191,5 +192,12 @@ in
jsonFormat.generate "zed-theme-${n}" v; jsonFormat.generate "zed-theme-${n}" v;
} }
) 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";
}
];
}; };
} }