Skip to content

Commit 32b59f5

Browse files
author
Mrid22
committed
pay-respects integration
fix pay respects package fix flags
1 parent 4e12f43 commit 32b59f5

File tree

1 file changed

+33
-24
lines changed

1 file changed

+33
-24
lines changed

modules/zsh/module.nix

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
lib,
44
wlib,
55
...
6-
}:
7-
let
6+
}: let
87
cfg = config.settings;
9-
in
10-
{
8+
in {
119
_class = "wrapper";
1210
options = {
1311
settings = {
@@ -23,7 +21,7 @@ in
2321

2422
shellAliases = lib.mkOption {
2523
type = with lib.types; attrsOf str;
26-
default = { };
24+
default = {};
2725
description = "shell aliases (alias -- key=value)";
2826
};
2927

@@ -62,6 +60,17 @@ in
6260
default = config.pkgs.starship; # Or self'.packages.starship, assuming you use flake parts
6361
};
6462
};
63+
pay-respects = {
64+
enable = lib.mkEnableOption "pay-respects";
65+
package = lib.mkOption {
66+
type = lib.types.package;
67+
default = config.pkgs.pay-respects;
68+
};
69+
flags = lib.mkOption {
70+
type = with lib.types; listOf str;
71+
default = [];
72+
};
73+
};
6574
zoxide = {
6675
enable = lib.mkEnableOption "zoxide";
6776
package = lib.mkOption {
@@ -70,7 +79,7 @@ in
7079
};
7180
flags = lib.mkOption {
7281
type = with lib.types; listOf str;
73-
default = [ ];
82+
default = [];
7483
};
7584
};
7685
};
@@ -199,22 +208,21 @@ in
199208
description = "extra stuff to put in .zshrc, gets appended *after* all of the options";
200209
};
201210

202-
".zshrc" =
203-
let
204-
zoxide-flags = lib.concatStringsSep " " cfg.integrations.zoxide.flags;
205-
ing = cfg.integrations;
206-
in
211+
".zshrc" = let
212+
zoxide-flags = lib.concatStringsSep " " cfg.integrations.zoxide.flags;
213+
pay-respects-flags = lib.concatStringsSep " " cfg.integrations.pay-respects.flags;
214+
ing = cfg.integrations;
215+
in
207216
lib.mkOption {
208217
type = wlib.types.file config.pkgs;
209218
default.content = builtins.concatStringsSep "\n" [
210219
"# KeyMap"
211220
(
212-
if cfg.keyMap == "viins" then
213-
"bindkey -a"
214-
else if cfg.keyMap == "vicmd" then
215-
"bindkey -v"
216-
else
217-
"bindkey -e"
221+
if cfg.keyMap == "viins"
222+
then "bindkey -a"
223+
else if cfg.keyMap == "vicmd"
224+
then "bindkey -v"
225+
else "bindkey -e"
218226
)
219227
(lib.optionalString cfg.autocd "setopt autocd")
220228

@@ -230,9 +238,9 @@ in
230238
"#Autosuggestions"
231239
(lib.optionalString cfg.autoSuggestions.enable ''
232240
source ${config.pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh
233-
${lib.optionalString (cfg.autoSuggestions.strategy != [ ]) ''
234-
ZSH_AUTOSUGGEST_STRATEGY=(${lib.concatStringsSep " " cfg.autoSuggestions.strategy})
235-
''}
241+
${lib.optionalString (cfg.autoSuggestions.strategy != []) ''
242+
ZSH_AUTOSUGGEST_STRATEGY=(${lib.concatStringsSep " " cfg.autoSuggestions.strategy})
243+
''}
236244
237245
${lib.optionalString (cfg.autoSuggestions.highlight != null) ''
238246
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=(${cfg.autoSuggestions.highlight})
@@ -244,6 +252,7 @@ in
244252
(lib.optionalString ing.atuin.enable ''eval "$(atuin init zsh)"'')
245253
(lib.optionalString ing.oh-my-posh.enable ''eval "$(oh-my-posh init zsh)"'')
246254
(lib.optionalString ing.zoxide.enable ''eval "$(zoxide init zsh ${zoxide-flags})"'')
255+
(lib.optionalString ing.pay-respects.enable ''eval "$(pay-respects zsh ${pay-respects-flags})"'')
247256
(lib.optionalString ing.starship.enable ''eval "$(starship init zsh)"'')
248257

249258
"# History"
@@ -276,15 +285,15 @@ in
276285

277286
config = {
278287
package = config.pkgs.zsh;
279-
extraPackages =
280-
let
281-
ing = cfg.integrations;
282-
in
288+
extraPackages = let
289+
ing = cfg.integrations;
290+
in
283291
lib.optional ing.fzf.enable ing.fzf.package
284292
++ lib.optional ing.atuin.enable ing.atuin.package
285293
++ lib.optional ing.zoxide.enable ing.zoxide.package
286294
++ lib.optional ing.oh-my-posh.enable ing.oh-my-posh.package
287295
++ lib.optional ing.starship.enable ing.starship.package
296+
++ lib.optional ing.pay-respects.enable ing.pay-respects.package
288297
++ lib.optional cfg.completion.enable config.pkgs.nix-zsh-completions
289298
++ lib.optional cfg.completion.extraCompletions config.pkgs.zsh-completions
290299
++ lib.optional cfg.completion.fuzzySearch config.pkgs.zsh-fzf-tab;

0 commit comments

Comments
 (0)