From 01f40d52d65318463d71aa485fe9ad6f26357b45 Mon Sep 17 00:00:00 2001 From: "Shay Eclipse K. Stage" Date: Thu, 9 Jan 2025 12:04:34 +0100 Subject: [PATCH] zsh/prezto: add `package` option (#5938) Allow setting a custom package for `programs.zsh.prezto`. --- modules/programs/zsh.nix | 2 +- modules/programs/zsh/prezto.nix | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix index 50f8055c..3e13404c 100644 --- a/modules/programs/zsh.nix +++ b/modules/programs/zsh.nix @@ -671,7 +671,7 @@ in '' ${optionalString cfg.prezto.enable - (builtins.readFile "${pkgs.zsh-prezto}/share/zsh-prezto/runcoms/zshrc")} + (builtins.readFile "${cfg.prezto.package}/share/zsh-prezto/runcoms/zshrc")} ${concatStrings (map (plugin: '' if [[ -f "$HOME/${pluginsDir}/${plugin.name}/${plugin.file}" ]]; then diff --git a/modules/programs/zsh/prezto.nix b/modules/programs/zsh/prezto.nix index 9a94f238..5fdc8da2 100644 --- a/modules/programs/zsh/prezto.nix +++ b/modules/programs/zsh/prezto.nix @@ -14,6 +14,8 @@ let options = { enable = mkEnableOption "prezto"; + package = mkPackageOption pkgs "prezto" { default = "zsh-prezto"; }; + caseSensitive = mkOption { type = types.nullOr types.bool; # See . @@ -379,15 +381,15 @@ in { }; config = mkIf cfg.enable (mkMerge [{ home.file."${relToDotDir ".zprofile"}".text = - builtins.readFile "${pkgs.zsh-prezto}/share/zsh-prezto/runcoms/zprofile"; + builtins.readFile "${cfg.package}/share/zsh-prezto/runcoms/zprofile"; home.file."${relToDotDir ".zlogin"}".text = - builtins.readFile "${pkgs.zsh-prezto}/share/zsh-prezto/runcoms/zlogin"; + builtins.readFile "${cfg.package}/share/zsh-prezto/runcoms/zlogin"; home.file."${relToDotDir ".zlogout"}".text = - builtins.readFile "${pkgs.zsh-prezto}/share/zsh-prezto/runcoms/zlogout"; - home.packages = with pkgs; [ zsh-prezto ]; + builtins.readFile "${cfg.package}/share/zsh-prezto/runcoms/zlogout"; + home.packages = [ cfg.package ]; home.file."${relToDotDir ".zshenv"}".text = - builtins.readFile "${pkgs.zsh-prezto}/share/zsh-prezto/runcoms/zshenv"; + builtins.readFile "${cfg.package}/share/zsh-prezto/runcoms/zshenv"; home.file."${relToDotDir ".zpreztorc"}".text = '' # Generated by Nix ${optionalString (cfg.caseSensitive != null) ''