From f88e2fb5f170591e7e5c6f63470a5a187935a553 Mon Sep 17 00:00:00 2001 From: Yacine Hmito Date: Wed, 11 Jan 2017 07:00:48 +0100 Subject: [PATCH] zsh-autosuggestions: init at 0.3.3 (#21792) Added a related `programs.zsh.enableAutosuggestions` option --- nixos/modules/programs/zsh/zsh.nix | 11 +++++++ pkgs/shells/zsh-autosuggestions/default.nix | 32 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 3 files changed, 45 insertions(+) create mode 100644 pkgs/shells/zsh-autosuggestions/default.nix diff --git a/nixos/modules/programs/zsh/zsh.nix b/nixos/modules/programs/zsh/zsh.nix index 5b7d9415745460..b4d941a7770ca7 100644 --- a/nixos/modules/programs/zsh/zsh.nix +++ b/nixos/modules/programs/zsh/zsh.nix @@ -91,6 +91,13 @@ in ''; type = types.bool; }; + + enableAutosuggestions = mkOption { + default = false; + description = '' + Enable zsh-autosuggestions + ''; + }; }; @@ -132,6 +139,10 @@ in "source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" } + ${optionalString (cfg.enableAutosuggestions) + "source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh" + } + HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help" ''; diff --git a/pkgs/shells/zsh-autosuggestions/default.nix b/pkgs/shells/zsh-autosuggestions/default.nix new file mode 100644 index 00000000000000..4071d7bd0f21db --- /dev/null +++ b/pkgs/shells/zsh-autosuggestions/default.nix @@ -0,0 +1,32 @@ +{ stdenv, fetchFromGitHub, zsh }: + +# To make use of this derivation, use the `programs.zsh.enableAutoSuggestions` option + +stdenv.mkDerivation rec { + name = "zsh-autosuggestions-${version}"; + version = "0.3.3"; + + src = fetchFromGitHub { + repo = "zsh-autosuggestions"; + owner = "zsh-users"; + rev = "v${version}"; + sha256 = "0mnwyz4byvckrslzqfng5c0cx8ka0y12zcy52kb7amg3l07jrls4"; + }; + + buildInputs = [ zsh ]; + + buildPhases = [ "unpackPhase" "installPhase" ]; + + installPhase = '' + install -D zsh-autosuggestions.zsh \ + $out/share/zsh-autosuggestions/zsh-autosuggestions.zsh + ''; + + meta = with stdenv.lib; { + description = "Fish shell autosuggestions for Zsh"; + homepage = "https://github.com/zsh-users/zsh-autosuggestions"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = [ maintainers.loskutov ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c038430eaed658..7b7acc0e638de3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4553,6 +4553,8 @@ in zsh-syntax-highlighting = callPackage ../shells/zsh-syntax-highlighting { }; + zsh-autosuggestions = callPackage ../shells/zsh-autosuggestions { }; + zstd = callPackage ../tools/compression/zstd { }; zsync = callPackage ../tools/compression/zsync { };