summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2021-07-22 18:30:20 +0200
committerGitHub <noreply@github.com>2021-07-22 18:30:20 +0200
commite4f95387e264fc8550161041312261e1d956f8b9 (patch)
tree1dfa1a0ba5a12be9808b35f65c1df151be053eeb
parentMerge pull request #130456 from uvNikita/backport-steam-runtime-20210630 (diff)
parentzsh: include completions for nix-* commands (diff)
downloadnixpkgs-e4f95387e264fc8550161041312261e1d956f8b9.tar.gz
Merge pull request #131086 from NixOS/backport-128649-to-release-21.05
[Backport release-21.05] zsh: fix nixUnstable completions
-rw-r--r--nixos/modules/programs/zsh/zsh.nix26
1 files changed, 21 insertions, 5 deletions
diff --git a/nixos/modules/programs/zsh/zsh.nix b/nixos/modules/programs/zsh/zsh.nix
index 049a315c7622..e0335643b6e3 100644
--- a/nixos/modules/programs/zsh/zsh.nix
+++ b/nixos/modules/programs/zsh/zsh.nix
@@ -53,7 +53,7 @@ in
};
shellAliases = mkOption {
- default = {};
+ default = { };
description = ''
Set of aliases for zsh shell, which overrides <option>environment.shellAliases</option>.
See <option>environment.shellAliases</option> for an option format description.
@@ -118,7 +118,9 @@ in
setOptions = mkOption {
type = types.listOf types.str;
default = [
- "HIST_IGNORE_DUPS" "SHARE_HISTORY" "HIST_FCNTL_LOCK"
+ "HIST_IGNORE_DUPS"
+ "SHARE_HISTORY"
+ "HIST_FCNTL_LOCK"
];
example = [ "EXTENDED_HISTORY" "RM_STAR_WAIT" ];
description = ''
@@ -278,15 +280,29 @@ in
environment.etc.zinputrc.source = ./zinputrc;
- environment.systemPackages = [ pkgs.zsh ]
- ++ optional cfg.enableCompletion pkgs.nix-zsh-completions;
+ environment.systemPackages =
+ let
+ completions =
+ if lib.versionAtLeast (lib.getVersion config.nix.package) "2.4pre"
+ then
+ pkgs.nix-zsh-completions.overrideAttrs
+ (_: {
+ postInstall = ''
+ rm $out/share/zsh/site-functions/_nix
+ '';
+ })
+ else pkgs.nix-zsh-completions;
+ in
+ [ pkgs.zsh ]
+ ++ optional cfg.enableCompletion completions;
environment.pathsToLink = optional cfg.enableCompletion "/share/zsh";
#users.defaultUserShell = mkDefault "/run/current-system/sw/bin/zsh";
environment.shells =
- [ "/run/current-system/sw/bin/zsh"
+ [
+ "/run/current-system/sw/bin/zsh"
"${pkgs.zsh}/bin/zsh"
];