Difference between revisions of "Talk:Zsh"
From NixOS Wiki
(Noted that I was wrong before (actually, multiple times). Linked to proper documentation and tried to spell out what the confusion was.) |
|||
| Line 21: | Line 21: | ||
--[[User:Fadenb|Fadenb]] ([[User talk:Fadenb|talk]]) 21:53, 9 April 2025 (UTC) | --[[User:Fadenb|Fadenb]] ([[User talk:Fadenb|talk]]) 21:53, 9 April 2025 (UTC) | ||
| + | |||
| + | == The parameters for zsh in my nixos-25.11 version should be like this == | ||
| + | |||
| + | ```nix | ||
| + | { pkgs, ... }: { | ||
| + | environment.systemPackages = with pkgs; [ zsh-powerlevel10k ]; | ||
| + | programs.zsh = { | ||
| + | enable = true; | ||
| + | enableCompletion = true; | ||
| + | enableBashCompletion = true; | ||
| + | autosuggestions.enable = true; | ||
| + | syntaxHighlighting.enable = true; | ||
| + | histSize = 10000; | ||
| + | shellAliases = { | ||
| + | #... | ||
| + | }; | ||
| + | setOptions = [ | ||
| + | "AUTO_CD" | ||
| + | ] | ||
| + | prompInit = '' | ||
| + | source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme | ||
| + | ''; | ||
| + | ohMyZsh = { | ||
| + | enable = true; | ||
| + | plugins = [ "git" "dirhistory" "history" ]; | ||
| + | }; | ||
| + | }; | ||
| + | users.defaultUserShell = pkgs.zsh; | ||
| + | system.userActivationScripts.zshrc = "touch .zshrc"; | ||
| + | environment.shells = with pkgs; [ zsh ]; | ||
| + | } | ||
| + | ``` | ||
Revision as of 02:26, 23 December 2025
These optiosn could be updated with the current system wide options
The "autosuggestion.enable = true;" part of the example config seems not to work.
- Yes, I just undid a recent change that removed the plural 's' of autosuggestions. See https://github.com/NixOS/nixpkgs/blob/44534bc021b85c8d78e465021e21f33b856e2540/nixos/modules/programs/zsh/zsh-autosuggestions.nix#L19 for reference (current stable at time of writing) --Fadenb (talk) 16:13, 12 February 2025 (UTC)
- Once more, for clarifications. The version with a plural 's' is correct. Without it, it does not work:
┃ error: The option `programs.zsh.autosuggestion' does not exist. Definition values:
┃ - In `/etc/nixos/configuration.nix':
┃ {
┃ enable = true;
┃ }
--Fadenb (talk) 21:43, 9 April 2025 (UTC)
Correction: The example is for the home-manager variant, not the similarly named NixOS option. With this in mind, please ignore my statements above. I also added a warning on the page pointing here to avoid future confusion.
--Fadenb (talk) 21:53, 9 April 2025 (UTC)
The parameters for zsh in my nixos-25.11 version should be like this
```nix { pkgs, ... }: {
environment.systemPackages = with pkgs; [ zsh-powerlevel10k ];
programs.zsh = {
enable = true;
enableCompletion = true;
enableBashCompletion = true;
autosuggestions.enable = true;
syntaxHighlighting.enable = true;
histSize = 10000;
shellAliases = {
#...
};
setOptions = [
"AUTO_CD"
]
prompInit =
source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme
;
ohMyZsh = {
enable = true;
plugins = [ "git" "dirhistory" "history" ];
};
};
users.defaultUserShell = pkgs.zsh;
system.userActivationScripts.zshrc = "touch .zshrc";
environment.shells = with pkgs; [ zsh ];
} ```