about summary refs log tree commit diff
path: root/nixpkgs/pkgs/shells
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/shells')
-rw-r--r--nixpkgs/pkgs/shells/any-nix-shell/default.nix27
-rw-r--r--nixpkgs/pkgs/shells/bash/4.4.nix141
-rw-r--r--nixpkgs/pkgs/shells/bash/5.1.nix132
-rw-r--r--nixpkgs/pkgs/shells/bash/bash-4.4-patches.nix27
-rw-r--r--nixpkgs/pkgs/shells/bash/bash-5.1-patches.nix8
-rw-r--r--nixpkgs/pkgs/shells/bash/bash-completion/default.nix73
-rw-r--r--nixpkgs/pkgs/shells/bash/cygwin-bash-4.4.11-2.src.patch607
-rw-r--r--nixpkgs/pkgs/shells/bash/nix-bash-completions/default.nix36
-rw-r--r--nixpkgs/pkgs/shells/bash/pgrp-pipe-4.4.patch15
-rw-r--r--nixpkgs/pkgs/shells/bash/pgrp-pipe-5.1.patch16
-rw-r--r--nixpkgs/pkgs/shells/bash/undistract-me/default.nix79
-rwxr-xr-xnixpkgs/pkgs/shells/bash/update-patch-set.sh52
-rw-r--r--nixpkgs/pkgs/shells/dash/0001-fix-dirent64-et-al-on-darwin.patch41
-rw-r--r--nixpkgs/pkgs/shells/dash/default.nix44
-rw-r--r--nixpkgs/pkgs/shells/dgsh/default.nix45
-rw-r--r--nixpkgs/pkgs/shells/dgsh/glibc-2.26.patch12
-rw-r--r--nixpkgs/pkgs/shells/elvish/default.nix38
-rw-r--r--nixpkgs/pkgs/shells/es/default.nix42
-rw-r--r--nixpkgs/pkgs/shells/fish/babelfish.nix21
-rw-r--r--nixpkgs/pkgs/shells/fish/default.nix321
-rw-r--r--nixpkgs/pkgs/shells/fish/plugins/build-fish-plugin.nix73
-rw-r--r--nixpkgs/pkgs/shells/fish/plugins/clownfish.nix20
-rw-r--r--nixpkgs/pkgs/shells/fish/plugins/default.nix24
-rw-r--r--nixpkgs/pkgs/shells/fish/plugins/done.nix25
-rw-r--r--nixpkgs/pkgs/shells/fish/plugins/fishtape.nix32
-rw-r--r--nixpkgs/pkgs/shells/fish/plugins/fishtape_3.nix25
-rw-r--r--nixpkgs/pkgs/shells/fish/plugins/foreign-env/default.nix29
-rw-r--r--nixpkgs/pkgs/shells/fish/plugins/foreign-env/suppress-harmless-warnings.patch23
-rw-r--r--nixpkgs/pkgs/shells/fish/plugins/forgit.nix26
-rw-r--r--nixpkgs/pkgs/shells/fish/plugins/fzf-fish.nix34
-rw-r--r--nixpkgs/pkgs/shells/fish/plugins/pure.nix37
-rw-r--r--nixpkgs/pkgs/shells/fish/wrapper.nix25
-rw-r--r--nixpkgs/pkgs/shells/hilbish/default.nix26
-rw-r--r--nixpkgs/pkgs/shells/ion/default.nix33
-rw-r--r--nixpkgs/pkgs/shells/jush/default.nix27
-rw-r--r--nixpkgs/pkgs/shells/ksh/default.nix45
-rw-r--r--nixpkgs/pkgs/shells/liquidprompt/default.nix32
-rw-r--r--nixpkgs/pkgs/shells/mksh/default.nix59
-rw-r--r--nixpkgs/pkgs/shells/mrsh/default.nix30
-rw-r--r--nixpkgs/pkgs/shells/nushell/default.nix64
-rw-r--r--nixpkgs/pkgs/shells/oh/default.nix25
-rw-r--r--nixpkgs/pkgs/shells/oil/default.nix42
-rw-r--r--nixpkgs/pkgs/shells/oksh/default.nix25
-rw-r--r--nixpkgs/pkgs/shells/pash/default.nix29
-rw-r--r--nixpkgs/pkgs/shells/powershell/default.nix81
-rw-r--r--nixpkgs/pkgs/shells/rc/default.nix42
-rw-r--r--nixpkgs/pkgs/shells/rush/default.nix41
-rw-r--r--nixpkgs/pkgs/shells/scponly/default.nix39
-rw-r--r--nixpkgs/pkgs/shells/scponly/scponly-fix-make.patch21
-rw-r--r--nixpkgs/pkgs/shells/tcsh/default.nix53
-rw-r--r--nixpkgs/pkgs/shells/xonsh/default.nix58
-rw-r--r--nixpkgs/pkgs/shells/zsh/antibody/default.nix26
-rw-r--r--nixpkgs/pkgs/shells/zsh/antigen/default.nix25
-rw-r--r--nixpkgs/pkgs/shells/zsh/default.nix93
-rw-r--r--nixpkgs/pkgs/shells/zsh/fzf-zsh/default.nix37
-rw-r--r--nixpkgs/pkgs/shells/zsh/gradle-completion/default.nix35
-rw-r--r--nixpkgs/pkgs/shells/zsh/grml-zsh-config/default.nix37
-rw-r--r--nixpkgs/pkgs/shells/zsh/lambda-mod-zsh-theme/default.nix25
-rw-r--r--nixpkgs/pkgs/shells/zsh/nix-zsh-completions/default.nix27
-rw-r--r--nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix124
-rw-r--r--nixpkgs/pkgs/shells/zsh/pure-prompt/default.nix30
-rw-r--r--nixpkgs/pkgs/shells/zsh/spaceship-prompt/default.nix38
-rw-r--r--nixpkgs/pkgs/shells/zsh/zinit/default.nix42
-rw-r--r--nixpkgs/pkgs/shells/zsh/zplug/default.nix30
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-autopair/default.nix25
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-autosuggestions/default.nix30
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-bd/default.nix31
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-clipboard/clipboard.plugin.zsh40
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-clipboard/default.nix27
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-command-time/default.nix34
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-completions/default.nix26
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-deer/default.nix35
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-deer/realpath.patch28
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-fast-syntax-highlighting/default.nix30
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-fzf-tab/default.nix45
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-git-prompt/default.nix70
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-history-substring-search/default.nix26
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-history/default.nix37
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-nix-shell/default.nix29
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-powerlevel10k/default.nix53
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-powerlevel10k/gitstatusd.patch13
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-powerlevel9k/default.nix29
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-prezto/default.nix39
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-syntax-highlighting/default.nix27
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-system-clipboard/default.nix25
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-you-should-use/default.nix26
-rw-r--r--nixpkgs/pkgs/shells/zsh/zsh-z/default.nix28
87 files changed, 4244 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/shells/any-nix-shell/default.nix b/nixpkgs/pkgs/shells/any-nix-shell/default.nix
new file mode 100644
index 000000000000..3bd41a53844c
--- /dev/null
+++ b/nixpkgs/pkgs/shells/any-nix-shell/default.nix
@@ -0,0 +1,27 @@
+{ lib, stdenv, fetchFromGitHub, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  pname = "any-nix-shell";
+  version = "1.2.1";
+
+  src = fetchFromGitHub {
+    owner = "haslersn";
+    repo = "any-nix-shell";
+    rev = "v${version}";
+    sha256 = "0q27rhjhh7k0qgcdcfm8ly5za6wm4rckh633d0sjz87faffkp90k";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+  installPhase = ''
+    mkdir -p $out/bin
+    cp -r bin $out
+    wrapProgram $out/bin/any-nix-shell --prefix PATH ":" $out/bin
+  '';
+
+  meta = with lib; {
+    description = "fish and zsh support for nix-shell";
+    license = licenses.mit;
+    homepage = "https://github.com/haslersn/any-nix-shell";
+    maintainers = with maintainers; [ haslersn ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/bash/4.4.nix b/nixpkgs/pkgs/shells/bash/4.4.nix
new file mode 100644
index 000000000000..b3259466ddb1
--- /dev/null
+++ b/nixpkgs/pkgs/shells/bash/4.4.nix
@@ -0,0 +1,141 @@
+{ lib, stdenv, buildPackages
+, fetchurl, binutils ? null, bison, autoconf, util-linux
+
+# patch for cygwin requires readline support
+, interactive ? stdenv.isCygwin, readline70 ? null
+, withDocs ? false, texinfo ? null
+}:
+
+with lib;
+
+assert interactive -> readline70 != null;
+assert withDocs -> texinfo != null;
+assert stdenv.hostPlatform.isDarwin -> binutils != null;
+
+# Note: this package is used for bootstrapping fetchurl, and thus
+# cannot use fetchpatch! All mutable patches (generated by GitHub or
+# cgit) that are needed here should be included directly in Nixpkgs as
+# files.
+
+let
+  upstreamPatches = import ./bash-4.4-patches.nix (nr: sha256: fetchurl {
+    url = "mirror://gnu/bash/bash-4.4-patches/bash44-${nr}";
+    inherit sha256;
+  });
+in
+
+stdenv.mkDerivation rec {
+  name = "bash-${optionalString interactive "interactive-"}${version}-p${toString (builtins.length upstreamPatches)}";
+  version = "4.4";
+
+  src = fetchurl {
+    url = "mirror://gnu/bash/bash-${version}.tar.gz";
+    sha256 = "1jyz6snd63xjn6skk7za6psgidsd53k05cr3lksqybi0q6936syq";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  outputs = [ "out" "dev" "man" "doc" "info" ];
+
+  NIX_CFLAGS_COMPILE = ''
+    -DSYS_BASHRC="/etc/bashrc"
+    -DSYS_BASH_LOGOUT="/etc/bash_logout"
+    -DDEFAULT_PATH_VALUE="/no-such-path"
+    -DSTANDARD_UTILS_PATH="/no-such-path"
+    -DNON_INTERACTIVE_LOGIN_SHELLS
+    -DSSH_SOURCE_BASHRC
+  '';
+
+  patchFlags = [ "-p0" ];
+
+  patches = upstreamPatches
+    ++ [ ./pgrp-pipe-4.4.patch ]
+    ++ optional stdenv.hostPlatform.isCygwin ./cygwin-bash-4.4.11-2.src.patch
+    # https://lists.gnu.org/archive/html/bug-bash/2016-10/msg00006.html
+    ++ optional stdenv.hostPlatform.isMusl (fetchurl {
+      url = "https://lists.gnu.org/archive/html/bug-bash/2016-10/patchJxugOXrY2y.patch";
+      sha256 = "1m4v9imidb1cc1h91f2na0b8y9kc5c5fgmpvy9apcyv2kbdcghg1";
+    });
+
+  configureFlags = [
+    (if interactive then "--with-installed-readline" else "--disable-readline")
+  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+    "bash_cv_job_control_missing=nomissing"
+    "bash_cv_sys_named_pipes=nomissing"
+    "bash_cv_getcwd_malloc=yes"
+  ] ++ optionals stdenv.hostPlatform.isCygwin [
+    "--without-libintl-prefix"
+    "--without-libiconv-prefix"
+    "--with-installed-readline"
+    "bash_cv_dev_stdin=present"
+    "bash_cv_dev_fd=standard"
+    "bash_cv_termcap_lib=libncurses"
+  ] ++ optionals (stdenv.hostPlatform.libc == "musl") [
+    "--without-bash-malloc"
+    "--disable-nls"
+  ];
+
+  # Note: Bison is needed because the patches above modify parse.y.
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ bison ]
+    ++ optional withDocs texinfo
+    ++ optional stdenv.hostPlatform.isDarwin binutils
+    ++ optional (stdenv.hostPlatform.libc == "musl") autoconf;
+
+  buildInputs = optional interactive readline70;
+
+  # Bash randomly fails to build because of a recursive invocation to
+  # build `version.h'.
+  enableParallelBuilding = false;
+
+  makeFlags = optional stdenv.hostPlatform.isCygwin [
+    "LOCAL_LDFLAGS=-Wl,--export-all,--out-implib,libbash.dll.a"
+    "SHOBJ_LIBS=-lbash"
+  ];
+
+  checkInputs = [ util-linux ];
+  doCheck = false; # dependency cycle, needs to be interactive
+
+  postInstall = ''
+    ln -s bash "$out/bin/sh"
+    rm -f $out/lib/bash/Makefile.inc
+  '';
+
+  postFixup = if interactive
+    then ''
+      substituteInPlace "$out/bin/bashbug" \
+        --replace '${stdenv.shell}' "$out/bin/bash"
+    ''
+    # most space is taken by locale data
+    else ''
+      rm -rf "$out/share" "$out/bin/bashbug"
+    '';
+
+  meta = with lib; {
+    homepage = "https://www.gnu.org/software/bash/";
+    description =
+      "GNU Bourne-Again Shell, the de facto standard shell on Linux" +
+        (if interactive then " (for interactive use)" else "");
+
+    longDescription = ''
+      Bash is the shell, or command language interpreter, that will
+      appear in the GNU operating system.  Bash is an sh-compatible
+      shell that incorporates useful features from the Korn shell
+      (ksh) and C shell (csh).  It is intended to conform to the IEEE
+      POSIX P1003.2/ISO 9945.2 Shell and Tools standard.  It offers
+      functional improvements over sh for both programming and
+      interactive use.  In addition, most sh scripts can be run by
+      Bash without modification.
+    '';
+
+    license = licenses.gpl3Plus;
+
+    platforms = platforms.all;
+
+    maintainers = [ maintainers.peti ];
+  };
+
+  passthru = {
+    shellPath = "/bin/bash";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/bash/5.1.nix b/nixpkgs/pkgs/shells/bash/5.1.nix
new file mode 100644
index 000000000000..ddf2edfd1db6
--- /dev/null
+++ b/nixpkgs/pkgs/shells/bash/5.1.nix
@@ -0,0 +1,132 @@
+{ lib, stdenv
+, buildPackages
+, fetchurl
+, binutils ? null
+, bison
+, util-linux
+
+  # patch for cygwin requires readline support
+, interactive ? stdenv.isCygwin
+, readline81 ? null
+, withDocs ? false
+, texinfo ? null
+}:
+
+with lib;
+
+assert interactive -> readline81 != null;
+assert withDocs -> texinfo != null;
+assert stdenv.hostPlatform.isDarwin -> binutils != null;
+let
+  upstreamPatches = import ./bash-5.1-patches.nix (nr: sha256: fetchurl {
+    url = "mirror://gnu/bash/bash-5.1-patches/bash51-${nr}";
+    inherit sha256;
+  });
+in
+stdenv.mkDerivation rec {
+  name = "bash-${optionalString interactive "interactive-"}${version}-p${toString (builtins.length upstreamPatches)}";
+  version = "5.1";
+
+  src = fetchurl {
+    url = "mirror://gnu/bash/bash-${version}.tar.gz";
+    sha256 = "1alv68wplnfdm6mh39hm57060xgssb9vqca4yr1cyva0c342n0fc";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  outputs = [ "out" "dev" "man" "doc" "info" ];
+
+  NIX_CFLAGS_COMPILE = ''
+    -DSYS_BASHRC="/etc/bashrc"
+    -DSYS_BASH_LOGOUT="/etc/bash_logout"
+    -DDEFAULT_PATH_VALUE="/no-such-path"
+    -DSTANDARD_UTILS_PATH="/no-such-path"
+    -DNON_INTERACTIVE_LOGIN_SHELLS
+    -DSSH_SOURCE_BASHRC
+  '';
+
+  patchFlags = [ "-p0" ];
+
+  patches = upstreamPatches
+    ++ [ ./pgrp-pipe-5.1.patch ];
+
+  configureFlags = [
+    (if interactive then "--with-installed-readline" else "--disable-readline")
+  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+    "bash_cv_job_control_missing=nomissing"
+    "bash_cv_sys_named_pipes=nomissing"
+    "bash_cv_getcwd_malloc=yes"
+  ] ++ optionals stdenv.hostPlatform.isCygwin [
+    "--without-libintl-prefix"
+    "--without-libiconv-prefix"
+    "--with-installed-readline"
+    "bash_cv_dev_stdin=present"
+    "bash_cv_dev_fd=standard"
+    "bash_cv_termcap_lib=libncurses"
+  ] ++ optionals (stdenv.hostPlatform.libc == "musl") [
+    "--without-bash-malloc"
+    "--disable-nls"
+  ];
+
+  # Note: Bison is needed because the patches above modify parse.y.
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ bison ]
+    ++ optional withDocs texinfo
+    ++ optional stdenv.hostPlatform.isDarwin binutils;
+
+  buildInputs = optional interactive readline81;
+
+  enableParallelBuilding = true;
+
+  makeFlags = optional stdenv.hostPlatform.isCygwin [
+    "LOCAL_LDFLAGS=-Wl,--export-all,--out-implib,libbash.dll.a"
+    "SHOBJ_LIBS=-lbash"
+  ];
+
+  checkInputs = [ util-linux ];
+  doCheck = false; # dependency cycle, needs to be interactive
+
+  postInstall = ''
+    ln -s bash "$out/bin/sh"
+    rm -f $out/lib/bash/Makefile.inc
+  '';
+
+  postFixup =
+    if interactive
+    then ''
+      substituteInPlace "$out/bin/bashbug" \
+        --replace '${stdenv.shell}' "$out/bin/bash"
+    ''
+    # most space is taken by locale data
+    else ''
+      rm -rf "$out/share" "$out/bin/bashbug"
+    '';
+
+  meta = with lib; {
+    homepage = "https://www.gnu.org/software/bash/";
+    description =
+      "GNU Bourne-Again Shell, the de facto standard shell on Linux" +
+      (if interactive then " (for interactive use)" else "");
+
+    longDescription = ''
+      Bash is the shell, or command language interpreter, that will
+      appear in the GNU operating system.  Bash is an sh-compatible
+      shell that incorporates useful features from the Korn shell
+      (ksh) and C shell (csh).  It is intended to conform to the IEEE
+      POSIX P1003.2/ISO 9945.2 Shell and Tools standard.  It offers
+      functional improvements over sh for both programming and
+      interactive use.  In addition, most sh scripts can be run by
+      Bash without modification.
+    '';
+
+    license = licenses.gpl3Plus;
+
+    platforms = platforms.all;
+
+    maintainers = with maintainers; [ peti dtzWill ];
+  };
+
+  passthru = {
+    shellPath = "/bin/bash";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/bash/bash-4.4-patches.nix b/nixpkgs/pkgs/shells/bash/bash-4.4-patches.nix
new file mode 100644
index 000000000000..a79ec90213a0
--- /dev/null
+++ b/nixpkgs/pkgs/shells/bash/bash-4.4-patches.nix
@@ -0,0 +1,27 @@
+# Automatically generated by `update-patch-set.sh'; do not edit.
+
+patch: [
+(patch "001" "03vzy7qwjdd5qvl3ydg99naazas2qmyd0yhnrflgjbbm64axja1y")
+(patch "002" "0lrwq6vyqism3yqv9s7kzaf3dsl4q5w9r5svcqz279qp7qca083h")
+(patch "003" "1chqww2rj6g42b8s60q5zlzy0jzp684jkpsbrbfy1vzxja8mmpsi")
+(patch "004" "1cy8abf96hkrjhw921ndr0shlcnc52bg45rn6xri4v5clhq0l25d")
+(patch "005" "0a8515kyk4zsgmvlqvlganjfr7pq0j6kzpr4d6xx02kpbdr4n7i2")
+(patch "006" "1f24wgqngmj2mrj9yibwvc2zvlmn5xi53mnw777g3l40c4m2x3ka")
+(patch "007" "1bzdsnqaf05gdbqpsixhan8vygjxpcxlz1dd8d9f5jdznw3wq76y")
+(patch "008" "1firw915mjm03hbbw9a70ch3cpgrgnvqjpllgdnn6csr8q04f546")
+(patch "009" "0g1l56kvw61rpw7dqa9fcl9llkl693h73g631hrhxlm030ddssqb")
+(patch "010" "01lfhrkdsdkdz8ypzapr614ras23x7ckjnr60aa5bzkaqprccrc4")
+(patch "011" "038p7mhnq9m65g505hi3827jkf9f35nd1cy00w8mwafpyxp44mnx")
+(patch "012" "0gh6lbb1rwpk44pvbamm6vzdfi50xnwkqd9v7s8cjwk3pz973hps")
+(patch "013" "1djkx0w9v62q78gz3jsvamj1jq53i6hbfrfhhsw86ihwpjnfy98v")
+(patch "014" "0z5ikcq9zyxw79d0z36r5p0mspnb5piavbv03jmlan1wnknmrxx7")
+(patch "015" "09n307fi1j257abhm295k6ksmnzw47ka2zhnr0i5lbdnpvn04xnk")
+(patch "016" "1cgi1y6mifm8hsgv4avj5ih76535js3qba1sqwbfvp7si76927sh")
+(patch "017" "0w6jpj2giakji1ir83rpkx1y7n7xqppah3j748m6dm38hywr0gvp")
+(patch "018" "1k58h4wxbsg7r4rwhrvzx5hfbapba2nxjysbhh6qp6ki5ys99i2v")
+(patch "019" "07n1i5610lbs672x1s8g82qn3qfj06s0ip3z80sri0g8vxp0s5r7")
+(patch "020" "0b2jk5n1af1vh590qfc52hv65mafb4vl1xv26s8j5a3byb5y4h0q")
+(patch "021" "1hblcd2xmqqlp0idnavw66570n7m0yv5rbbr873c2gkn982mk3xx")
+(patch "022" "0yfbjzr79vzjs2hyi5m8iy2b38fq7vikdfa4zqdvjsp36q4iycs5")
+(patch "023" "1dlism6qdx60nvzj0v7ndr7lfahl4a8zmzckp13hqgdx7xpj7v2g")
+]
diff --git a/nixpkgs/pkgs/shells/bash/bash-5.1-patches.nix b/nixpkgs/pkgs/shells/bash/bash-5.1-patches.nix
new file mode 100644
index 000000000000..b834deda0f80
--- /dev/null
+++ b/nixpkgs/pkgs/shells/bash/bash-5.1-patches.nix
@@ -0,0 +1,8 @@
+# Automatically generated by `update-patch-set.sh'; do not edit.
+
+patch: [
+(patch "001" "1ymm8ppss6gyh9ifznjwiabrb4k91npd09c10y7mk66xp8yppc7b")
+(patch "002" "1gjx9zqcm407am3n2sh44b8dxm48kgm15rzfiijqxr01m0hn3shm")
+(patch "003" "1cdnpbfc64yhvkjj4d12s9ywp11g195vzfl1cab24sq55wkcrwi2")
+(patch "004" "11iwhy6v562bv0kk7lwj7f5jj65ma9bblivy0v02h3ggcibbdbls")
+]
diff --git a/nixpkgs/pkgs/shells/bash/bash-completion/default.nix b/nixpkgs/pkgs/shells/bash/bash-completion/default.nix
new file mode 100644
index 000000000000..0ebcaa9e8645
--- /dev/null
+++ b/nixpkgs/pkgs/shells/bash/bash-completion/default.nix
@@ -0,0 +1,73 @@
+{ lib, stdenv, fetchurl
+, fetchpatch
+, autoreconfHook
+, perl
+, ps
+, python3Packages
+, bashInteractive
+}:
+
+stdenv.mkDerivation rec {
+  pname = "bash-completion";
+  version = "2.11";
+
+  # Using fetchurl because fetchGithub or fetchzip will have trouble on
+  # e.g. APFS filesystems (macOS) because of non UTF-8 characters in some of the
+  # test fixtures that are part of the repository.
+  # See discussion in https://github.com/NixOS/nixpkgs/issues/107768
+  src = fetchurl {
+    url = "https://github.com/scop/${pname}/releases/download/${version}/${pname}-${version}.tar.xz";
+    sha256 = "1b0iz7da1sgifx1a5wdyx1kxbzys53v0kyk8nhxfipllmm5qka3k";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  # tests are super flaky unfortunately, and regularily break.
+  # let's disable them for now.
+  doCheck = false;
+  checkInputs = [
+    # perl is assumed by perldoc completion
+    perl
+    # ps assumed to exist by gdb, killall, pgrep, pidof,
+    # pkill, pwdx, renice, and reptyr completions
+    ps
+    python3Packages.pexpect
+    python3Packages.pytest
+    bashInteractive
+  ];
+
+  # - ignore test_gcc on ARM because it assumes -march=native
+  # - ignore test_chsh because it assumes /etc/shells exists
+  # - ignore test_ether_wake, test_ifdown, test_ifstat, test_ifup,
+  #   test_iperf, test_iperf3, test_nethogs and ip_addresses
+  #   because they try to touch network
+  # - ignore test_ls because impure logic
+  # - ignore test_screen because it assumes vt terminals exist
+  checkPhase = ''
+    pytest . \
+      ${lib.optionalString (stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isAarch32) "--ignore=test/t/test_gcc.py"} \
+      --ignore=test/t/test_chsh.py \
+      --ignore=test/t/test_ether_wake.py \
+      --ignore=test/t/test_ifdown.py \
+      --ignore=test/t/test_ifstat.py \
+      --ignore=test/t/test_ifup.py \
+      --ignore=test/t/test_iperf.py \
+      --ignore=test/t/test_iperf3.py \
+      --ignore=test/t/test_nethogs.py \
+      --ignore=test/t/unit/test_unit_ip_addresses.py \
+      --ignore=test/t/test_ls.py \
+      --ignore=test/t/test_screen.py
+  '';
+
+  prePatch = lib.optionalString stdenv.isDarwin ''
+    sed -i -e 's/readlink -f/readlink/g' bash_completion completions/*
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/scop/bash-completion";
+    description = "Programmable completion for the bash shell";
+    license = licenses.gpl2Plus;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.peti maintainers.xfix ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/bash/cygwin-bash-4.4.11-2.src.patch b/nixpkgs/pkgs/shells/bash/cygwin-bash-4.4.11-2.src.patch
new file mode 100644
index 000000000000..488373109625
--- /dev/null
+++ b/nixpkgs/pkgs/shells/bash/cygwin-bash-4.4.11-2.src.patch
@@ -0,0 +1,607 @@
+--- bashline.c	2017-01-23 13:28:06.955247200 -0600
++++ bashline.c	2017-01-23 13:55:07.992877600 -0600
+@@ -76,6 +76,16 @@
+ #  include "pcomplete.h"
+ #endif
+ 
++#if __CYGWIN__
++#  ifdef __x86_64__
++#    define IMP(x) __imp_##x
++#  else
++#    define IMP(x) _imp__##x
++#  endif
++#else
++#  define IMP(x) x
++#endif
++
+ /* These should agree with the defines for emacs_mode and vi_mode in
+    rldefs.h, even though that's not a public readline header file. */
+ #ifndef EMACS_EDITING_MODE
+@@ -271,6 +281,11 @@ int no_empty_command_completion;
+    are the only possible matches, even if FIGNORE says to. */
+ int force_fignore = 1;
+ 
++#if __CYGWIN__
++/* If set, shorten "foo.exe" to "foo" when they are the same file.  */
++int completion_strip_exe;
++#endif /* __CYGWIN__ */
++
+ /* Perform spelling correction on directory names during word completion */
+ int dircomplete_spelling = 0;
+ 
+@@ -498,11 +513,12 @@ initialize_readline ()
+   kseq[0] = CTRL('J');
+   kseq[1] = '\0';
+   func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
+-  if (func == rl_vi_editing_mode)
++  extern rl_command_func_t *IMP(rl_vi_editing_mode);
++  if (func == rl_vi_editing_mode || func == IMP(rl_vi_editing_mode))
+     rl_unbind_key_in_map (CTRL('J'), emacs_meta_keymap);
+   kseq[0] = CTRL('M');
+   func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
+-  if (func == rl_vi_editing_mode)
++  if (func == rl_vi_editing_mode || func == IMP(rl_vi_editing_mode))
+     rl_unbind_key_in_map (CTRL('M'), emacs_meta_keymap);
+ #if defined (VI_MODE)
+   rl_unbind_key_in_map (CTRL('E'), vi_movement_keymap);
+@@ -521,7 +537,8 @@ initialize_readline ()
+   kseq[0] = '~';
+   kseq[1] = '\0';
+   func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
+-  if (func == 0 || func == rl_tilde_expand)
++  extern rl_command_func_t *IMP(rl_tilde_expand);
++  if (func == 0 || func == rl_tilde_expand || func == IMP(rl_tilde_expand))
+     rl_bind_keyseq_in_map (kseq, bash_complete_username, emacs_meta_keymap);
+ 
+   rl_bind_key_if_unbound_in_map ('~', bash_possible_username_completions, emacs_ctlx_keymap);
+@@ -544,7 +561,8 @@ initialize_readline ()
+   kseq[0] = TAB;
+   kseq[1] = '\0';
+   func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
+-  if (func == 0 || func == rl_tab_insert)
++  extern rl_command_func_t *IMP(rl_tab_insert);
++  if (func == 0 || func == rl_tab_insert || func == IMP(rl_tab_insert))
+     rl_bind_key_in_map (TAB, dynamic_complete_history, emacs_meta_keymap);
+ 
+   /* Tell the completer that we want a crack first. */
+@@ -2194,6 +2212,21 @@ globword:
+ 
+       if (match && executable_completion ((searching_path ? val : cval), searching_path))
+ 	{
++#if __CYGWIN__
++	  if (completion_strip_exe)
++	    {
++	      size_t val_len = strlen (val);
++	      char *candidate;
++	      if (val_len > 4 && !strcasecmp (&val[val_len - 4], ".exe")
++		  && (candidate = strdup (val)))
++		{
++		  candidate[val_len - 4] = '\0';
++		  if (same_file (val, candidate, NULL, NULL))
++		    temp[strlen (temp) - 4] = '\0';
++		  free (candidate);
++		}
++	    }
++#endif
+ 	  if (cval != val)
+ 	    free (cval);
+ 	  free (val);
+@@ -2929,6 +2962,17 @@ test_for_directory (name)
+   int r;
+ 
+   fn = bash_tilde_expand (name, 0);
++#if __CYGWIN
++  /* stat("//server") can only be successful as a directory, but can take
++     seconds to time out on failure.  It is much faster to assume that
++     "//server" is a valid name than it is to wait for a stat, even if it
++     gives false positives on bad names.  */
++  if (fn[0] == '/' && fn[1] == '/' && ! strchr (&fn[2], '/'))
++    {
++      free (fn);
++      return 1;
++    }
++#endif
+   r = file_isdir (fn);
+   free (fn);
+ 
+--- builtins/read.def	2017-01-23 13:28:07.017686500 -0600
++++ builtins/read.def	2017-01-23 13:55:07.992877600 -0600
+@@ -85,7 +85,6 @@ $END
+ 
+ #ifdef __CYGWIN__
+ #  include <fcntl.h>
+-#  include <io.h>
+ #endif
+ 
+ #include "../bashintl.h"
+@@ -530,10 +529,6 @@ read_builtin (list)
+       fflush (stderr);
+     }
+ 
+-#if defined (__CYGWIN__) && defined (O_TEXT)
+-  setmode (0, O_TEXT);
+-#endif
+-
+   ps2 = 0;
+   for (print_ps2 = eof = retval = 0;;)
+     {
+@@ -664,6 +659,14 @@ read_builtin (list)
+       if (c == '\0' && delim != '\0')
+ 	continue;		/* skip NUL bytes in input */
+ 
++#ifdef __CYGWIN__
++      {
++        extern igncr;
++	if (igncr && c == '\r' && delim != '\r')
++	  continue; /* skip carriage return */
++      }
++#endif
++
+       if ((skip_ctlesc == 0 && c == CTLESC) || (skip_ctlnul == 0 && c == CTLNUL))
+ 	{
+ 	  saw_escape++;
+--- builtins/set.def	2016-06-02 19:10:10.000000000 -0500
++++ builtins/set.def	2017-01-23 13:55:07.992877600 -0600
+@@ -56,6 +56,13 @@ extern int dont_save_function_defs;
+ #if defined (READLINE)
+ extern int no_line_editing;
+ #endif /* READLINE */
++#ifdef __CYGWIN__
++extern int igncr;
++static int set_minus_o_option_maybe (int, const char *, int);
++#  define INTERACTIVE_ONLY ,1
++#else
++#  define INTERACTIVE_ONLY
++#endif
+ 
+ $BUILTIN set
+ $FUNCTION set_builtin
+@@ -92,6 +99,9 @@ Options:
+ #if defined (HISTORY)
+           history      enable command history
+ #endif
++#ifdef __CYGWIN__
++          igncr        on Cygwin, ignore \r in line endings
++#endif
+           ignoreeof    the shell will not exit upon reading EOF
+           interactive-comments
+                        allow comments to appear in interactive commands
+@@ -192,29 +202,39 @@ const struct {
+   int *variable;
+   setopt_set_func_t *set_func;
+   setopt_get_func_t *get_func;
++#ifdef __CYGWIN__
++  /* Cygwin users have taken to exporting SHELLOPTS for the cygwin-specific
++     igncr. As a result, we want to ensure SHELLOPTS parsing does not turn
++     on interactive options when exported from an interactive shell, but
++     parse in a non-interactive setting, so as not to break POSIX /bin/sh */
++  int interactive_only;
++#endif
+ } o_options[] = {
+   { "allexport",  'a', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
+ #if defined (BRACE_EXPANSION)
+   { "braceexpand",'B', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+ #endif
+ #if defined (READLINE)
+-  { "emacs",     '\0', (int *)NULL, set_edit_mode, get_edit_mode },
++  { "emacs",     '\0', (int *)NULL, set_edit_mode, get_edit_mode INTERACTIVE_ONLY },
+ #endif
+   { "errexit",	  'e', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+   { "errtrace",	  'E', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+   { "functrace",  'T', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+   { "hashall",    'h', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+ #if defined (BANG_HISTORY)
+-  { "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
++  { "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL INTERACTIVE_ONLY },
+ #endif /* BANG_HISTORY */
+ #if defined (HISTORY)
+-  { "history",   '\0', &enable_history_list, bash_set_history, (setopt_get_func_t *)NULL },
++  { "history",   '\0', &enable_history_list, bash_set_history, (setopt_get_func_t *)NULL INTERACTIVE_ONLY },
++#endif
++#ifdef __CYGWIN__
++  { "igncr", '\0', &igncr, NULL, (setopt_get_func_t *)NULL },
+ #endif
+   { "ignoreeof", '\0', &ignoreeof, set_ignoreeof, (setopt_get_func_t *)NULL },
+   { "interactive-comments", '\0', &interactive_comments, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
+   { "keyword",    'k', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+ #if defined (JOB_CONTROL)
+-  { "monitor",	  'm', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
++  { "monitor",	  'm', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL INTERACTIVE_ONLY },
+ #endif
+   { "noclobber",  'C', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+   { "noexec",	  'n', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+@@ -233,7 +253,7 @@ const struct {
+   { "privileged", 'p', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+   { "verbose",	  'v', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+ #if defined (READLINE)
+-  { "vi",        '\0', (int *)NULL, set_edit_mode, get_edit_mode },
++  { "vi",        '\0', (int *)NULL, set_edit_mode, get_edit_mode INTERACTIVE_ONLY },
+ #endif
+   { "xtrace",	  'x', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+   {(char *)NULL, 0 , (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
+@@ -455,6 +475,15 @@ int
+ set_minus_o_option (on_or_off, option_name)
+      int on_or_off;
+      char *option_name;
++#ifdef __CYGWIN__
++{
++  /* See Cygwin comments above. */
++  return set_minus_o_option_maybe (on_or_off, option_name, 0);
++}
++static int
++set_minus_o_option_maybe (int on_or_off, const char *option_name,
++                          int avoid_interactive)
++#endif /* __CYGWIN__ */
+ {
+   register int i;
+ 
+@@ -462,6 +491,10 @@ set_minus_o_option (on_or_off, option_na
+     {
+       if (STREQ (option_name, o_options[i].name))
+ 	{
++#ifdef __CYGWIN__
++	  if (o_options[i].interactive_only && avoid_interactive)
++	    return EXECUTION_SUCCESS;
++#endif
+ 	  if (o_options[i].letter == 0)
+ 	    {
+ 	      previous_option_value = GET_BINARY_O_OPTION_VALUE (i, o_options[i].name);
+@@ -588,7 +621,11 @@ parse_shellopts (value)
+   vptr = 0;
+   while (vname = extract_colon_unit (value, &vptr))
+     {
++#ifdef __CYGWIN__
++      set_minus_o_option_maybe (FLAG_ON, vname, !interactive_shell);
++#else
+       set_minus_o_option (FLAG_ON, vname);
++#endif
+       free (vname);
+     }
+ }
+--- builtins/shopt.def	2016-05-06 14:00:02.000000000 -0500
++++ builtins/shopt.def	2017-01-23 13:55:07.992877600 -0600
+@@ -92,6 +92,10 @@ extern int glob_asciirange;
+ extern int lastpipe_opt;
+ extern int inherit_errexit;
+ 
++#ifdef __CYGWIN__
++extern int completion_strip_exe;
++#endif
++
+ #if defined (EXTENDED_GLOB)
+ extern int extended_glob;
+ #endif
+@@ -169,6 +173,9 @@ static struct {
+   { "compat41", &shopt_compat41, set_compatibility_level },
+   { "compat42", &shopt_compat42, set_compatibility_level },
+   { "compat43", &shopt_compat43, set_compatibility_level },
++#ifdef __CYGWIN__
++  { "completion_strip_exe", &completion_strip_exe, NULL },
++#endif
+ #if defined (READLINE)
+   { "complete_fullquote", &complete_fullquote, (shopt_set_func_t *)NULL},
+   { "direxpand", &dircomplete_expand, shopt_set_complete_direxpand },
+--- config-top.h	2016-05-19 13:34:02.000000000 -0500
++++ config-top.h	2017-01-23 13:55:07.992877600 -0600
+@@ -87,10 +87,10 @@
+ #define DEFAULT_BASHRC "~/.bashrc"
+ 
+ /* System-wide .bashrc file for interactive shells. */
+-/* #define SYS_BASHRC "/etc/bash.bashrc" */
++#define SYS_BASHRC "/etc/bash.bashrc"
+ 
+ /* System-wide .bash_logout for login shells. */
+-/* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */
++#define SYS_BASH_LOGOUT "/etc/bash.bash_logout"
+ 
+ /* Define this to make non-interactive shells begun with argv[0][0] == '-'
+    run the startup files when not in posix mode. */
+@@ -100,7 +100,7 @@
+    sshd and source the .bashrc if so (like the rshd behavior).  This checks
+    for the presence of SSH_CLIENT or SSH2_CLIENT in the initial environment,
+    which can be fooled under certain not-uncommon circumstances. */
+-/* #define SSH_SOURCE_BASHRC */
++#define SSH_SOURCE_BASHRC
+ 
+ /* Define if you want the case-capitalizing operators (~[~]) and the
+    `capcase' variable attribute (declare -c). */
+--- doc/Makefile.in	2015-12-06 18:55:56.000000000 -0600
++++ doc/Makefile.in	2017-01-23 13:55:07.992877600 -0600
+@@ -189,7 +189,7 @@ bashref.html: $(BASHREF_FILES) $(HSUSER)
+ 	$(MAKEINFO) --html --no-split -I$(TEXINPUTDIR) $(srcdir)/bashref.texi
+ 
+ bash.info: bashref.info
+-	${SHELL} ${INFOPOST} < $(srcdir)/bashref.info > $@ ; \
++	${SHELL} ${INFOPOST} < bashref.info > $@ ; \
+ 
+ bash.txt: bash.1
+ bash.ps: bash.1
+@@ -252,9 +252,9 @@ install: info installdirs
+ 	-$(INSTALL_DATA) $(srcdir)/bashbug.1 $(DESTDIR)$(man1dir)/bashbug${man1ext}
+ 	-$(INSTALL_DATA) $(OTHER_DOCS) $(DESTDIR)$(docdir)
+ # uncomment the next lines to install the builtins man page
+-#	sed 's:bash\.1:man1/&:' $(srcdir)/builtins.1 > $${TMPDIR:-/var/tmp}/builtins.1
+-#	-$(INSTALL_DATA) $${TMPDIR:-/var/tmp}/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
+-#	-$(RM) $${TMPDIR:-/var/tmp}/builtins.1
++	sed 's:bash\.1:man1/&:' $(srcdir)/builtins.1 > $${TMPDIR:-/var/tmp}/builtins.1
++	-$(INSTALL_DATA) $${TMPDIR:-/var/tmp}/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
++	-$(RM) $${TMPDIR:-/var/tmp}/builtins.1
+ 	-if test -f bash.info; then d=.; else d=$(srcdir); fi; \
+ 	  $(INSTALL_DATA) $$d/bash.info $(DESTDIR)$(infodir)/bash.info
+ # run install-info if it is present to update the info directory
+--- doc/bash.1	2016-08-26 08:45:17.000000000 -0500
++++ doc/bash.1	2017-01-23 13:55:08.008447700 -0600
+@@ -9607,6 +9607,10 @@ filenames.
+ This variable is set by default, which is the default bash behavior in
+ versions through 4.2.
+ .TP 8
++.B completion_strip_exe
++If set, whenever bash sees \fIfoo.exe\fP during completion, it checks if
++\fIfoo\fP is the same file and strips the suffix.
++.TP 8
+ .B direxpand
+ If set,
+ .B bash
+--- doc/bashref.texi	2016-09-07 16:13:36.000000000 -0500
++++ doc/bashref.texi	2017-01-23 13:55:08.008447700 -0600
+@@ -5123,6 +5123,10 @@ filenames.
+ This variable is set by default, which is the default Bash behavior in
+ versions through 4.2.
+ 
++@item completion_strip_exe
++If set, whenever bash sees @file{foo.exe} during completion, it checks if
++@file{foo} is the same file and strips the suffix.
++
+ @item direxpand
+ If set, Bash
+ replaces directory names with the results of word expansion when performing
+--- doc/builtins.1	2012-02-21 13:32:05.000000000 -0600
++++ doc/builtins.1	2017-01-23 13:55:08.008447700 -0600
+@@ -19,6 +19,6 @@ shift, shopt, source, suspend, test, tim
+ ulimit, umask, unalias, unset, wait \- bash built-in commands, see \fBbash\fR(1)
+ .SH BASH BUILTIN COMMANDS
+ .nr zZ 1
+-.so bash.1
++.so man1/bash.1
+ .SH SEE ALSO
+ bash(1), sh(1)
+--- general.c	2016-08-11 10:16:56.000000000 -0500
++++ general.c	2017-01-23 13:55:08.008447700 -0600
+@@ -48,6 +48,10 @@
+ 
+ #include <tilde/tilde.h>
+ 
++#ifdef __CYGWIN__
++# include <sys/cygwin.h>
++#endif
++
+ #if !defined (errno)
+ extern int errno;
+ #endif /* !errno */
+@@ -718,7 +722,8 @@ make_absolute (string, dot_path)
+     {
+       char pathbuf[PATH_MAX + 1];
+ 
+-      cygwin_conv_to_full_posix_path (string, pathbuf);
++      cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE, string, pathbuf,
++			sizeof pathbuf);
+       result = savestring (pathbuf);
+     }
+ #else
+--- input.c	2015-09-24 18:49:23.000000000 -0500
++++ input.c	2017-01-23 13:55:08.008447700 -0600
+@@ -44,6 +44,10 @@
+ #include "quit.h"
+ #include "trap.h"
+ 
++#ifdef __CYGWIN__
++int igncr;
++#endif
++
+ #if !defined (errno)
+ extern int errno;
+ #endif /* !errno */
+@@ -561,6 +565,19 @@ buffered_getchar ()
+ {
+   CHECK_TERMSIG;
+ 
++#ifdef __CYGWIN__
++  /* shopt igncr discards carriage returns from the input stream.
++     If cr is the only character left in the buffer, recurse to pick
++     up the next byte; otherwise flatten the buffer.  */
++  if (igncr)
++    {
++      int ch;
++      while ((ch = bufstream_getc (buffers[bash_input.location.buffered_fd]))
++	     == '\r')
++	;
++      return ch;
++    }
++#endif
+ #if !defined (DJGPP)
+   return (bufstream_getc (buffers[bash_input.location.buffered_fd]));
+ #else
+--- lib/sh/pathphys.c	2013-05-28 14:33:58.000000000 -0500
++++ lib/sh/pathphys.c	2017-01-23 13:55:08.008447700 -0600
+@@ -35,6 +35,7 @@
+ #include <stdio.h>
+ #include <chartypes.h>
+ #include <errno.h>
++#include <stdlib.h>
+ 
+ #include "shell.h"
+ 
+@@ -76,6 +77,9 @@ sh_physpath (path, flags)
+      char *path;
+      int flags;
+ {
++#ifdef __CYGWIN__
++  return realpath (path, NULL);
++#endif
+   char tbuf[PATH_MAX+1], linkbuf[PATH_MAX+1];
+   char *result, *p, *q, *qsave, *qbase, *workpath;
+   int double_slash_path, linklen, nlink;
+@@ -214,11 +218,7 @@ error:
+ 	    {
+ 	      q = result;
+ 	      /* Duplicating some code here... */
+-#if defined (__CYGWIN__)
+-	      qbase = (ISALPHA((unsigned char)workpath[0]) && workpath[1] == ':') ? workpath + 3 : workpath + 1;
+-#else
+ 	      qbase = workpath + 1;
+-#endif
+ 	      double_slash_path = DOUBLE_SLASH (workpath);
+ 	      qbase += double_slash_path;
+     
+--- lib/sh/tmpfile.c	2016-08-11 10:05:58.000000000 -0500
++++ lib/sh/tmpfile.c	2017-01-23 13:55:08.008447700 -0600
+@@ -101,7 +101,7 @@ get_tmpdir (flags)
+   if (tdir && (file_iswdir (tdir) == 0 || strlen (tdir) > PATH_MAX))
+     tdir = 0;
+ 
+-  if (tdir == 0)
++  if (tdir == 0 || !file_iswdir (tdir))
+     tdir = get_sys_tmpdir ();
+ 
+ #if defined (HAVE_PATHCONF) && defined (_PC_NAME_MAX)
+--- mksyntax.c	2012-07-29 18:48:38.000000000 -0500
++++ mksyntax.c	2017-01-23 13:55:08.008447700 -0600
+@@ -29,13 +29,13 @@
+ 
+ #ifdef HAVE_UNISTD_H
+ #  include <unistd.h>
++#else
++extern int optind;
++extern char *optarg;
+ #endif
+ 
+ #include "syntax.h"
+ 
+-extern int optind;
+-extern char *optarg;
+-
+ #ifndef errno
+ extern int errno;
+ #endif
+--- parse.y	2016-09-11 10:31:46.000000000 -0500
++++ parse.y	2017-01-23 13:55:08.008447700 -0600
+@@ -1539,14 +1539,20 @@ yy_string_get ()
+   string = bash_input.location.string;
+ 
+   /* If the string doesn't exist, or is empty, EOF found. */
+-  if (string && *string)
++  while (string && *string)
+     {
+       c = *string++;
+       bash_input.location.string = string;
++#ifdef __CYGWIN__
++      {
++	extern int igncr;
++	if (igncr && c == '\r')
++	  continue;
++      }
++#endif
+       return (c);
+     }
+-  else
+-    return (EOF);
++  return (EOF);
+ }
+ 
+ static int
+--- subst.c	2017-01-23 13:28:06.955247200 -0600
++++ subst.c	2017-01-23 13:55:08.008447700 -0600
+@@ -43,6 +43,7 @@
+ #include "posixstat.h"
+ #include "bashintl.h"
+ 
++#define NEED_SH_SETLINEBUF_DECL
+ #include "shell.h"
+ #include "parser.h"
+ #include "flags.h"
+@@ -5964,6 +5965,13 @@ read_comsub (fd, quoted, rflag)
+ #endif
+ 	  continue;
+ 	}
++#ifdef __CYGWIN__
++      {
++	extern int igncr;
++	if (igncr && c == '\r')
++	  continue;
++      }
++#endif
+ 
+       /* Add the character to ISTRING, possibly after resizing it. */
+       RESIZE_MALLOCED_BUFFER (istring, istring_index, 2, istring_size, DEFAULT_ARRAY_SIZE);
+@@ -6088,6 +6096,28 @@ command_substitute (string, quoted)
+       goto error_exit;
+     }
+ 
++#ifdef __CYGWIN__
++  /* Passing a pipe through std fds can cause hangs when talking to a
++     non-cygwin child.  Move it.  */
++  if (fildes[0] < 3)
++    {
++      int fd = fcntl (fildes[0], F_DUPFD, 3);
++      close (fildes[0]);
++      fildes[0] = fd;
++    }
++  if (fildes[1] < 3)
++    {
++      int fd = fcntl (fildes[1], F_DUPFD, 3);
++      close (fildes[1]);
++      fildes[1] = fd;
++    }
++  if (fildes[0] < 0 || fildes[1] < 0)
++    {
++      sys_error (_("cannot make pipe for command substitution"));
++      goto error_exit;
++    }
++#endif /* __CYGWIN__ */
++
+   old_pid = last_made_pid;
+ #if defined (JOB_CONTROL)
+   old_pipeline_pgrp = pipeline_pgrp;
+--- support/bashversion.c	2008-09-09 08:31:53.000000000 -0500
++++ support/bashversion.c	2017-01-23 13:55:08.024037200 -0600
+@@ -26,6 +26,9 @@
+ 
+ #if defined (HAVE_UNISTD_H)
+ #  include <unistd.h>
++#else
++extern int optind;
++extern char *optarg;
+ #endif
+ 
+ #include "bashansi.h"
+@@ -41,9 +44,6 @@
+ #define LFLAG	0x0020
+ #define XFLAG	0x0040
+ 
+-extern int optind;
+-extern char *optarg;
+-
+ extern char *dist_version;
+ extern int patch_level;
+ 
+--- support/mkversion.sh	2008-08-13 07:25:57.000000000 -0500
++++ support/mkversion.sh	2017-01-23 13:55:08.024037200 -0600
+@@ -29,7 +29,7 @@ source_dir="."
+ while [ $# -gt 0 ]; do
+ 	case "$1" in
+ 	-o)	shift; OUTFILE=$1; shift ;;
+-	-b)	shift; inc_build=yes ;;
++	-b)	shift; ;; # inc_build=yes ;; # hacked out for cygport
+ 	-s)	shift; rel_status=$1; shift ;;
+ 	-p)	shift; patch_level=$1; shift ;;
+ 	-d)	shift; dist_version=$1; shift ;;
+--- variables.c	2016-06-15 15:05:52.000000000 -0500
++++ variables.c	2017-01-23 13:55:08.024037200 -0600
+@@ -5239,6 +5239,7 @@ sv_winsize (name)
+ /* Update the value of HOME in the export environment so tilde expansion will
+    work on cygwin. */
+ #if defined (__CYGWIN__)
++void
+ sv_home (name)
+      char *name;
+ {
diff --git a/nixpkgs/pkgs/shells/bash/nix-bash-completions/default.nix b/nixpkgs/pkgs/shells/bash/nix-bash-completions/default.nix
new file mode 100644
index 000000000000..2034eed1f5da
--- /dev/null
+++ b/nixpkgs/pkgs/shells/bash/nix-bash-completions/default.nix
@@ -0,0 +1,36 @@
+{ lib, stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  version = "0.6.8";
+  pname = "nix-bash-completions";
+
+  src = fetchFromGitHub {
+    owner = "hedning";
+    repo = "nix-bash-completions";
+    rev = "v${version}";
+    sha256 = "1n5zs6xcnv4bv1hdaypmz7fv4j7dsr4a0ifah99iyj4p5j85i1bc";
+  };
+
+  # To enable lazy loading via. bash-completion we need a symlink to the script
+  # from every command name.
+  installPhase = ''
+    commands=$(
+      function complete() { shift 2; echo "$@"; }
+      shopt -s extglob
+      source _nix
+    )
+    install -Dm444 -t $out/share/bash-completion/completions _nix
+    cd $out/share/bash-completion/completions
+    for c in $commands; do
+      ln -s _nix $c
+    done
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/hedning/nix-bash-completions";
+    description = "Bash completions for Nix, NixOS, and NixOps";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ hedning ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/bash/pgrp-pipe-4.4.patch b/nixpkgs/pkgs/shells/bash/pgrp-pipe-4.4.patch
new file mode 100644
index 000000000000..6cbdcab4b7c0
--- /dev/null
+++ b/nixpkgs/pkgs/shells/bash/pgrp-pipe-4.4.patch
@@ -0,0 +1,15 @@
+diff -u ./configure ../bash-4.4-fixed/configure
+--- ./configure	2016-09-07 22:57:01.000000000 +0200
++++ ../bash-4.4-fixed/configure	2020-01-08 14:10:26.316858174 +0100
+@@ -16064,10 +16064,7 @@
+ solaris2*)	LOCAL_CFLAGS=-DSOLARIS ;;
+ lynxos*)	LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
+ linux*)		LOCAL_LDFLAGS=-rdynamic		 # allow dynamic loading
+-		case "`uname -r`" in
+-		2.[456789]*|[34]*)	$as_echo "#define PGRP_PIPE 1" >>confdefs.h
+- ;;
+-		esac ;;
++		$as_echo "#define PGRP_PIPE 1" >>confdefs.h ;;
+ *qnx6*)		LOCAL_CFLAGS="-Dqnx -Dqnx6" LOCAL_LIBS="-lncurses" ;;
+ *qnx*)		LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
+ powerux*)	LOCAL_LIBS="-lgen" ;;
diff --git a/nixpkgs/pkgs/shells/bash/pgrp-pipe-5.1.patch b/nixpkgs/pkgs/shells/bash/pgrp-pipe-5.1.patch
new file mode 100644
index 000000000000..478327cafc45
--- /dev/null
+++ b/nixpkgs/pkgs/shells/bash/pgrp-pipe-5.1.patch
@@ -0,0 +1,16 @@
+diff -u ./configure ../bash-5.0-fixed/configure
+--- ./configure	2019-01-02 15:43:31.000000000 +0100
++++ ../bash-5.0-fixed/configure	2020-01-08 14:18:21.017296179 +0100
+@@ -16312,11 +16312,7 @@
+ solaris2*)	LOCAL_CFLAGS=-DSOLARIS ;;
+ lynxos*)	LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
+ linux*)		LOCAL_LDFLAGS=-rdynamic		 # allow dynamic loading
+-		case "`uname -r`" in
+-		1.*|2.[0123]*)	: ;;
+-		*)	$as_echo "#define PGRP_PIPE 1" >>confdefs.h
+- ;;
+-		esac ;;
++		$as_echo "#define PGRP_PIPE 1" >>confdefs.h ;;
+ netbsd*|openbsd*)	LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;;
+ *qnx[67]*)	LOCAL_LIBS="-lncurses" ;;
+ *qnx*)		LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
diff --git a/nixpkgs/pkgs/shells/bash/undistract-me/default.nix b/nixpkgs/pkgs/shells/bash/undistract-me/default.nix
new file mode 100644
index 000000000000..9ed5544713d7
--- /dev/null
+++ b/nixpkgs/pkgs/shells/bash/undistract-me/default.nix
@@ -0,0 +1,79 @@
+{ lib
+, stdenvNoCC
+, fetchFromGitHub
+, fetchpatch
+, coreutils
+, gnused
+, libnotify
+, pulseaudio
+, sound-theme-freedesktop
+, xprop
+}:
+
+stdenvNoCC.mkDerivation rec {
+  pname = "undistract-me";
+  version = "unstable-2020-08-09";
+
+  src = fetchFromGitHub {
+    owner = "jml";
+    repo = pname;
+    rev = "2f8ac25c6ad8efcf160d2b480825b1cbb6772aab";
+    hash = "sha256-Qw7Cu9q0ZgK/RTvyDdHM5N3eBaKjtYqYH0J+hKMUZX8=";
+  };
+
+  patches = [
+    # Don't block the terminal when notification sound is played
+    #
+    # See https://github.com/jml/undistract-me/pull/69
+    (fetchpatch {
+      url = "https://github.com/jml/undistract-me/commit/2356ebbe8bf2bcb4b95af1ae2bcdc786ce7cc6e8.patch";
+      sha256 = "sha256-Ij3OXTOnIQsYhKVmqjChhN1q4ASZ7waOkfQTTp5XfPo=";
+    })
+
+    # Fix showing notifications when using Wayland apps with XWayland
+    # running, or connection to X server fails.
+    #
+    # NOTE: Without a real X server, notifications will not be
+    # suppressed when the window running the command is focused.
+    #
+    # See https://github.com/jml/undistract-me/pull/71
+    (fetchpatch {
+      url = "https://github.com/jml/undistract-me/commit/3f4ceaf5a4eba8e3cb02236c48247f87e3d1124f.patch";
+      sha256 = "sha256-9AK9Jp3TXJ75Y+jwZXlwQ6j54FW1rOBddoktrm0VX68=";
+    })
+  ];
+
+  # Patch in dependencies. Can't use makeWrapper because the bash
+  # functions will be sourced and invoked in a different environment
+  # for each command invocation.
+  postPatch = ''
+    for script in *.bash *.sh; do
+      substituteInPlace "$script" \
+        --replace /usr/share/undistract-me "$out/share/undistract-me" \
+        --replace basename ${coreutils}/bin/basename \
+        --replace 'cut ' '${coreutils}/bin/cut ' \
+        --replace date ${coreutils}/bin/date \
+        --replace dirname ${coreutils}/bin/dirname \
+        --replace sed ${gnused}/bin/sed \
+        --replace notify-send ${libnotify}/bin/notify-send \
+        --replace paplay ${pulseaudio}/bin/paplay \
+        --replace /usr/share/sounds/freedesktop ${sound-theme-freedesktop}/share/sounds/freedesktop \
+        --replace xprop ${xprop}/bin/xprop
+    done
+  '';
+
+  installPhase = ''
+    mkdir -p "$out/share/undistract-me" "$out/etc/profile.d" "$out/share/licenses/undistract-me"
+    cp long-running.bash "$out/share/undistract-me"
+    cp preexec.bash "$out/share/undistract-me"
+    cp undistract-me.sh "$out/etc/profile.d"
+    cp LICENSE "$out/share/licenses/undistract-me"
+  '';
+
+  meta = with lib; {
+    description = "Notifies you when long-running terminal commands complete";
+    homepage = "https://github.com/jml/undistract-me";
+    license = licenses.mit;
+    maintainers = with maintainers; [ kira-bruneau ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/bash/update-patch-set.sh b/nixpkgs/pkgs/shells/bash/update-patch-set.sh
new file mode 100755
index 000000000000..cb4f372f5433
--- /dev/null
+++ b/nixpkgs/pkgs/shells/bash/update-patch-set.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env nix-shell
+#!nix-shell --pure -i bash -p wget -p gnupg -p cacert
+
+# Update patch set for GNU Bash or Readline.
+
+if [ $# -ne 2 ]
+then
+    echo "Usage: $(basename $0) PROJECT VERSION"
+    echo ""
+    echo "Update the patch set for PROJECT (one of \`bash' or \`readline') for"
+    echo "the given version (e.g., \`4.0').  Produce \`PROJECT-patches.nix'."
+    exit 1
+fi
+
+PROJECT="$1"
+VERSION="$2"
+VERSION_CONDENSED="$(echo $VERSION | sed -es/\\.//g)"
+PATCH_LIST="$PROJECT-$VERSION-patches.nix"
+
+set -e
+
+start=1
+end=100 # must be > 99 for correct padding
+
+rm -vf "$PATCH_LIST"
+
+wget "https://tiswww.case.edu/php/chet/gpgkey.asc"
+echo "4ef5051ce7200241e65d29c11eb57df8  gpgkey.asc" > gpgkey.asc.md5
+md5sum -c gpgkey.asc.md5
+gpg --import ./gpgkey.asc
+rm gpgkey.asc{,.md5}
+
+( echo "# Automatically generated by \`$(basename $0)'; do not edit." ;	\
+  echo "" ;								\
+  echo "patch: [" )							\
+>> "$PATCH_LIST"
+
+for i in `seq -w $start $end`
+do
+    wget ftp.gnu.org/gnu/$PROJECT/$PROJECT-$VERSION-patches/$PROJECT$VERSION_CONDENSED-$i || break
+    wget ftp.gnu.org/gnu/$PROJECT/$PROJECT-$VERSION-patches/$PROJECT$VERSION_CONDENSED-$i.sig
+    gpg --verify $PROJECT$VERSION_CONDENSED-$i.sig
+    echo "(patch \"$i\" \"$(nix-hash --flat --type sha256 --base32 $PROJECT$VERSION_CONDENSED-$i)\")"	\
+    >> "$PATCH_LIST"
+
+    rm -f $PROJECT$VERSION_CONDENSED-$i{,.sig}
+done
+
+echo "]" >> "$PATCH_LIST"
+
+echo "Got $(expr $i - 1) patches."
+echo "Patch list has been written to \`$PATCH_LIST'."
diff --git a/nixpkgs/pkgs/shells/dash/0001-fix-dirent64-et-al-on-darwin.patch b/nixpkgs/pkgs/shells/dash/0001-fix-dirent64-et-al-on-darwin.patch
new file mode 100644
index 000000000000..f2e0802f7981
--- /dev/null
+++ b/nixpkgs/pkgs/shells/dash/0001-fix-dirent64-et-al-on-darwin.patch
@@ -0,0 +1,41 @@
+From 7e75779eaeacdbb46a387a59d9aaf1481a1da3e5 Mon Sep 17 00:00:00 2001
+From: Adrian Gierakowski <agierakowski@gmail.com>
+Date: Sun, 19 Jul 2020 08:38:05 +0100
+Subject: [PATCH] fix dirent64 et al on darwin
+
+---
+ configure.ac | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index b8faca9..cee1e4d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -139,6 +139,7 @@ if test "$ac_cv_func_signal" != yes; then
+ 				 [klibc has bsd_signal instead of signal])])
+ fi
+ 
++dnl TODO: stat64 is deprecated since macOS 10.6
+ dnl Check for stat64 (dietlibc/klibc).
+ AC_CHECK_FUNC(stat64,, [
+ 	AC_DEFINE(fstat64, fstat, [64-bit operations are the same as 32-bit])
+@@ -155,6 +156,16 @@ AC_CHECK_FUNC(open64,, [
+ 	AC_DEFINE(open64, open, [64-bit operations are the same as 32-bit])
+ ])
+ 
++dnl OS X apparently has stat64 but not readdir64.
++AC_CHECK_FUNC(readdir64,, [
++	AC_DEFINE(readdir64, readdir, [64-bit operations are the same as 32-bit])
++])
++
++dnl OS X apparently has stat64 but not dirent64.
++AC_CHECK_TYPE(struct dirent64,, [
++	AC_DEFINE(dirent64, dirent, [64-bit operations are the same as 32-bit])
++],[#include <dirent.h>])
++
+ dnl Check if struct stat has st_mtim.
+ AC_MSG_CHECKING(for stat::st_mtim)
+ AC_COMPILE_IFELSE(
+-- 
+2.15.1
+
diff --git a/nixpkgs/pkgs/shells/dash/default.nix b/nixpkgs/pkgs/shells/dash/default.nix
new file mode 100644
index 000000000000..f044c41b73d6
--- /dev/null
+++ b/nixpkgs/pkgs/shells/dash/default.nix
@@ -0,0 +1,44 @@
+{ lib, stdenv, buildPackages, autoreconfHook, fetchurl, libedit }:
+
+stdenv.mkDerivation rec {
+  pname = "dash";
+  version = "0.5.11.2";
+
+  src = fetchurl {
+    url = "http://gondor.apana.org.au/~herbert/dash/files/${pname}-${version}.tar.gz";
+    sha256 = "0pvdpm1cgfbc25ramn4305a0158yq031q1ain4dc972rnxl7vyq0";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  patches = [
+    (fetchurl {
+      # Dash executes code when noexec ("-n") is specified
+      # https://www.openwall.com/lists/oss-security/2020/11/11/3
+      url = "https://git.kernel.org/pub/scm/utils/dash/dash.git/patch/?id=29d6f2148f10213de4e904d515e792d2cf8c968e";
+      sha256 = "08q90bx36ixwlcj331dh7420qyj8i0qh1cc1gljrhd83fhl9w0y5";
+    })
+  ] ++ lib.optionals stdenv.isDarwin [
+      # Temporary fix until a proper one is accepted upstream
+    ./0001-fix-dirent64-et-al-on-darwin.patch
+  ];
+
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = lib.optional stdenv.isDarwin autoreconfHook;
+  buildInputs = [ libedit ];
+
+  configureFlags = [ "--with-libedit" ];
+
+  enableParallelBuilding = true;
+
+  meta = with lib; {
+    homepage = "http://gondor.apana.org.au/~herbert/dash/";
+    description = "A POSIX-compliant implementation of /bin/sh that aims to be as small as possible";
+    platforms = platforms.unix;
+    license = with licenses; [ bsd3 gpl2 ];
+  };
+
+  passthru = {
+    shellPath = "/bin/dash";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/dgsh/default.nix b/nixpkgs/pkgs/shells/dgsh/default.nix
new file mode 100644
index 000000000000..7a6ae67c3ae8
--- /dev/null
+++ b/nixpkgs/pkgs/shells/dgsh/default.nix
@@ -0,0 +1,45 @@
+{ lib, stdenv, fetchFromGitHub, autoconf, automake, pkg-config,
+  libtool, check, bison, git, gperf,
+  perl, texinfo, help2man, gettext, ncurses
+}:
+
+stdenv.mkDerivation {
+  pname = "dgsh-unstable";
+  version = "2017-02-05";
+
+  src = fetchFromGitHub {
+    owner = "dspinellis";
+    repo = "dgsh";
+    rev = "bc4fc2e8009c069ee4df5140c32a2fc15d0acdec";
+    sha256 = "0k3hmnarz56wphw45mabn5zcc427l5p77jldh1qqy89pxqy1wnql";
+    fetchSubmodules = true;
+  };
+
+  patches = [ ./glibc-2.26.patch ];
+
+  nativeBuildInputs = [ autoconf automake pkg-config libtool check
+    bison git gettext gperf perl texinfo help2man ncurses
+  ];
+
+  configurePhase = ''
+    cp -r ./unix-tools/coreutils/gnulib gnulib
+    perl -pi -e \
+      's#./bootstrap #./bootstrap --no-bootstrap-sync --skip-po --no-git --gnulib-srcdir='$PWD/gnulib' #g' \
+      unix-tools/Makefile
+    find . -name \*.diff | xargs rm -f
+    rm -rf unix-tools/*/gnulib
+    patchShebangs unix-tools/diffutils/man/help2man
+    export RSYNC=true # set to rsync binary, eventhough it is not used.
+    make PREFIX=$out config
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with lib; {
+    description = "The Directed Graph Shell";
+    homepage = "http://www.dmst.aueb.gr/dds/sw/dgsh";
+    license = with licenses; asl20;
+    maintainers = with maintainers; [ vrthra ];
+    platforms = with platforms; all;
+  };
+}
diff --git a/nixpkgs/pkgs/shells/dgsh/glibc-2.26.patch b/nixpkgs/pkgs/shells/dgsh/glibc-2.26.patch
new file mode 100644
index 000000000000..c66768151316
--- /dev/null
+++ b/nixpkgs/pkgs/shells/dgsh/glibc-2.26.patch
@@ -0,0 +1,12 @@
+diff --git a/core-tools/src/dgsh-httpval.c b/core-tools/src/dgsh-httpval.c
+index 8b5dce3..7b43c3d 100644
+--- a/core-tools/src/dgsh-httpval.c
++++ b/core-tools/src/dgsh-httpval.c
+@@ -40,6 +40,7 @@
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <stdlib.h>
++#include <stdint.h>
+ #include <stdio.h>
+ #include <string.h>
+ #include <ctype.h>
diff --git a/nixpkgs/pkgs/shells/elvish/default.nix b/nixpkgs/pkgs/shells/elvish/default.nix
new file mode 100644
index 000000000000..de25503e4aa0
--- /dev/null
+++ b/nixpkgs/pkgs/shells/elvish/default.nix
@@ -0,0 +1,38 @@
+{ lib, buildGoModule, fetchFromGitHub }:
+
+buildGoModule rec {
+  pname = "elvish";
+  version = "0.15.0";
+
+  excludedPackages = [ "website" ];
+
+  buildFlagsArray = [ "-ldflags=-s -w -X github.com/elves/elvish/pkg/buildinfo.Version==${version} -X github.com/elves/elvish/pkg/buildinfo.Reproducible=true" ];
+
+  src = fetchFromGitHub {
+    owner = "elves";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1jksdpf86miz1dv3vrmvpvz4k1c2m23dway6a7b1cypg03c68a75";
+  };
+
+  vendorSha256 = "124m9680pl7wrh7ld7v39dfl86r6vih1pjk3bmbihy0fjgxnnq0b";
+
+  doCheck = false;
+
+  meta = with lib; {
+    description = "A friendly and expressive command shell";
+    longDescription = ''
+      Elvish is a friendly interactive shell and an expressive programming
+      language. It runs on Linux, BSDs, macOS and Windows. Despite its pre-1.0
+      status, it is already suitable for most daily interactive use.
+    '';
+    homepage = "https://elv.sh/";
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ vrthra AndersonTorres ];
+    platforms = with platforms; linux ++ darwin;
+  };
+
+  passthru = {
+    shellPath = "/bin/elvish";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/es/default.nix b/nixpkgs/pkgs/shells/es/default.nix
new file mode 100644
index 000000000000..52131a214a5e
--- /dev/null
+++ b/nixpkgs/pkgs/shells/es/default.nix
@@ -0,0 +1,42 @@
+{ lib, stdenv, fetchurl, readline, bison }:
+
+stdenv.mkDerivation rec {
+
+  pname = "es";
+  version = "0.9.1";
+
+  src = fetchurl {
+    url = "https://github.com/wryun/es-shell/releases/download/v${version}/es-${version}.tar.gz";
+    sha256 = "1fplzxc6lncz2lv2fyr2ig23rgg5j96rm2bbl1rs28mik771zd5h";
+  };
+
+  # The distribution tarball does not have a single top-level directory.
+  preUnpack = ''
+    mkdir $name
+    cd $name
+    sourceRoot=.
+  '';
+
+  buildInputs = [ readline bison ];
+
+  configureFlags = [ "--with-readline" ];
+
+  meta = with lib; {
+    description = "An extensible shell with higher order functions";
+    longDescription =
+      ''
+        Es is an extensible shell. The language was derived
+        from the Plan 9 shell, rc, and was influenced by
+        functional programming languages, such as Scheme,
+        and the Tcl embeddable programming language.
+      '';
+    homepage = "http://wryun.github.io/es-shell/";
+    license = licenses.publicDomain;
+    maintainers = with maintainers; [ sjmackenzie ttuegel ];
+    platforms = platforms.all;
+  };
+
+  passthru = {
+    shellPath = "/bin/es";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/fish/babelfish.nix b/nixpkgs/pkgs/shells/fish/babelfish.nix
new file mode 100644
index 000000000000..fb938b8f37de
--- /dev/null
+++ b/nixpkgs/pkgs/shells/fish/babelfish.nix
@@ -0,0 +1,21 @@
+{ lib, buildGoModule, fetchFromGitHub }:
+buildGoModule rec {
+  pname = "babelfish";
+  version = "1.1.0";
+
+  src = fetchFromGitHub {
+    owner = "bouk";
+    repo = "babelfish";
+    rev = "v${version}";
+    sha256 = "0b1knj9llwzwnl4w3d6akvlc57dp0fszjkq98w8wybcvkbpd3ip1";
+  };
+
+  vendorSha256 = "0kspqwbgiqfkfj9a9pdwzc0jdi9p35abqqqjhcpvqwdxw378w5lz";
+
+  meta = with lib; {
+    description = "Translate bash scripts to fish";
+    homepage = "https://github.com/bouk/babelfish";
+    license = licenses.mit;
+    maintainers = with maintainers; [ bouk kevingriffin ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/fish/default.nix b/nixpkgs/pkgs/shells/fish/default.nix
new file mode 100644
index 000000000000..c53a9ed0fe2d
--- /dev/null
+++ b/nixpkgs/pkgs/shells/fish/default.nix
@@ -0,0 +1,321 @@
+{ stdenv
+, lib
+, fetchurl
+, coreutils
+, util-linux
+, which
+, gnused
+, gnugrep
+, groff
+, gawk
+, man-db
+, getent
+, libiconv
+, pcre2
+, gettext
+, ncurses
+, python3
+, cmake
+, fishPlugins
+, procps
+
+# used to generate autocompletions from manpages and for configuration editing in the browser
+, usePython ? true
+
+, runCommand
+, writeText
+, nixosTests
+, useOperatingSystemEtc ? true
+  # An optional string containing Fish code that initializes the environment.
+  # This is run at the very beginning of initialization. If it sets $NIX_PROFILES
+  # then Fish will use that to configure its function, completion, and conf.d paths.
+  # For example:
+  #   fishEnvPreInit = "source /etc/fish/my-env-preinit.fish";
+  # It can also be a function that takes one argument, which is a function that
+  # takes a path to a bash file and converts it to fish. For example:
+  #   fishEnvPreInit = source: source "${nix}/etc/profile.d/nix-daemon.sh";
+, fishEnvPreInit ? null
+}:
+let
+  etcConfigAppendix = writeText "config.fish.appendix" ''
+    ############### ↓ Nix hook for sourcing /etc/fish/config.fish ↓ ###############
+    #                                                                             #
+    # Origin:
+    #     This fish package was called with the attribute
+    #     "useOperatingSystemEtc = true;".
+    #
+    # Purpose:
+    #     Fish ordinarily sources /etc/fish/config.fish as
+    #        $__fish_sysconfdir/config.fish,
+    #     and $__fish_sysconfdir is defined at compile-time, baked into the C++
+    #     component of fish. By default, it is set to "/etc/fish". When building
+    #     through Nix, $__fish_sysconfdir gets set to $out/etc/fish. Here we may
+    #     have included a custom $out/etc/config.fish in the fish package,
+    #     as specified, but according to the value of useOperatingSystemEtc, we
+    #     may want to further source the real "/etc/fish/config.fish" file.
+    #
+    #     When this option is enabled, this segment should appear the very end of
+    #     "$out/etc/config.fish". This is to emulate the behavior of fish itself
+    #     with respect to /etc/fish/config.fish and ~/.config/fish/config.fish:
+    #     source both, but source the more global configuration files earlier
+    #     than the more local ones, so that more local configurations inherit
+    #     from but override the more global locations.
+    #
+    #     Special care needs to be taken, when fish is called from an FHS user env
+    #     or similar setup, because this configuration file will then be relocated
+    #     to /etc/fish/config.fish, so we test for this case to avoid nontermination.
+
+    if test -f /etc/fish/config.fish && test /etc/fish/config.fish != (status filename)
+      source /etc/fish/config.fish
+    end
+
+    #                                                                             #
+    ############### ↑ Nix hook for sourcing /etc/fish/config.fish ↑ ###############
+  '';
+
+  fishPreInitHooks = writeText "__fish_build_paths_suffix.fish" ''
+    # source nixos environment
+    # note that this is required:
+    #   1. For all shells, not just login shells (mosh needs this as do some other command-line utilities)
+    #   2. Before the shell is initialized, so that config snippets can find the commands they use on the PATH
+    builtin status --is-login
+    or test -z "$__fish_nixos_env_preinit_sourced" -a -z "$ETC_PROFILE_SOURCED" -a -z "$ETC_ZSHENV_SOURCED"
+    ${if fishEnvPreInit != null then ''
+    and begin
+    ${lib.removeSuffix "\n" (if lib.isFunction fishEnvPreInit then fishEnvPreInit sourceWithFenv else fishEnvPreInit)}
+    end'' else ''
+    and test -f /etc/fish/nixos-env-preinit.fish
+    and source /etc/fish/nixos-env-preinit.fish''}
+    and set -gx __fish_nixos_env_preinit_sourced 1
+
+    test -n "$NIX_PROFILES"
+    and begin
+      # We ensure that __extra_* variables are read in $__fish_datadir/config.fish
+      # with a preference for user-configured data by making sure the package-specific
+      # data comes last. Files are loaded/sourced in encounter order, duplicate
+      # basenames get skipped, so we assure this by prepending Nix profile paths
+      # (ordered in reverse of the $NIX_PROFILE variable)
+      #
+      # Note that at this point in evaluation, there is nothing whatsoever on the
+      # fish_function_path. That means we don't have most fish builtins, e.g., `eval`.
+
+
+      # additional profiles are expected in order of precedence, which means the reverse of the
+      # NIX_PROFILES variable (same as config.environment.profiles)
+      set -l __nix_profile_paths (string split ' ' $NIX_PROFILES)[-1..1]
+
+      set -p __extra_completionsdir \
+        $__nix_profile_paths"/etc/fish/completions" \
+        $__nix_profile_paths"/share/fish/vendor_completions.d"
+      set -p __extra_functionsdir \
+        $__nix_profile_paths"/etc/fish/functions" \
+        $__nix_profile_paths"/share/fish/vendor_functions.d"
+      set -p __extra_confdir \
+        $__nix_profile_paths"/etc/fish/conf.d" \
+        $__nix_profile_paths"/share/fish/vendor_conf.d"
+    end
+  '';
+
+  # This is wrapped in begin/end in case the user wants to apply redirections.
+  # This does mean the basic usage of sourcing a single file will produce
+  # `begin; begin; …; end; end` but that's ok.
+  sourceWithFenv = path: ''
+    begin # fenv
+      # This happens before $__fish_datadir/config.fish sets fish_function_path, so it is currently
+      # unset. We set it and then completely erase it, leaving its configuration to $__fish_datadir/config.fish
+      set fish_function_path ${fishPlugins.foreign-env}/share/fish/vendor_functions.d $__fish_datadir/functions
+      fenv source ${lib.escapeShellArg path}
+      set -l fenv_status $status
+      # clear fish_function_path so that it will be correctly set when we return to $__fish_datadir/config.fish
+      set -e fish_function_path
+      test $fenv_status -eq 0
+    end # fenv
+  '';
+
+  fish = stdenv.mkDerivation rec {
+    pname = "fish";
+    version = "3.3.1";
+
+    src = fetchurl {
+      # There are differences between the release tarball and the tarball GitHub
+      # packages from the tag. Specifically, it comes with a file containing its
+      # version, which is used in `build_tools/git_version_gen.sh` to determine
+      # the shell's actual version (and what it displays when running `fish
+      # --version`), as well as the local documentation for all builtins (and
+      # maybe other things).
+      url = "https://github.com/fish-shell/fish-shell/releases/download/${version}/${pname}-${version}.tar.xz";
+      sha256 = "sha256-tbTuGlJpdiy76ZOkvWUH5nXkEAzpu+hCFKXusrGfrok=";
+    };
+
+    # Fix FHS paths in tests
+    postPatch = ''
+      # src/fish_tests.cpp
+      sed -i 's|/bin/ls|${coreutils}/bin/ls|' src/fish_tests.cpp
+      sed -i 's|is_potential_path(L"/usr"|is_potential_path(L"/nix"|' src/fish_tests.cpp
+      sed -i 's|L"/bin/echo"|L"${coreutils}/bin/echo"|' src/fish_tests.cpp
+      sed -i 's|L"/bin/c"|L"${coreutils}/bin/c"|' src/fish_tests.cpp
+      sed -i 's|L"/bin/ca"|L"${coreutils}/bin/ca"|' src/fish_tests.cpp
+
+      # tests/checks/cd.fish
+      sed -i 's|/bin/pwd|${coreutils}/bin/pwd|' tests/checks/cd.fish
+
+      # tests/checks/redirect.fish
+      sed -i 's|/bin/echo|${coreutils}/bin/echo|' tests/checks/redirect.fish
+
+      # tests/checks/vars_as_commands.fish
+      sed -i 's|/usr/bin|${coreutils}/bin|' tests/checks/vars_as_commands.fish
+
+      # tests/checks/jobs.fish
+      sed -i 's|ps -o stat|${procps}/bin/ps -o stat|' tests/checks/jobs.fish
+      sed -i 's|/bin/echo|${coreutils}/bin/echo|' tests/checks/jobs.fish
+
+      # tests/checks/job-control-noninteractive.fish
+      sed -i 's|/bin/echo|${coreutils}/bin/echo|' tests/checks/job-control-noninteractive.fish
+
+      # tests/checks/complete.fish
+      sed -i 's|/bin/ls|${coreutils}/bin/ls|' tests/checks/complete.fish
+    '' + lib.optionalString stdenv.isDarwin ''
+      # Tests use pkill/pgrep which are currently not built on Darwin
+      # See https://github.com/NixOS/nixpkgs/pull/103180
+      rm tests/pexpects/exit.py
+      rm tests/pexpects/job_summary.py
+      rm tests/pexpects/signals.py
+    '';
+
+    nativeBuildInputs = [
+      cmake
+    ];
+
+    buildInputs = [
+      ncurses
+      libiconv
+      pcre2
+    ];
+
+    cmakeFlags = [
+      "-DCMAKE_INSTALL_DOCDIR=${placeholder "out"}/share/doc/fish"
+    ] ++ lib.optionals stdenv.isDarwin [
+      "-DMAC_CODESIGN_ID=OFF"
+    ];
+
+    preConfigure = ''
+      patchShebangs ./build_tools/git_version_gen.sh
+    '';
+
+    # Required binaries during execution
+    propagatedBuildInputs = [
+      coreutils
+      gnugrep
+      gnused
+      groff
+      gettext
+    ] ++ lib.optional (!stdenv.isDarwin) man-db;
+
+    doCheck = true;
+
+    checkInputs = [
+      coreutils
+      (python3.withPackages (ps: [ ps.pexpect ]))
+      procps
+    ];
+
+    checkPhase = ''
+      make test
+    '';
+
+    postInstall = with lib; ''
+      sed -r "s|command grep|command ${gnugrep}/bin/grep|" \
+          -i "$out/share/fish/functions/grep.fish"
+      sed -e "s|\|cut|\|${coreutils}/bin/cut|"             \
+          -i "$out/share/fish/functions/fish_prompt.fish"
+      sed -e "s|uname|${coreutils}/bin/uname|"             \
+          -i "$out/share/fish/functions/__fish_pwd.fish"   \
+             "$out/share/fish/functions/prompt_pwd.fish"
+      sed -e "s|sed |${gnused}/bin/sed |"                  \
+          -i "$out/share/fish/functions/alias.fish"        \
+             "$out/share/fish/functions/prompt_pwd.fish"
+      sed -i "s|nroff|${groff}/bin/nroff|"                 \
+             "$out/share/fish/functions/__fish_print_help.fish"
+      sed -e "s|clear;|${getBin ncurses}/bin/clear;|"      \
+          -i "$out/share/fish/functions/fish_default_key_bindings.fish"
+      sed -i "s|/usr/local/sbin /sbin /usr/sbin||"         \
+             $out/share/fish/completions/{sudo.fish,doas.fish}
+      sed -e "s| awk | ${gawk}/bin/awk |"                  \
+          -i $out/share/fish/functions/{__fish_print_packages.fish,__fish_print_addresses.fish,__fish_describe_command.fish,__fish_complete_man.fish,__fish_complete_convert_options.fish} \
+             $out/share/fish/completions/{cwebp,adb,ezjail-admin,grunt,helm,heroku,lsusb,make,p4,psql,rmmod,vim-addons}.fish
+
+    '' + optionalString usePython ''
+      cat > $out/share/fish/functions/__fish_anypython.fish <<EOF
+      function __fish_anypython
+          echo ${python3.interpreter}
+          return 0
+      end
+      EOF
+
+    '' + optionalString stdenv.isLinux ''
+      sed -e "s| ul| ${util-linux}/bin/ul|" \
+          -i "$out/share/fish/functions/__fish_print_help.fish"
+      for cur in $out/share/fish/functions/*.fish; do
+        sed -e "s|/usr/bin/getent|${getent}/bin/getent|" \
+            -i "$cur"
+      done
+
+    '' + optionalString (!stdenv.isDarwin) ''
+      sed -i "s|Popen(\['manpath'|Popen(\['${man-db}/bin/manpath'|" \
+              "$out/share/fish/tools/create_manpage_completions.py"
+      sed -i "s|command manpath|command ${man-db}/bin/manpath|"     \
+              "$out/share/fish/functions/man.fish"
+    '' + optionalString useOperatingSystemEtc ''
+      tee -a $out/etc/fish/config.fish < ${etcConfigAppendix}
+    '' + ''
+      tee -a $out/share/fish/__fish_build_paths.fish < ${fishPreInitHooks}
+    '';
+
+    meta = with lib; {
+      description = "Smart and user-friendly command line shell";
+      homepage = "http://fishshell.com/";
+      license = licenses.gpl2;
+      platforms = platforms.unix;
+      maintainers = with maintainers; [ cole-h ];
+    };
+
+    passthru = {
+      shellPath = "/bin/fish";
+      tests = {
+        nixos = nixosTests.fish;
+
+        # Test the fish_config tool by checking the generated splash page.
+        # Since the webserver requires a port to run, it is not started.
+        fishConfig =
+          let fishScript = writeText "test.fish" ''
+            set -x __fish_bin_dir ${fish}/bin
+            echo $__fish_bin_dir
+            cp -r ${fish}/share/fish/tools/web_config/* .
+            chmod -R +w *
+
+            # if we don't set `delete=False`, the file will get cleaned up
+            # automatically (leading the test to fail because there's no
+            # tempfile to check)
+            sed -e 's@, mode="w"@, mode="w", delete=False@' -i webconfig.py
+
+            # we delete everything after the fileurl is assigned
+            sed -e '/fileurl =/q' -i webconfig.py
+            echo "print(fileurl)" >> webconfig.py
+
+            # and check whether the message appears on the page
+            cat (${python3}/bin/python ./webconfig.py \
+              | tail -n1 | sed -ne 's|.*\(/build/.*\)|\1|p' \
+            ) | grep 'a href="http://localhost.*Start the Fish Web config'
+
+            # cannot test the http server because it needs a localhost port
+          '';
+          in
+          runCommand "test-web-config" { } ''
+            HOME=$(mktemp -d)
+            ${fish}/bin/fish ${fishScript} && touch $out
+          '';
+      };
+    };
+  };
+in
+fish
diff --git a/nixpkgs/pkgs/shells/fish/plugins/build-fish-plugin.nix b/nixpkgs/pkgs/shells/fish/plugins/build-fish-plugin.nix
new file mode 100644
index 000000000000..5bb4ffa243fc
--- /dev/null
+++ b/nixpkgs/pkgs/shells/fish/plugins/build-fish-plugin.nix
@@ -0,0 +1,73 @@
+{ stdenv, lib, writeScript, wrapFish }:
+
+attrs@{
+  pname,
+  version,
+  src,
+
+  name ? "fishplugin-${pname}-${version}",
+  unpackPhase ? "",
+  configurePhase ? ":",
+  buildPhase ? ":",
+  preInstall ? "",
+  postInstall ? "",
+
+  checkInputs ? [],
+  # plugin packages to add to the vendor paths of the test fish shell
+  checkPlugins ? [],
+  # vendor directories to add to the function path of the test fish shell
+  checkFunctionDirs ? [],
+  # test script to be executed in a fish shell
+  checkPhase ? "",
+  doCheck ? checkPhase != "",
+
+  ...
+}:
+
+let
+  # Do not pass attributes that are only relevant to buildFishPlugin to mkDerivation.
+  drvAttrs = builtins.removeAttrs attrs [
+    "checkPlugins"
+    "checkFunctionDirs"
+  ];
+in
+
+stdenv.mkDerivation (drvAttrs // {
+  inherit name;
+  inherit unpackPhase configurePhase buildPhase;
+
+  inherit preInstall postInstall;
+  installPhase = ''
+    runHook preInstall
+
+    (
+      install_vendor_files() {
+        source="$1"
+        target="$out/share/fish/vendor_$2.d"
+
+        [ -d $source ] || return 0
+        mkdir -p $target
+        cp -r $source/*.fish "$target/"
+      }
+
+      install_vendor_files completions completions
+      install_vendor_files functions functions
+      install_vendor_files conf conf
+      install_vendor_files conf.d conf
+    )
+
+    runHook postInstall
+  '';
+
+  inherit doCheck;
+
+  checkInputs = [ (wrapFish {
+    pluginPkgs = checkPlugins;
+    functionDirs = checkFunctionDirs;
+  }) ] ++ checkInputs;
+
+  checkPhase = ''
+    export HOME=$(mktemp -d)  # fish wants a writable home
+    fish "${writeScript "${name}-test" checkPhase}"
+  '';
+})
diff --git a/nixpkgs/pkgs/shells/fish/plugins/clownfish.nix b/nixpkgs/pkgs/shells/fish/plugins/clownfish.nix
new file mode 100644
index 000000000000..cd5c997d3114
--- /dev/null
+++ b/nixpkgs/pkgs/shells/fish/plugins/clownfish.nix
@@ -0,0 +1,20 @@
+{ lib, buildFishPlugin, fetchFromGitHub }:
+
+buildFishPlugin {
+  pname = "clownfish";
+  version = "unstable-2021-01-17";
+
+  src = fetchFromGitHub {
+    owner = "IlanCosman";
+    repo = "clownfish";
+    rev = "a0db28d8280d05561b8f48c0465480725feeca4c";
+    sha256 = "04xvikyrdm6yxh588vbpwvm04fas76pa7sigsaqrip7yh021xxab";
+  };
+
+  meta = with lib; {
+    description = "Fish function to mock the behaviour of commands";
+    homepage = "https://github.com/IlanCosman/clownfish";
+    license = licenses.mit;
+    maintainers = with maintainers; [ pacien ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/fish/plugins/default.nix b/nixpkgs/pkgs/shells/fish/plugins/default.nix
new file mode 100644
index 000000000000..0ce172ec489a
--- /dev/null
+++ b/nixpkgs/pkgs/shells/fish/plugins/default.nix
@@ -0,0 +1,24 @@
+{ lib, newScope }:
+
+lib.makeScope newScope (self: with self; {
+
+  buildFishPlugin = callPackage ./build-fish-plugin.nix { };
+
+  clownfish = callPackage ./clownfish.nix { };
+
+  done = callPackage ./done.nix { };
+
+  # Fishtape 2.x and 3.x aren't compatible,
+  # but both versions are used in the tests of different other plugins.
+  fishtape = callPackage ./fishtape.nix { };
+  fishtape_3 = callPackage ./fishtape_3.nix { };
+
+  foreign-env = callPackage ./foreign-env { };
+
+  forgit = callPackage ./forgit.nix { };
+
+  fzf-fish = callPackage ./fzf-fish.nix { };
+
+  pure = callPackage ./pure.nix { };
+
+})
diff --git a/nixpkgs/pkgs/shells/fish/plugins/done.nix b/nixpkgs/pkgs/shells/fish/plugins/done.nix
new file mode 100644
index 000000000000..8d1a14e19f23
--- /dev/null
+++ b/nixpkgs/pkgs/shells/fish/plugins/done.nix
@@ -0,0 +1,25 @@
+{ lib, buildFishPlugin, fetchFromGitHub, fishtape }:
+
+buildFishPlugin rec {
+  pname = "done";
+  version = "1.16.3";
+
+  src = fetchFromGitHub {
+    owner = "franciscolourenco";
+    repo = "done";
+    rev = version;
+    sha256 = "Xld66z9vVp3kxikndZ9k/zlNvP0YSoSCNTBkJ8rT3uo=";
+  };
+
+  checkPlugins = [ fishtape ];
+  checkPhase = ''
+    fishtape test/done.fish
+  '';
+
+  meta = {
+    description = "Automatically receive notifications when long processes finish";
+    homepage = "https://github.com/franciscolourenco/done";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ malo ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/fish/plugins/fishtape.nix b/nixpkgs/pkgs/shells/fish/plugins/fishtape.nix
new file mode 100644
index 000000000000..82f2375d5e3f
--- /dev/null
+++ b/nixpkgs/pkgs/shells/fish/plugins/fishtape.nix
@@ -0,0 +1,32 @@
+{ lib, buildFishPlugin, fetchFromGitHub }:
+
+buildFishPlugin rec {
+  pname = "fishtape";
+  version = "2.1.3";
+
+  src = fetchFromGitHub {
+    owner = "jorgebucaran";
+    repo = "fishtape";
+    rev = version;
+    sha256 = "0dxcyhs2shhgy5xnwcimqja8vqsyk841x486lgq13i3y1h0kp2kd";
+  };
+
+  checkFunctionDirs = [ "./" ]; # fishtape is introspective
+  checkPhase = ''
+    rm test/tty.fish  # test expects a tty
+    fishtape test/*.fish
+  '';
+
+  preInstall = ''
+    # move the function script in the proper sub-directory
+    mkdir functions
+    mv fishtape.fish functions/
+  '';
+
+  meta = {
+    description = "TAP-based test runner for Fish";
+    homepage = "https://github.com/jorgebucaran/fishtape";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ pacien ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/fish/plugins/fishtape_3.nix b/nixpkgs/pkgs/shells/fish/plugins/fishtape_3.nix
new file mode 100644
index 000000000000..893e6d65ffb3
--- /dev/null
+++ b/nixpkgs/pkgs/shells/fish/plugins/fishtape_3.nix
@@ -0,0 +1,25 @@
+{ lib, buildFishPlugin, fetchFromGitHub }:
+
+buildFishPlugin rec {
+  pname = "fishtape";
+  version = "3.0.1";
+
+  src = fetchFromGitHub {
+    owner = "jorgebucaran";
+    repo = "fishtape";
+    rev = version;
+    sha256 = "072a3qbk1lpxw53bxp91drsffylx8fbywhss3x0jbnayn9m8i7aa";
+  };
+
+  checkFunctionDirs = [ "./functions" ]; # fishtape is introspective
+  checkPhase = ''
+    fishtape tests/*.fish
+  '';
+
+  meta = with lib; {
+    description = "100% pure-Fish test runner";
+    homepage = "https://github.com/jorgebucaran/fishtape";
+    license = licenses.mit;
+    maintainers = with maintainers; [ pacien ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/fish/plugins/foreign-env/default.nix b/nixpkgs/pkgs/shells/fish/plugins/foreign-env/default.nix
new file mode 100644
index 000000000000..03435340d179
--- /dev/null
+++ b/nixpkgs/pkgs/shells/fish/plugins/foreign-env/default.nix
@@ -0,0 +1,29 @@
+{ lib, buildFishPlugin, fetchFromGitHub, gnused, bash, coreutils }:
+
+buildFishPlugin {
+  pname = "foreign-env";
+  version = "git-20200209";
+
+  src = fetchFromGitHub {
+    owner = "oh-my-fish";
+    repo = "plugin-foreign-env";
+    rev = "dddd9213272a0ab848d474d0cbde12ad034e65bc";
+    sha256 = "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs";
+  };
+
+  patches = [ ./suppress-harmless-warnings.patch ];
+
+  preInstall = ''
+    sed -e "s|sed|${gnused}/bin/sed|" \
+        -e "s|bash|${bash}/bin/bash|" \
+        -e "s|\| tr|\| ${coreutils}/bin/tr|" \
+        -i functions/*
+  '';
+
+  meta = with lib; {
+    description = "A foreign environment interface for Fish shell";
+    license = licenses.mit;
+    maintainers = with maintainers; [ jgillich ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/shells/fish/plugins/foreign-env/suppress-harmless-warnings.patch b/nixpkgs/pkgs/shells/fish/plugins/foreign-env/suppress-harmless-warnings.patch
new file mode 100644
index 000000000000..6eed35152120
--- /dev/null
+++ b/nixpkgs/pkgs/shells/fish/plugins/foreign-env/suppress-harmless-warnings.patch
@@ -0,0 +1,23 @@
+diff --git a/functions/fenv.apply.fish b/functions/fenv.apply.fish
+index 34a25e3..3d94135 100644
+--- a/functions/fenv.apply.fish
++++ b/functions/fenv.apply.fish
+@@ -27,11 +27,17 @@ function fenv.apply
+     for variable in $variables
+         set key (echo $variable | sed 's/=.*//')
+         set value (echo $variable | sed 's/[^=]*=//')
++        set ignore PATH _
+ 
+         if test "$key" = 'PATH'
+           set value (echo $value | tr ':' '\n')
+         end
+ 
+-        set -g -x $key $value
++        if contains $key $ignore
++          set -g -x $key $value 2>/dev/null
++        else
++          set -g -x $key $value
++        end
++
+     end
+ end
diff --git a/nixpkgs/pkgs/shells/fish/plugins/forgit.nix b/nixpkgs/pkgs/shells/fish/plugins/forgit.nix
new file mode 100644
index 000000000000..5fc647c73ee3
--- /dev/null
+++ b/nixpkgs/pkgs/shells/fish/plugins/forgit.nix
@@ -0,0 +1,26 @@
+{ lib, buildFishPlugin, fetchFromGitHub, git, fzf }:
+
+buildFishPlugin rec {
+  pname = "forgit";
+  version = "unstable-2021-04-09";
+
+  preFixup = ''
+    substituteInPlace $out/share/fish/vendor_conf.d/forgit.plugin.fish \
+      --replace "fzf " "${fzf}/bin/fzf " \
+      --replace "git " "${git}/bin/git "
+  '';
+
+  src = fetchFromGitHub {
+    owner = "wfxr";
+    repo = "forgit";
+    rev = "7806fc3ab37ac479c315eb54b164f67ba9ed17ea";
+    sha256 = "sha256-a7wjuqXe3+y5zlgSLk5J31WoORbieFimvtr0FQHRY5M=";
+  };
+
+  meta = with lib; {
+    description = "A utility tool powered by fzf for using git interactively.";
+    homepage = "https://github.com/wfxr/forgit";
+    license = licenses.mit;
+    maintainers = with maintainers; [ happysalada ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/fish/plugins/fzf-fish.nix b/nixpkgs/pkgs/shells/fish/plugins/fzf-fish.nix
new file mode 100644
index 000000000000..51e7dcc096b8
--- /dev/null
+++ b/nixpkgs/pkgs/shells/fish/plugins/fzf-fish.nix
@@ -0,0 +1,34 @@
+{ lib, buildFishPlugin, fetchFromGitHub, fzf, clownfish, fishtape_3 }:
+
+buildFishPlugin rec {
+  pname = "fzf.fish";
+  version = "5.6";
+
+  src = fetchFromGitHub {
+    owner = "PatrickF1";
+    repo = "fzf.fish";
+    rev = "v${version}";
+    sha256 = "1b280n8bh00n4vkm19zrn84km52296ljlm1zhz95jgaiwymf2x73";
+  };
+
+  checkInputs = [ fzf ];
+  checkPlugins = [ clownfish fishtape_3 ];
+  checkFunctionDirs = [ "./functions" ];
+  checkPhase = ''
+    # Disable git tests which inspect the project's git repo, which isn't
+    # possible since we strip the impure .git from our build input
+    rm -r tests/*git*
+
+    # Disable tests that are failing, probably because of our wrappers
+    rm -r tests/search_shell_variables
+
+    fishtape tests/*/*.fish
+  '';
+
+  meta = with lib; {
+    description = "Augment your fish command line with fzf key bindings";
+    homepage = "https://github.com/PatrickF1/fzf.fish";
+    license = licenses.mit;
+    maintainers = with maintainers; [ pacien ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/fish/plugins/pure.nix b/nixpkgs/pkgs/shells/fish/plugins/pure.nix
new file mode 100644
index 000000000000..68da97633c4f
--- /dev/null
+++ b/nixpkgs/pkgs/shells/fish/plugins/pure.nix
@@ -0,0 +1,37 @@
+{ lib, buildFishPlugin, fetchFromGitHub, git, fishtape }:
+
+buildFishPlugin rec {
+  pname = "pure";
+  version = "4.1.1";
+
+  src = fetchFromGitHub {
+    owner = "pure-fish";
+    repo = "pure";
+    rev = "v${version}";
+    sha256 = "1x1h65l8582p7h7w5986sc9vfd7b88a7hsi68dbikm090gz8nlxx";
+  };
+
+  # The tests aren't passing either on the project's CI.
+  # The release notes of the program for v3.5.0 say:
+  # > Tests are going crazy at the moment, should be fixed once fishtape 3.0
+  # > is released, and we do the switch.
+  # This is tracked in https://github.com/pure-fish/pure/issues/272
+  # and https://github.com/pure-fish/pure/pull/275.
+  doCheck = false;
+
+  checkInputs = [ git ];
+  checkPlugins = [ fishtape ];
+  checkPhase = ''
+    # https://github.com/rafaelrinaldi/pure/issues/264
+    rm tests/_pure_string_width.test.fish
+
+    fishtape tests/*.test.fish
+  '';
+
+  meta = {
+    description = "Pretty, minimal and fast Fish prompt, ported from zsh";
+    homepage = "https://github.com/rafaelrinaldi/pure";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ pacien ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/fish/wrapper.nix b/nixpkgs/pkgs/shells/fish/wrapper.nix
new file mode 100644
index 000000000000..6713a69d560e
--- /dev/null
+++ b/nixpkgs/pkgs/shells/fish/wrapper.nix
@@ -0,0 +1,25 @@
+{ lib, writeShellScriptBin, fish }:
+
+with lib;
+
+makeOverridable ({
+  completionDirs ? [],
+  functionDirs ? [],
+  confDirs ? [],
+  pluginPkgs ? []
+}:
+
+let
+  vendorDir = kind: plugin: "${plugin}/share/fish/vendor_${kind}.d";
+  complPath = completionDirs ++ map (vendorDir "completions") pluginPkgs;
+  funcPath = functionDirs ++ map (vendorDir "functions") pluginPkgs;
+  confPath = confDirs ++ map (vendorDir "conf") pluginPkgs;
+
+in writeShellScriptBin "fish" ''
+  ${fish}/bin/fish --init-command "
+    set --prepend fish_complete_path ${escapeShellArgs complPath}
+    set --prepend fish_function_path ${escapeShellArgs funcPath}
+    set --local fish_conf_source_path ${escapeShellArgs confPath}
+    for c in $fish_conf_source_path/*; source $c; end
+  " "$@"
+'')
diff --git a/nixpkgs/pkgs/shells/hilbish/default.nix b/nixpkgs/pkgs/shells/hilbish/default.nix
new file mode 100644
index 000000000000..ddc5b28e5e09
--- /dev/null
+++ b/nixpkgs/pkgs/shells/hilbish/default.nix
@@ -0,0 +1,26 @@
+{ lib, buildGoModule, fetchFromGitHub, readline }:
+
+buildGoModule rec {
+  pname = "hilbish";
+  version = "0.5.1";
+
+  src = fetchFromGitHub {
+    owner = "Rosettea";
+    repo = "Hilbish";
+    rev = "v${version}";
+    sha256 = "sha256-xqGesBNN9lZTYx0kTZfFARq1a/dEC+c3Fo0xLxZuZP4=";
+  };
+
+  vendorSha256 = "sha256-8l+Kb1ADMLwv0Hf/ikok8eUcEEST07rhk8BjHxJI0lc=";
+
+  buildInputs = [ readline ];
+
+  meta = with lib; {
+    description = "An interactive Unix-like shell written in Go";
+    changelog = "https://github.com/Rosettea/Hilbish/releases/tag/v${version}";
+    homepage = "https://github.com/Rosettea/Hilbish";
+    maintainers = with maintainers; [ fortuneteller2k ];
+    license = licenses.mit;
+    platforms = platforms.linux; # only officially supported on Linux
+  };
+}
diff --git a/nixpkgs/pkgs/shells/ion/default.nix b/nixpkgs/pkgs/shells/ion/default.nix
new file mode 100644
index 000000000000..f20c80810a0b
--- /dev/null
+++ b/nixpkgs/pkgs/shells/ion/default.nix
@@ -0,0 +1,33 @@
+{ lib, stdenv, fetchFromGitHub, rustPlatform, Security, libiconv }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "ion";
+  version = "unstable-2021-05-10";
+
+  src = fetchFromGitHub {
+    owner = "redox-os";
+    repo = "ion";
+    rev = "1170b84587bbad260a3ecac8e249a216cb1fd5e9";
+    sha256 = "sha256-lI1GwA3XerRJaC/Z8vTZc6GzRDLjv3w768C+Ui6Q+3Q=";
+  };
+
+  cargoSha256 = "sha256-hURpgxc99iIMtzIlR6Kbfqcbu1uYLDHnfVLqgmMbvFA=";
+
+  meta = with lib; {
+    description = "Modern system shell with simple (and powerful) syntax";
+    homepage = "https://gitlab.redox-os.org/redox-os/ion";
+    license = licenses.mit;
+    maintainers = with maintainers; [ dywedir ];
+  };
+
+  buildInputs = lib.optional stdenv.hostPlatform.isDarwin [
+    Security
+    libiconv
+  ];
+
+  doCheck = !stdenv.hostPlatform.isDarwin;
+
+  passthru = {
+    shellPath = "/bin/ion";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/jush/default.nix b/nixpkgs/pkgs/shells/jush/default.nix
new file mode 100644
index 000000000000..12cd6c935c05
--- /dev/null
+++ b/nixpkgs/pkgs/shells/jush/default.nix
@@ -0,0 +1,27 @@
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, editline }:
+
+stdenv.mkDerivation rec {
+  pname = "jush";
+  version = "0.1";
+
+  src = fetchFromGitHub {
+    owner = "troglobit";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1azvghrh31gawd798a254ml4id642qvbva64zzg30pjszh1087n8";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkg-config ];
+
+  buildInputs = [ editline ];
+
+  passthru.shellPath = "/bin/jush";
+
+  meta = with lib; {
+    description = "just a useless shell";
+    homepage = "https://github.com/troglobit/jush";
+    license = licenses.isc;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ dtzWill ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/ksh/default.nix b/nixpkgs/pkgs/shells/ksh/default.nix
new file mode 100644
index 000000000000..cfd278aaca65
--- /dev/null
+++ b/nixpkgs/pkgs/shells/ksh/default.nix
@@ -0,0 +1,45 @@
+{ lib, stdenv, meson, ninja, fetchFromGitHub, which, python3, fetchpatch
+, libiconv }:
+
+stdenv.mkDerivation rec {
+  pname = "ksh";
+  version = "2020.0.0";
+
+  src = fetchFromGitHub {
+    owner  = "att";
+    repo   = "ast";
+    rev    = version;
+    sha256 = "0cdxz0nhpq03gb9rd76fn0x1yzs2c8q289b7vcxnzlsrz1imz65j";
+  };
+
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/att/ast/commit/11983a71f5e29df578b7e2184400728b4e3f451d.patch";
+      sha256 = "1n9558c4v2qpgpjb1vafs29n3qn3z0770wr1ayc0xjf5z5j4g3kv";
+    })
+  ];
+
+  nativeBuildInputs = [ meson ninja which python3 ];
+
+  buildInputs = [ libiconv ];
+
+  strictDeps = true;
+
+  meta = with lib; {
+    description = "KornShell Command And Programming Language";
+    longDescription = ''
+      The KornShell language was designed and developed by David G. Korn at
+      AT&T Bell Laboratories. It is an interactive command language that
+      provides access to the UNIX system and to many other systems, on the
+      many different computers and workstations on which it is implemented.
+    '';
+    homepage = "https://github.com/att/ast";
+    license = licenses.cpl10;
+    maintainers = with maintainers; [ ];
+    platforms = platforms.all;
+  };
+
+  passthru = {
+    shellPath = "/bin/ksh";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/liquidprompt/default.nix b/nixpkgs/pkgs/shells/liquidprompt/default.nix
new file mode 100644
index 000000000000..c4a9fa141315
--- /dev/null
+++ b/nixpkgs/pkgs/shells/liquidprompt/default.nix
@@ -0,0 +1,32 @@
+{ lib, stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  pname = "liquidprompt";
+  version = "2.0.3";
+
+  src = fetchFromGitHub {
+    owner = "nojhan";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256-BY0/lcBxcfIgKXbXZjiEgVdugmo8vD6UWGsjEVq6j6E=";
+  };
+
+  installPhase = ''
+    install -D -m 0444 liquidprompt $out/bin/liquidprompt
+    install -D -m 0444 liquidpromptrc-dist $out/share/doc/liquidprompt/liquidpromptrc-dist
+    install -D -m 0444 liquid.theme $out/share/doc/liquidprompt/liquid.theme
+
+    install -D -m 0444 liquidprompt.plugin.zsh \
+      $out/share/zsh/plugins/liquidprompt/liquidprompt.plugin.zsh
+    install -D -m 0444 liquidprompt \
+      $out/share/zsh/plugins/liquidprompt/liquidprompt
+  '';
+
+  meta = with lib; {
+    description = "A full-featured & carefully designed adaptive prompt for Bash & Zsh";
+    homepage = "https://github.com/nojhan/liquidprompt";
+    license = licenses.agpl3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ gerschtli ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/mksh/default.nix b/nixpkgs/pkgs/shells/mksh/default.nix
new file mode 100644
index 000000000000..360380e19b34
--- /dev/null
+++ b/nixpkgs/pkgs/shells/mksh/default.nix
@@ -0,0 +1,59 @@
+{ lib
+, stdenv
+, fetchurl
+, installShellFiles
+}:
+
+stdenv.mkDerivation rec {
+  pname = "mksh";
+  version = "59c";
+
+  src = fetchurl {
+    urls = [
+      "https://www.mirbsd.org/MirOS/dist/mir/mksh/${pname}-R${version}.tgz"
+      "http://pub.allbsd.org/MirOS/dist/mir/mksh/${pname}-R${version}.tgz"
+    ];
+    hash = "sha256-d64WZaM38cSMYda5Yds+UhGbOOWIhNHIloSvMfh7xQY=";
+  };
+
+  nativeBuildInputs = [
+    installShellFiles
+  ];
+
+  dontConfigure = true;
+
+  buildPhase = ''
+    runHook preBuild
+    sh ./Build.sh -r
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    runHook preInstall
+    install -D mksh $out/bin/mksh
+    install -D dot.mkshrc $out/share/mksh/mkshrc
+    installManPage mksh.1
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "MirBSD Korn Shell";
+    longDescription = ''
+      The MirBSD Korn Shell is a DFSG-free and OSD-compliant (and OSI
+      approved) successor to pdksh, developed as part of the MirOS
+      Project as native Bourne/POSIX/Korn shell for MirOS BSD, but
+      also to be readily available under other UNIX(R)-like operating
+      systems.
+    '';
+    homepage = "https://www.mirbsd.org/mksh.htm";
+    license = with licenses; [ miros isc unicode-dfs-2016 ];
+    maintainers = with maintainers; [ AndersonTorres joachifm ];
+    platforms = platforms.unix;
+  };
+
+  passthru = {
+    shellPath = "/bin/mksh";
+  };
+}
+# TODO [ AndersonTorres ]: lksh
+# TODO [ AndersonTorres ]: a more accurate licensing info
diff --git a/nixpkgs/pkgs/shells/mrsh/default.nix b/nixpkgs/pkgs/shells/mrsh/default.nix
new file mode 100644
index 000000000000..be87b97ebd72
--- /dev/null
+++ b/nixpkgs/pkgs/shells/mrsh/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv, fetchFromGitHub, meson, ninja, pkg-config, readline }:
+
+stdenv.mkDerivation rec {
+  pname = "mrsh-unstable";
+  version = "2021-01-10";
+
+  src = fetchFromGitHub {
+    owner = "emersion";
+    repo = "mrsh";
+    rev = "9f9884083831ea1f94bdda5151c5df3888932849";
+    sha256 = "0vvdwzw3fq74lwgmy6xxkk01sd68fzhsw84c750lm1dma22xhjci";
+  };
+
+  nativeBuildInputs = [ meson ninja pkg-config ];
+  buildInputs = [ readline ];
+
+  doCheck = true;
+
+  meta = with lib; {
+    description = "A minimal POSIX shell";
+    homepage = "https://mrsh.sh";
+    license = licenses.mit;
+    maintainers = with maintainers; [ matthiasbeyer ];
+    platforms = platforms.unix;
+  };
+
+  passthru = {
+    shellPath = "/bin/mrsh";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/nushell/default.nix b/nixpkgs/pkgs/shells/nushell/default.nix
new file mode 100644
index 000000000000..b7fa5453d87a
--- /dev/null
+++ b/nixpkgs/pkgs/shells/nushell/default.nix
@@ -0,0 +1,64 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, rustPlatform
+, openssl
+, zlib
+, pkg-config
+, python3
+, xorg
+, libiconv
+, AppKit
+, Security
+, nghttp2
+, libgit2
+, withExtraFeatures ? true
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "nushell";
+  version = "0.33.0";
+
+  src = fetchFromGitHub {
+    owner = pname;
+    repo = pname;
+    rev = version;
+    sha256 = "sha256-Asjm3IoAfzphITLQuNh6r/i/pjEM/A+wpCsAB83bu2U=";
+  };
+
+  cargoSha256 = "sha256-Ly59mdUzSI2pIPbckWn1WBz/o2zVzpAzaCDROLdjG7Y=";
+
+  nativeBuildInputs = [ pkg-config ]
+    ++ lib.optionals (withExtraFeatures && stdenv.isLinux) [ python3 ];
+
+  buildInputs = [ openssl ]
+    ++ lib.optionals stdenv.isDarwin [ zlib libiconv Security ]
+    ++ lib.optionals (withExtraFeatures && stdenv.isLinux) [ xorg.libX11 ]
+    ++ lib.optionals (withExtraFeatures && stdenv.isDarwin) [ AppKit nghttp2 libgit2 ];
+
+  cargoBuildFlags = lib.optional withExtraFeatures "--features=extra";
+
+  # TODO investigate why tests are broken on darwin
+  # failures show that tests try to write to paths
+  # outside of TMPDIR
+  doCheck = ! stdenv.isDarwin;
+
+  checkPhase = ''
+    runHook preCheck
+    echo "Running cargo test"
+    HOME=$TMPDIR cargo test
+    runHook postCheck
+  '';
+
+  meta = with lib; {
+    description = "A modern shell written in Rust";
+    homepage = "https://www.nushell.sh/";
+    license = licenses.mit;
+    maintainers = with maintainers; [ Br1ght0ne johntitor marsam ];
+    mainProgram = "nu";
+  };
+
+  passthru = {
+    shellPath = "/bin/nu";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/oh/default.nix b/nixpkgs/pkgs/shells/oh/default.nix
new file mode 100644
index 000000000000..68f34fe8eb17
--- /dev/null
+++ b/nixpkgs/pkgs/shells/oh/default.nix
@@ -0,0 +1,25 @@
+{ buildGoModule, fetchFromGitHub, lib }:
+
+buildGoModule rec {
+  pname = "oh";
+  version = "0.8.0";
+
+  src = fetchFromGitHub {
+    owner = "michaelmacinnis";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0sdpk77i5mfamkdqldybl9znzz92hqgi4xvby5j28m0a5gw46kj0";
+  };
+
+  vendorSha256 = "12vlvh37hvi8c1i9arppm5wj4v9c98s7myxra10q6qpdqssgc8a0";
+
+  meta = with lib; {
+    homepage = "https://github.com/michaelmacinnis/oh";
+    description = "A new Unix shell";
+    license = licenses.mit;
+  };
+
+  passthru = {
+    shellPath = "/bin/oh";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/oil/default.nix b/nixpkgs/pkgs/shells/oil/default.nix
new file mode 100644
index 000000000000..4d66f0d401dc
--- /dev/null
+++ b/nixpkgs/pkgs/shells/oil/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, lib, fetchurl, withReadline ? true, readline }:
+
+stdenv.mkDerivation rec {
+  pname = "oil";
+  version = "0.8.12";
+
+  src = fetchurl {
+    url = "https://www.oilshell.org/download/oil-${version}.tar.xz";
+    sha256 = "sha256-M8JdMru2DDcPWa7qQq9m1NQwjI7kVkHvK5I4W5U1XPU=";
+  };
+
+  postPatch = ''
+    patchShebangs build
+  '';
+
+  preInstall = ''
+    mkdir -p $out/bin
+  '';
+
+  buildInputs = lib.optional withReadline readline;
+  configureFlags = lib.optional withReadline "--with-readline";
+
+  # Stripping breaks the bundles by removing the zip file from the end.
+  dontStrip = true;
+
+  meta = {
+    description = "A new unix shell";
+    homepage = "https://www.oilshell.org/";
+
+    license = with lib.licenses; [
+      psfl # Includes a portion of the python interpreter and standard library
+      asl20 # Licence for Oil itself
+    ];
+
+    maintainers = with lib.maintainers; [ lheckemann alva ];
+    changelog = "https://www.oilshell.org/release/${version}/changelog.html";
+  };
+
+  passthru = {
+    shellPath = "/bin/osh";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/oksh/default.nix b/nixpkgs/pkgs/shells/oksh/default.nix
new file mode 100644
index 000000000000..35bd3a62b62f
--- /dev/null
+++ b/nixpkgs/pkgs/shells/oksh/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, lib, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  pname = "oksh";
+  version = "6.9";
+
+  src = fetchFromGitHub {
+    owner = "ibara";
+    repo = pname;
+    rev = "${pname}-${version}";
+    sha256 = "sha256-b5b6xYqlmjWAT8kTq6YraVLawV/k3ugHZUjXD1LJyhs=";
+  };
+
+  meta = with lib; {
+    description = "Portable OpenBSD ksh, based on the Public Domain Korn Shell (pdksh)";
+    homepage = "https://github.com/ibara/oksh";
+    license = licenses.publicDomain;
+    maintainers = with maintainers; [ siraben ];
+    platforms = platforms.all;
+  };
+
+  passthru = {
+    shellPath = "/bin/oksh";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/pash/default.nix b/nixpkgs/pkgs/shells/pash/default.nix
new file mode 100644
index 000000000000..c7c6e4e5a7d4
--- /dev/null
+++ b/nixpkgs/pkgs/shells/pash/default.nix
@@ -0,0 +1,29 @@
+{ lib, fetchFromGitHub, buildDotnetPackage }:
+
+buildDotnetPackage {
+  baseName = "pash";
+  version = "git-2016-07-06";
+
+  src = fetchFromGitHub {
+    owner = "Pash-Project";
+    repo = "Pash";
+    rev = "8d6a48f5ed70d64f9b49e6849b3ee35b887dc254";
+    sha256 = "0c4wa8qi1zs01p9ck171jkw0n1rsymsrhpsb42gl7warwhpmv59f";
+  };
+
+  preConfigure = "rm -rvf $src/Source/PashConsole/bin/*";
+
+  outputFiles = [ "Source/PashConsole/bin/Release/*" ];
+
+  meta = with lib; {
+    description = "An open source implementation of Windows PowerShell";
+    homepage = "https://github.com/Pash-Project/Pash";
+    maintainers = [ maintainers.fornever maintainers.vrthra ];
+    platforms = platforms.all;
+    license = with licenses; [ bsd3 gpl3 ];
+  };
+
+  passthru = {
+    shellPath = "/bin/pash";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/powershell/default.nix b/nixpkgs/pkgs/shells/powershell/default.nix
new file mode 100644
index 000000000000..135cfb40ff0a
--- /dev/null
+++ b/nixpkgs/pkgs/shells/powershell/default.nix
@@ -0,0 +1,81 @@
+{ stdenv, lib, autoPatchelfHook, fetchzip, libunwind, libuuid, icu, curl
+, darwin, makeWrapper, less, openssl_1_1, pam, lttng-ust }:
+
+let archString = if stdenv.isAarch64 then "arm64"
+                 else if stdenv.isx86_64 then "x64"
+                 else throw "unsupported platform";
+    platformString = if stdenv.isDarwin then "osx"
+                     else if stdenv.isLinux then "linux"
+                     else throw "unsupported platform";
+    platformSha = if stdenv.isDarwin then "0w44ws8b6zfixf7xz93hmplqsx18279n9x8j77y4rbzs13fldvsn"
+                     else if (stdenv.isLinux && stdenv.isx86_64) then "0xm7l49zhkz2fly3d751kjd5cy3ws9zji9i0061lkd06dvkch7jy"
+                     else if (stdenv.isLinux && stdenv.isAarch64) then "1axbi4kmb1ydys7c45jhp729w1srid3c8jgivb4bdmdp56rf6h32"
+                     else throw "unsupported platform";
+    platformLdLibraryPath = if stdenv.isDarwin then "DYLD_FALLBACK_LIBRARY_PATH"
+                     else if stdenv.isLinux then "LD_LIBRARY_PATH"
+                     else throw "unsupported platform";
+                     libraries = [ libunwind libuuid icu curl openssl_1_1 ] ++
+                       (if stdenv.isLinux then [ pam lttng-ust ] else [ darwin.Libsystem ]);
+in
+stdenv.mkDerivation rec {
+  pname = "powershell";
+  version = "7.1.3";
+
+  src = fetchzip {
+    url = "https://github.com/PowerShell/PowerShell/releases/download/v${version}/powershell-${version}-${platformString}-${archString}.tar.gz";
+    sha256 = platformSha;
+    stripRoot = false;
+  };
+
+  buildInputs = [ less ] ++ libraries;
+  nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
+
+  installPhase =
+  let
+    ext = stdenv.hostPlatform.extensions.sharedLibrary;
+  in ''
+    pslibs=$out/share/powershell
+    mkdir -p $pslibs
+
+    cp -r * $pslibs
+
+    rm -f $pslibs/libcrypto${ext}.1.0.0
+    rm -f $pslibs/libssl${ext}.1.0.0
+
+    # At least the 7.1.3-osx package does not have the executable bit set.
+    chmod a+x $pslibs/pwsh
+
+    ls $pslibs
+  '' + lib.optionalString (!stdenv.isDarwin && !stdenv.isAarch64) ''
+    patchelf --replace-needed libcrypto${ext}.1.0.0 libcrypto${ext}.1.1 $pslibs/libmi.so
+    patchelf --replace-needed libssl${ext}.1.0.0 libssl${ext}.1.1 $pslibs/libmi.so
+  '' + ''
+
+    mkdir -p $out/bin
+
+    makeWrapper $pslibs/pwsh $out/bin/pwsh \
+      --prefix ${platformLdLibraryPath} : "${lib.makeLibraryPath libraries}" \
+      --set TERM xterm --set POWERSHELL_TELEMETRY_OPTOUT 1 --set DOTNET_CLI_TELEMETRY_OPTOUT 1
+  '';
+
+  dontStrip = true;
+
+  doInstallCheck = true;
+  installCheckPhase = ''
+    # May need a writable home, seen on Darwin.
+    HOME=$TMP $out/bin/pwsh --help > /dev/null
+  '';
+
+  meta = with lib; {
+    description = "Powerful cross-platform (Windows, Linux, and macOS) shell and scripting language based on .NET";
+    homepage = "https://github.com/PowerShell/PowerShell";
+    maintainers = with maintainers; [ yrashk srgom ];
+    platforms = [ "x86_64-darwin" "x86_64-linux" "aarch64-linux"];
+    license = with licenses; [ mit ];
+  };
+
+  passthru = {
+    shellPath = "/bin/pwsh";
+  };
+
+}
diff --git a/nixpkgs/pkgs/shells/rc/default.nix b/nixpkgs/pkgs/shells/rc/default.nix
new file mode 100644
index 000000000000..af43c42dd4bd
--- /dev/null
+++ b/nixpkgs/pkgs/shells/rc/default.nix
@@ -0,0 +1,42 @@
+{ lib, stdenv, fetchurl, autoreconfHook
+, ncurses #acinclude.m4 wants headers for tgetent().
+, historySupport ? false
+, readline ? null
+}:
+
+stdenv.mkDerivation rec {
+  pname = "rc";
+  version = "1.7.4";
+
+  src = fetchurl {
+    url = "http://static.tobold.org/rc/rc-${version}.tar.gz";
+    sha256 = "1n5zz6d6z4z6s3fwa0pscqqawy561k4xfnmi91i626hcvls67ljy";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ ncurses ]
+    ++ lib.optionals (readline != null) [ readline ];
+
+  configureFlags = [
+    "--enable-def-interp=${stdenv.shell}" #183
+    ] ++ lib.optionals historySupport [ "--with-history" ]
+    ++ lib.optionals (readline != null) [ "--with-edit=readline" ];
+
+  prePatch = ''
+    substituteInPlace configure.ac \
+      --replace "date -I" "echo 2015-05-13" #reproducible-build
+  '';
+
+  passthru = {
+    shellPath = "/bin/rc";
+  };
+
+  meta = with lib; {
+    description = "The Plan 9 shell";
+    longDescription = "Byron Rakitzis' UNIX reimplementation of Tom Duff's Plan 9 shell.";
+    homepage = "http://tobold.org/article/rc";
+    license = with licenses; zlib;
+    maintainers = with maintainers; [ ramkromberg ];
+    platforms = with platforms; all;
+  };
+}
diff --git a/nixpkgs/pkgs/shells/rush/default.nix b/nixpkgs/pkgs/shells/rush/default.nix
new file mode 100644
index 000000000000..bdb8f7ce0952
--- /dev/null
+++ b/nixpkgs/pkgs/shells/rush/default.nix
@@ -0,0 +1,41 @@
+{ fetchurl, lib, stdenv }:
+
+stdenv.mkDerivation rec {
+  pname = "rush";
+  version = "2.1";
+
+  src = fetchurl {
+    url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz";
+    sha256 = "17i4mggr3rnfz0xbhqvd86jqva40c535fhlwkb2l4hjcbpg8blcf";
+  };
+
+  doCheck = true;
+
+  meta = {
+    description = "Restricted User Shell";
+
+    longDescription =
+      '' GNU Rush is a Restricted User Shell, designed for sites
+         providing limited remote access to their resources, such as
+         svn or git repositories, scp, or the like.  Using a
+         sophisticated configuration file, Rush gives you complete
+         control over the command lines that users execute, as well as
+         over the usage of system resources, such as virtual memory,
+         CPU time, etc.
+
+         In particular, it allows remote programs to be run in a chrooted
+         environment, which is important with such programs as
+         sftp-server or scp, that lack this ability.
+      '';
+
+    homepage = "https://www.gnu.org/software/rush/";
+    license = lib.licenses.gpl3Plus;
+
+    maintainers = [ lib.maintainers.bjg ];
+    platforms = lib.platforms.all;
+  };
+
+  passthru = {
+    shellPath = "/bin/rush";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/scponly/default.nix b/nixpkgs/pkgs/shells/scponly/default.nix
new file mode 100644
index 000000000000..c0c39d8e3164
--- /dev/null
+++ b/nixpkgs/pkgs/shells/scponly/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, lib, fetchFromGitHub, openssh, debugLevel ? 0 }:
+
+stdenv.mkDerivation {
+  pname = "scponly";
+  version = "4.8";
+
+  src = fetchFromGitHub {
+    owner = "scponly";
+    repo = "scponly";
+    rev = "d8ca58257b9905186aa5706f35813d5f80ea07c1";
+    sha256 = "U0K7lOp18ytNjh3KVFmc6vL+/tG4ETnwLEPQEhM4lXE=";
+  };
+
+  patches = [ ./scponly-fix-make.patch ];
+
+  buildInputs = [ openssh ];
+
+  # Add path to sftp-server so configure finds it
+  preConfigure = "export PATH=$PATH:${openssh}/libexec";
+
+  # chroot doesn't seem to work, so not enabling
+  # rsync could also be optionally enabled
+  configureFlags = [ "--enable-winscp-compat" ];
+
+  postInstall = lib.optionalString (debugLevel > 0) ''
+    mkdir -p $out/etc/scponly && echo ${
+      toString debugLevel
+    } > $out/etc/scponly/debuglevel
+  '';
+
+  passthru.shellPath = "/bin/scponly";
+
+  meta = with lib; {
+    description = "A shell that only permits scp and sftp-server";
+    homepage = "https://github.com/scponly/scponly";
+    license = with licenses; [ bsd2 ];
+    maintainers = with maintainers; [ wmertens ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/scponly/scponly-fix-make.patch b/nixpkgs/pkgs/shells/scponly/scponly-fix-make.patch
new file mode 100644
index 000000000000..e8522ec8e6e3
--- /dev/null
+++ b/nixpkgs/pkgs/shells/scponly/scponly-fix-make.patch
@@ -0,0 +1,21 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -41,14 +41,14 @@
+ 	${INSTALL} -d ${DESTDIR}${bindir}
+ 	${INSTALL} -d ${DESTDIR}${mandir}/man8
+ 	${INSTALL} -d ${DESTDIR}${CONFDIR}
+-	${INSTALL} -o 0 -g 0 scponly ${DESTDIR}${bindir}/scponly
+-	${INSTALL} -o 0 -g 0 -m 0644 scponly.8 ${DESTDIR}${mandir}/man8/scponly.8
+-	${INSTALL} -o 0 -g 0 -m 0644 debuglevel ${DESTDIR}${DEBUGFILE}
++	${INSTALL} scponly ${DESTDIR}${bindir}/scponly
++	${INSTALL} -m 0644 scponly.8 ${DESTDIR}${mandir}/man8/scponly.8
++	${INSTALL} -m 0644 debuglevel ${DESTDIR}${DEBUGFILE}
+ 	if test "x${CHROOTED_NAME}" != "x"; then			\
+ 		${INSTALL} -d ${DESTDIR}${sbindir};				\
+ 		rm -f ${DESTDIR}${sbindir}/${CHROOTED_NAME};			\
+ 		cp scponly ${CHROOTED_NAME};				\
+-		${INSTALL} -o 0 -g 0 -m 4755 ${CHROOTED_NAME} ${DESTDIR}${sbindir}/${CHROOTED_NAME};	\
++		${INSTALL} ${CHROOTED_NAME} ${DESTDIR}${sbindir}/${CHROOTED_NAME};	\
+ 	fi
+ 
+ debuglevel:
diff --git a/nixpkgs/pkgs/shells/tcsh/default.nix b/nixpkgs/pkgs/shells/tcsh/default.nix
new file mode 100644
index 000000000000..4d6c9556501c
--- /dev/null
+++ b/nixpkgs/pkgs/shells/tcsh/default.nix
@@ -0,0 +1,53 @@
+{ lib, stdenv, fetchurl, fetchpatch
+, ncurses
+}:
+
+stdenv.mkDerivation rec {
+  pname = "tcsh";
+  version = "6.22.03";
+
+  src = fetchurl {
+    urls = [
+      "http://ftp.funet.fi/pub/mirrors/ftp.astron.com/pub/tcsh/${pname}-${version}.tar.gz"
+      "http://ftp.funet.fi/pub/mirrors/ftp.astron.com/pub/tcsh/old/${pname}-${version}.tar.gz"
+      "ftp://ftp.astron.com/pub/tcsh/${pname}-${version}.tar.gz"
+      "ftp://ftp.astron.com/pub/tcsh/old/${pname}-${version}.tar.gz"
+      "ftp://ftp.funet.fi/pub/unix/shells/tcsh/${pname}-${version}.tar.gz"
+      "ftp://ftp.funet.fi/pub/unix/shells/tcsh/old/${pname}-${version}.tar.gz"
+    ];
+    sha256 = "sha256-viz9ZT0qDH9QbS3RTBIyS6dJvUhAN75t9Eo5c/UiYrc=";
+  };
+
+  buildInputs = [ ncurses ];
+
+  patches = lib.optional stdenv.hostPlatform.isMusl
+    (fetchpatch {
+      name = "sysmalloc.patch";
+      url = "https://git.alpinelinux.org/aports/plain/community/tcsh/001-sysmalloc.patch?id=184585c046cdd56512f1a76e426dd799b368f8cf";
+      sha256 = "1qc6ydxhdfizsbkaxhpn3wib8sfphrw10xnnsxx2prvzg9g2zp67";
+    });
+
+  meta = with lib; {
+    description = "An enhanced version of the Berkeley UNIX C shell (csh)";
+    longDescription = ''
+      tcsh is an enhanced but completely compatible version of the
+      Berkeley UNIX C shell, csh. It is a command language interpreter
+      usable both as an interactive login shell and a shell script
+      command processor.
+      It includes:
+      - command-line editor
+      - programmable word completion
+      - spelling correction
+      - history mechanism
+      - job control
+    '';
+    homepage = "https://www.tcsh.org/";
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ AndersonTorres ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+
+  passthru = {
+    shellPath = "/bin/tcsh";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/xonsh/default.nix b/nixpkgs/pkgs/shells/xonsh/default.nix
new file mode 100644
index 000000000000..a2cc4206620e
--- /dev/null
+++ b/nixpkgs/pkgs/shells/xonsh/default.nix
@@ -0,0 +1,58 @@
+{ lib, stdenv
+, fetchFromGitHub
+, python3Packages
+, glibcLocales
+, coreutils
+, git
+}:
+
+python3Packages.buildPythonApplication rec {
+  pname = "xonsh";
+  version = "0.9.27";
+
+  # fetch from github because the pypi package ships incomplete tests
+  src = fetchFromGitHub {
+    owner  = "xonsh";
+    repo   = "xonsh";
+    rev    = version;
+    sha256 = "09w6bl3qsygfs2ph2r423ndnbd74bzf67vp8587h2dkkfxlzjbad";
+  };
+
+  LC_ALL = "en_US.UTF-8";
+
+  postPatch = ''
+    sed -ie "s|/bin/ls|${coreutils}/bin/ls|" tests/test_execer.py
+    sed -ie "s|SHELL=xonsh|SHELL=$out/bin/xonsh|" tests/test_integrations.py
+
+    sed -ie 's|/usr/bin/env|${coreutils}/bin/env|' tests/test_integrations.py
+    sed -ie 's|/usr/bin/env|${coreutils}/bin/env|' scripts/xon.sh
+    find scripts -name 'xonsh*' -exec sed -i -e "s|env -S|env|" {} \;
+    find -name "*.xsh" | xargs sed -ie 's|/usr/bin/env|${coreutils}/bin/env|'
+    patchShebangs .
+  '';
+
+  doCheck = !stdenv.isDarwin;
+
+  checkPhase = ''
+    HOME=$TMPDIR pytest -k 'not test_repath_backslash and not test_os and not test_man_completion and not test_builtins and not test_main and not test_ptk_highlight and not test_pyghooks and not test_command_pipeline_capture and not test_git_dirty_working_directory_includes_untracked and not test_dirty_working_directory and not test_vc_get_branch'
+    HOME=$TMPDIR pytest -k 'test_builtins or test_main' --reruns 5
+    HOME=$TMPDIR pytest -k 'test_ptk_highlight'
+  '';
+
+  checkInputs = [ python3Packages.pytest python3Packages.pytest-rerunfailures glibcLocales git ];
+
+  propagatedBuildInputs = with python3Packages; [ ply prompt_toolkit pygments ];
+
+  meta = with lib; {
+    description = "A Python-ish, BASHwards-compatible shell";
+    homepage = "https://xon.sh/";
+    changelog = "https://github.com/xonsh/xonsh/raw/${version}/CHANGELOG.rst";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ spwhitt vrthra ];
+    platforms = platforms.all;
+  };
+
+  passthru = {
+    shellPath = "/bin/xonsh";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/antibody/default.nix b/nixpkgs/pkgs/shells/zsh/antibody/default.nix
new file mode 100644
index 000000000000..d5c197d5da6e
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/antibody/default.nix
@@ -0,0 +1,26 @@
+{ lib, buildGoModule, fetchFromGitHub }:
+
+buildGoModule rec {
+  pname = "antibody";
+  version = "6.1.1";
+
+  src = fetchFromGitHub {
+    owner = "getantibody";
+    repo = "antibody";
+    rev = "v${version}";
+    sha256 = "0icag53svzdm7yvzp855fp0f7q0g0jkfmjaa1sj6mmb01c1xgzi1";
+  };
+
+  vendorSha256 = "0z8fma3v2dph8nv3q4lmv43s6p5sc338xb7kcmnpwcc0iw7b4vyj";
+
+  doCheck = false;
+
+  buildFlagsArray = [ "-ldflags=-s -w -X main.version=${version}" ];
+
+  meta = with lib; {
+    description = "The fastest shell plugin manager";
+    homepage = "https://github.com/getantibody/antibody";
+    license = licenses.mit;
+    maintainers = with maintainers; [ Br1ght0ne ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/antigen/default.nix b/nixpkgs/pkgs/shells/zsh/antigen/default.nix
new file mode 100644
index 000000000000..935939f90e60
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/antigen/default.nix
@@ -0,0 +1,25 @@
+{ lib, stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  version = "2.2.3";
+  pname = "antigen";
+
+  src = fetchurl {
+    url = "https://github.com/zsh-users/antigen/releases/download/v${version}/antigen.zsh";
+    sha256 = "1bmp3qf14509swpxin4j9f98n05pdilzapjm0jdzbv0dy3hn20ix";
+  };
+
+  dontUnpack = true;
+
+  installPhase = ''
+    outdir=$out/share/antigen
+    mkdir -p $outdir
+    cp $src $outdir/antigen.zsh
+  '';
+
+  meta = {
+    description = "The plugin manager for zsh";
+    homepage = "http://antigen.sharats.me";
+    license = lib.licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/default.nix b/nixpkgs/pkgs/shells/zsh/default.nix
new file mode 100644
index 000000000000..71f526525e4f
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/default.nix
@@ -0,0 +1,93 @@
+{ lib, stdenv, fetchurl, ncurses, pcre, buildPackages }:
+
+let
+  version = "5.8";
+
+  documentation = fetchurl {
+    url = "mirror://sourceforge/zsh/zsh-${version}-doc.tar.xz";
+    sha256 = "1i6wdzq6rfjx5yjrpzan1jf50hk2pfzy5qib9mb7cnnbjfar6klv";
+  };
+in
+
+stdenv.mkDerivation {
+  pname = "zsh";
+  inherit version;
+
+  src = fetchurl {
+    url = "mirror://sourceforge/zsh/zsh-${version}.tar.xz";
+    sha256 = "09yyaadq738zlrnlh1hd3ycj1mv3q5hh4xl1ank70mjnqm6bbi6w";
+  };
+
+  buildInputs = [ ncurses pcre ];
+
+  configureFlags = [
+    "--enable-maildir-support"
+    "--enable-multibyte"
+    "--with-tcsetpgrp"
+    "--enable-pcre"
+    "--enable-zprofile=${placeholder "out"}/etc/zprofile"
+    "--disable-site-fndir"
+  ];
+
+  # the zsh/zpty module is not available on hydra
+  # so skip groups Y Z
+  checkFlags = map (T: "TESTNUM=${T}") (lib.stringToCharacters "ABCDEVW");
+
+  # XXX: think/discuss about this, also with respect to nixos vs nix-on-X
+  postInstall = ''
+    mkdir -p $out/share/info
+    tar xf ${documentation} -C $out/share
+    ln -s $out/share/zsh-*/Doc/zsh.info* $out/share/info/
+
+    mkdir -p $out/etc/
+    cat > $out/etc/zprofile <<EOF
+if test -e /etc/NIXOS; then
+  if test -r /etc/zprofile; then
+    . /etc/zprofile
+  else
+    emulate bash
+    alias shopt=false
+    . /etc/profile
+    unalias shopt
+    emulate zsh
+  fi
+  if test -r /etc/zprofile.local; then
+    . /etc/zprofile.local
+  fi
+else
+  # on non-nixos we just source the global /etc/zprofile as if we did
+  # not use the configure flag
+  if test -r /etc/zprofile; then
+    . /etc/zprofile
+  fi
+fi
+EOF
+    ${if stdenv.hostPlatform == stdenv.buildPlatform then ''
+      $out/bin/zsh -c "zcompile $out/etc/zprofile"
+    '' else ''
+      ${lib.getBin buildPackages.zsh}/bin/zsh -c "zcompile $out/etc/zprofile"
+    ''}
+    mv $out/etc/zprofile $out/etc/zprofile_zwc_is_used
+  '';
+  # XXX: patch zsh to take zwc if newer _or equal_
+
+  meta = {
+    description = "The Z shell";
+    longDescription = ''
+      Zsh is a UNIX command interpreter (shell) usable as an interactive login
+      shell and as a shell script command processor.  Of the standard shells,
+      zsh most closely resembles ksh but includes many enhancements.  Zsh has
+      command line editing, builtin spelling correction, programmable command
+      completion, shell functions (with autoloading), a history mechanism, and
+      a host of other features.
+    '';
+    license = "MIT-like";
+    homepage = "https://www.zsh.org/";
+    maintainers = with lib.maintainers; [ pSub ];
+    platforms = lib.platforms.unix;
+  };
+
+  passthru = {
+    shellPath = "/bin/zsh";
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/fzf-zsh/default.nix b/nixpkgs/pkgs/shells/zsh/fzf-zsh/default.nix
new file mode 100644
index 000000000000..ac5cab94d4cb
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/fzf-zsh/default.nix
@@ -0,0 +1,37 @@
+{ lib, stdenv, fetchFromGitHub, fzf }:
+
+stdenv.mkDerivation rec {
+  pname = "fzf-zsh-unstable";
+  version = "2019-09-09";
+
+  src = fetchFromGitHub {
+    owner = "Wyntau";
+    repo = "fzf-zsh";
+    rev = "829d7e40cc437dce8a6e234e259bbd4065e87124";
+    sha256 = "1irjmxhcg1fm4g8p3psjqk7sz5qhj5kw73pyhv91njvpdhn9l26z";
+  };
+
+  postPatch = ''
+    substituteInPlace fzf-zsh.plugin.zsh \
+      --replace \
+        'fzf_path="$( cd "$fzf_zsh_path/../fzf/" && pwd )"' \
+        "fzf_path=${fzf}" \
+      --replace \
+        '$fzf_path/shell' \
+        '${fzf}/share/fzf'
+  '';
+
+  dontBuild = true;
+
+  installPhase = ''
+    install -Dm0644 fzf-zsh.plugin.zsh $out/share/zsh/plugins/fzf-zsh/fzf-zsh.plugin.zsh
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/wyntau/fzf-zsh";
+    description = "wrap fzf to use in oh-my-zsh";
+    license = licenses.mit;
+    maintainers = with maintainers; [ ma27 ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/gradle-completion/default.nix b/nixpkgs/pkgs/shells/zsh/gradle-completion/default.nix
new file mode 100644
index 000000000000..bf5969d1300a
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/gradle-completion/default.nix
@@ -0,0 +1,35 @@
+{ lib, stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  pname = "gradle-completion";
+  version = "1.4.1";
+
+  src = fetchFromGitHub {
+    owner = "gradle";
+    repo = "gradle-completion";
+    rev = "v${version}";
+    sha256 = "15b0692i3h8h7b95465b2aw9qf5qjmjag5n62347l8yl7zbhv3l2";
+  };
+
+  # we just move two files into $out,
+  # this shouldn't bother Hydra.
+  preferLocalBuild = true;
+
+  dontBuild = true;
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out
+    install -Dm0644 ./_gradle $out/share/zsh/site-functions/_gradle
+    install -Dm0644 ./gradle-completion.bash $out/share/bash-completion/completions/gradle
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "Gradle tab completion for bash and zsh";
+    homepage = "https://github.com/gradle/gradle-completion";
+    license = licenses.mit;
+    maintainers = with maintainers; [ ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/grml-zsh-config/default.nix b/nixpkgs/pkgs/shells/zsh/grml-zsh-config/default.nix
new file mode 100644
index 000000000000..6196658723f6
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/grml-zsh-config/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, lib, txt2tags }:
+
+stdenv.mkDerivation rec {
+  pname = "grml-zsh-config";
+  version = "0.19.0";
+
+  src = fetchFromGitHub {
+    owner = "grml";
+    repo = "grml-etc-core";
+    rev = "v${version}";
+    sha256 = "sha256-Vn8NzpvJ1W/+UUuhr1plLqskVBUOFJHvy+hxKE3DmIs=";
+  };
+
+  nativeBuildInputs = [ txt2tags ];
+
+  buildPhase = ''
+    cd doc
+    make
+    cd ..
+  '';
+
+  installPhase = ''
+    install -D -m644 etc/zsh/keephack $out/etc/zsh/keephack
+    install -D -m644 etc/zsh/zshrc $out/etc/zsh/zshrc
+
+    install -D -m644 doc/grmlzshrc.5 $out/share/man/man5/grmlzshrc.5
+    ln -s grmlzshrc.5.gz $out/share/man/man5/grml-zsh-config.5.gz
+  '';
+
+  meta = with lib; {
+    description = "grml's zsh setup";
+    homepage = "https://grml.org/zsh/";
+    license = licenses.gpl2;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ msteen rvolosatovs ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/lambda-mod-zsh-theme/default.nix b/nixpkgs/pkgs/shells/zsh/lambda-mod-zsh-theme/default.nix
new file mode 100644
index 000000000000..e8d00d73d1aa
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/lambda-mod-zsh-theme/default.nix
@@ -0,0 +1,25 @@
+{ lib, stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation {
+  pname = "lambda-mod-zsh-theme-unstable";
+  version = "2020-10-03";
+
+  src = fetchFromGitHub {
+    owner = "halfo";
+    repo = "lambda-mod-zsh-theme";
+    rev = "78347ea9709935f265e558b6345919d12323fbff";
+    sha256 = "0fvxnvgbcvwii7ghvpj5l43frllq71wwjvfg7cqfmic727z001dh";
+  };
+
+  installPhase = ''
+    install -Dm0644 lambda-mod.zsh-theme $out/share/zsh/themes/lambda-mod.zsh-theme
+  '';
+
+  meta = with lib; {
+    description = "A ZSH theme optimized for people who use Git & Unicode-compatible fonts and terminals";
+    homepage = "https://github.com/halfo/lambda-mod-zsh-theme/";
+    license = licenses.mit;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ ma27 ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/nix-zsh-completions/default.nix b/nixpkgs/pkgs/shells/zsh/nix-zsh-completions/default.nix
new file mode 100644
index 000000000000..f60bb966003f
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/nix-zsh-completions/default.nix
@@ -0,0 +1,27 @@
+{ lib, stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  pname = "nix-zsh-completions";
+  version = "0.4.4";
+
+  src = fetchFromGitHub {
+    owner = "spwhitt";
+    repo = "nix-zsh-completions";
+    rev = version;
+    sha256 = "1n9whlys95k4wc57cnz3n07p7zpkv796qkmn68a50ygkx6h3afqf";
+  };
+
+  installPhase = ''
+    mkdir -p $out/share/zsh/{site-functions,plugins/nix}
+    cp _* $out/share/zsh/site-functions
+    cp *.zsh $out/share/zsh/plugins/nix
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/spwhitt/nix-zsh-completions";
+    description = "ZSH completions for Nix, NixOS, and NixOps";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ spwhitt olejorgenb hedning ma27 ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix b/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix
new file mode 100644
index 000000000000..23c783246e91
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix
@@ -0,0 +1,124 @@
+# This script was inspired by the ArchLinux User Repository package:
+#
+#   https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=oh-my-zsh-git
+{ lib, stdenv, fetchFromGitHub, nixosTests, writeScript, common-updater-scripts
+, git, nix, nixfmt, jq, coreutils, gnused, curl, cacert }:
+
+stdenv.mkDerivation rec {
+  version = "2021-04-26";
+  pname = "oh-my-zsh";
+  rev = "63a7422d8dd5eb93c849df0ab9e679e6f333818a";
+
+  src = fetchFromGitHub {
+    inherit rev;
+    owner = "ohmyzsh";
+    repo = "ohmyzsh";
+    sha256 = "1spi6y5jmha0bf1s69mycpmksxjniqmcnvkvmza4rhji8v8b120w";
+  };
+
+  installPhase = ''
+    runHook preInstall
+
+    outdir=$out/share/oh-my-zsh
+    template=templates/zshrc.zsh-template
+
+    mkdir -p $outdir
+    cp -r * $outdir
+    cd $outdir
+
+    rm LICENSE.txt
+    rm -rf .git*
+
+    chmod -R +w templates
+
+    # Change the path to oh-my-zsh dir and disable auto-updating.
+    sed -i -e "s#ZSH=\$HOME/.oh-my-zsh#ZSH=$outdir#" \
+           -e 's/\# \(DISABLE_AUTO_UPDATE="true"\)/\1/' \
+     $template
+
+    chmod +w oh-my-zsh.sh
+
+    # Both functions expect oh-my-zsh to be in ~/.oh-my-zsh and try to
+    # modify the directory.
+    cat >> oh-my-zsh.sh <<- EOF
+
+    # Undefine functions that don't work on Nix.
+    unfunction uninstall_oh_my_zsh
+    unfunction upgrade_oh_my_zsh
+    EOF
+
+    # Look for .zsh_variables, .zsh_aliases, and .zsh_funcs, and source
+    # them, if found.
+    cat >> $template <<- EOF
+
+    # Load the variables.
+    if [ -f ~/.zsh_variables ]; then
+        . ~/.zsh_variables
+    fi
+
+    # Load the functions.
+    if [ -f ~/.zsh_funcs ]; then
+      . ~/.zsh_funcs
+    fi
+
+    # Load the aliases.
+    if [ -f ~/.zsh_aliases ]; then
+        . ~/.zsh_aliases
+    fi
+    EOF
+
+    runHook postInstall
+  '';
+
+  passthru = {
+    tests = { inherit (nixosTests) oh-my-zsh; };
+
+    updateScript = writeScript "update.sh" ''
+      #!${stdenv.shell}
+      set -o errexit
+      PATH=${
+        lib.makeBinPath [
+          common-updater-scripts
+          curl
+          cacert
+          git
+          nixfmt
+          nix
+          jq
+          coreutils
+          gnused
+        ]
+      }
+
+      oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion oh-my-zsh" | tr -d '"')"
+      latestSha="$(curl -L -s https://api.github.com/repos/ohmyzsh/ohmyzsh/commits\?sha\=master\&since\=$oldVersion | jq -r '.[0].sha')"
+
+      if [ ! "null" = "$latestSha" ]; then
+        nixpkgs="$(git rev-parse --show-toplevel)"
+        default_nix="$nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix"
+        latestDate="$(curl -L -s https://api.github.com/repos/ohmyzsh/ohmyzsh/commits/$latestSha | jq '.commit.committer.date' | sed 's|"\(.*\)T.*|\1|g')"
+        update-source-version oh-my-zsh "$latestSha" --version-key=rev
+        update-source-version oh-my-zsh "$latestDate" --ignore-same-hash
+        nixfmt "$default_nix"
+      else
+        echo "${pname} is already up-to-date"
+      fi
+    '';
+  };
+
+  meta = with lib; {
+    description = "A framework for managing your zsh configuration";
+    longDescription = ''
+      Oh My Zsh is a framework for managing your zsh configuration.
+
+      To copy the Oh My Zsh configuration file to your home directory, run
+      the following command:
+
+        $ cp -v $(nix-env -q --out-path oh-my-zsh | cut -d' ' -f3)/share/oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
+    '';
+    homepage = "https://ohmyz.sh/";
+    license = licenses.mit;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ nequissimus ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/pure-prompt/default.nix b/nixpkgs/pkgs/shells/zsh/pure-prompt/default.nix
new file mode 100644
index 000000000000..0ba449870b83
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/pure-prompt/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv, fetchFromGitHub }:
+
+with lib;
+
+stdenv.mkDerivation rec {
+  pname = "pure-prompt";
+  version = "1.17.0";
+
+  src = fetchFromGitHub {
+    owner = "sindresorhus";
+    repo = "pure";
+    rev = "v${version}";
+    sha256 = "sha256-6j6QZtsA5ZgfXthYjXRrND2zAJwZx0/6WRI1f3c+2mE=";
+  };
+
+  installPhase = ''
+    OUTDIR="$out/share/zsh/site-functions"
+    mkdir -p "$OUTDIR"
+    cp pure.zsh "$OUTDIR/prompt_pure_setup"
+    cp async.zsh "$OUTDIR/async"
+  '';
+
+  meta = {
+    description = "Pretty, minimal and fast ZSH prompt";
+    homepage = "https://github.com/sindresorhus/pure";
+    license = licenses.mit;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ pacien pablovsky ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/spaceship-prompt/default.nix b/nixpkgs/pkgs/shells/zsh/spaceship-prompt/default.nix
new file mode 100644
index 000000000000..e5725a78fc54
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/spaceship-prompt/default.nix
@@ -0,0 +1,38 @@
+{ lib, stdenvNoCC, fetchFromGitHub }:
+
+stdenvNoCC.mkDerivation rec {
+  pname = "spaceship-prompt";
+  version = "3.12.6";
+
+  src = fetchFromGitHub {
+    owner = "denysdovhan";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256-tKFah8b62wuw5vaNHddmj31UNd9kKCcQ99p8GlTnR6s=";
+  };
+
+  dontBuild = true;
+
+  installPhase = ''
+    install -Dm644 LICENSE.md "$out/share/licenses/spaceship-prompt/LICENSE"
+    install -Dm644 README.md "$out/share/doc/spaceship-prompt/README.md"
+    find docs -type f -exec install -Dm644 {} "$out/share/doc/spaceship-prompt/{}" \;
+    find lib -type f -exec install -Dm644 {} "$out/lib/spaceship-prompt/{}" \;
+    find scripts -type f -exec install -Dm644 {} "$out/lib/spaceship-prompt/{}" \;
+    find sections -type f -exec install -Dm644 {} "$out/lib/spaceship-prompt/{}" \;
+    install -Dm644 spaceship.zsh "$out/lib/spaceship-prompt/spaceship.zsh"
+    install -d "$out/share/zsh/themes/"
+    ln -s "$out/lib/spaceship-prompt/spaceship.zsh" "$out/share/zsh/themes/spaceship.zsh-theme"
+    install -d "$out/share/zsh/site-functions/"
+    ln -s "$out/lib/spaceship-prompt/spaceship.zsh" "$out/share/zsh/site-functions/prompt_spaceship_setup"
+  '';
+
+  meta = with lib; {
+    description = "Zsh prompt for Astronauts";
+    homepage = "https://github.com/denysdovhan/spaceship-prompt/";
+    changelog = "https://github.com/spaceship-prompt/spaceship-prompt/releases/tag/v${version}";
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ nyanloutre fortuneteller2k ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zinit/default.nix b/nixpkgs/pkgs/shells/zsh/zinit/default.nix
new file mode 100644
index 000000000000..d59f50ce3b9c
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zinit/default.nix
@@ -0,0 +1,42 @@
+{ stdenvNoCC, lib, fetchFromGitHub, installShellFiles }:
+
+stdenvNoCC.mkDerivation rec {
+  pname = "zinit";
+  version = "3.7";
+  src = fetchFromGitHub {
+    owner = "zdharma";
+    repo = pname;
+    rev = "v${version}";
+    hash = "sha256-B+cTGz+U8MR22l6xXdRAAjDr+ulCk+CJ9GllFMK0axE=";
+  };
+  # adapted from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=zsh-zplugin-git
+  dontBuild = true;
+  nativeBuildInputs = [ installShellFiles ];
+  installPhase = ''
+    outdir="$out/share/$pname"
+
+    cd "$src"
+
+    # Zplugin's source files
+    install -dm0755 "$outdir"
+    # Installing also backward compatibility layer
+    install -m0644 z{plugin,init}{,-side,-install,-autoload}.zsh "$outdir"
+    install -m0755 git-process-output.zsh "$outdir"
+
+    # Zplugin autocompletion
+    installShellCompletion --zsh _zinit
+
+    #TODO:Zplugin-module files
+    # find zmodules/ -type d -exec install -dm 755 "{}" "$outdir/{}" \;
+    # find zmodules/ -type f -exec install -m 744 "{}" "$outdir/{}" \;
+
+  '';
+  #TODO:doc output
+
+  meta = with lib; {
+    homepage = "https://github.com/zdharma/zinit";
+    description = "Flexible zsh plugin manager";
+    license = licenses.mit;
+    maintainers = with maintainers; [ pasqui23 ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zplug/default.nix b/nixpkgs/pkgs/shells/zsh/zplug/default.nix
new file mode 100644
index 000000000000..d35eb345dda9
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zplug/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, lib, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  pname = "zplug";
+  version = "2.4.2";
+
+  src = fetchFromGitHub {
+    owner = "zplug";
+    repo = pname;
+    rev = version;
+    sha256 = "0hci1pbs3k5icwfyfw5pzcgigbh9vavprxxvakg1xm19n8zb61b3";
+  };
+
+  dontConfigure = true;
+  dontBuild = true;
+  dontPatch = true;
+
+  installPhase = ''
+    mkdir -p $out
+    cp -r $src/* $out/
+  '';
+
+  meta = with lib; {
+    description = "A next-generation plugin manager for zsh";
+    homepage = "https://github.com/zplug/zplug";
+    license = licenses.mit;
+    platforms = platforms.all;
+    maintainers = [ maintainers.s1341 ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-autopair/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-autopair/default.nix
new file mode 100644
index 000000000000..0cc1535e53ae
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-autopair/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, lib, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  pname = "zsh-autopair";
+  version = "1.0";
+
+  src = fetchFromGitHub {
+    owner = "hlissner";
+    repo = "zsh-autopair";
+    rev = "v${version}";
+    sha256 = "1h0vm2dgrmb8i2pvsgis3lshc5b0ad846836m62y8h3rdb3zmpy1";
+  };
+
+  installPhase = ''
+    install -D autopair.zsh $out/share/zsh/${pname}/autopair.zsh
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/hlissner/zsh-autopair";
+    description = "A plugin that auto-closes, deletes and skips over matching delimiters in zsh intelligently";
+    license = licenses.mit;
+    maintainers = with maintainers; [ _0qq ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-autosuggestions/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-autosuggestions/default.nix
new file mode 100644
index 000000000000..211fde7b0f15
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-autosuggestions/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv, fetchFromGitHub, zsh }:
+
+# To make use of this derivation, use the `programs.zsh.autosuggestions.enable` option
+
+stdenv.mkDerivation rec {
+  pname = "zsh-autosuggestions";
+  version = "0.7.0";
+
+  src = fetchFromGitHub {
+    owner = "zsh-users";
+    repo = "zsh-autosuggestions";
+    rev = "v${version}";
+    sha256 = "1g3pij5qn2j7v7jjac2a63lxd97mcsgw6xq6k5p7835q9fjiid98";
+  };
+
+  nativeBuildInputs = [ zsh ];
+
+  installPhase = ''
+    install -D zsh-autosuggestions.zsh \
+      $out/share/zsh-autosuggestions/zsh-autosuggestions.zsh
+    '';
+
+  meta = with 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/nixpkgs/pkgs/shells/zsh/zsh-bd/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-bd/default.nix
new file mode 100644
index 000000000000..f2c2dc90fb4e
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-bd/default.nix
@@ -0,0 +1,31 @@
+{ lib, stdenv, fetchFromGitHub}:
+
+stdenv.mkDerivation rec {
+  pname = "zsh-bd";
+  version = "2018-07-04";
+
+  src = fetchFromGitHub {
+    owner = "Tarrasch";
+    repo = pname;
+    rev = "d4a55e661b4c9ef6ae4568c6abeff48bdf1b1af7";
+    sha256 = "020f8nq86g96cps64hwrskppbh2dapfw2m9np1qbs5pgh16z4fcb";
+  };
+
+  dontBuild = true;
+
+  installPhase = ''
+    mkdir -p $out/share/zsh-bd
+    cp {.,$out/share/zsh-bd}/bd.zsh
+    cd $out/share/zsh-bd
+    ln -s bd{,.plugin}.zsh
+  '';
+
+  meta = {
+    description = "Jump back to a specific directory, without doing `cd ../../..` ";
+    homepage = "https://github.com/Tarrasch/zsh-bd";
+    license = lib.licenses.free;
+
+    platforms = lib.platforms.unix;
+    maintainers = [ lib.maintainers.olejorgenb ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-clipboard/clipboard.plugin.zsh b/nixpkgs/pkgs/shells/zsh/zsh-clipboard/clipboard.plugin.zsh
new file mode 100644
index 000000000000..f1f190ec70c3
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-clipboard/clipboard.plugin.zsh
@@ -0,0 +1,40 @@
+_cb-yank() {
+  AA=$(clippaste 2>/dev/null) && CUTBUFFER="$AA"
+  zle yank
+}
+_cb-kill-line() {
+  zle kill-line
+  printf "%s" "$CUTBUFFER" | clipcopy 2>/dev/null
+}
+_cb-kill-whole-line() {
+  zle kill-whole-line
+  printf "%s" "$CUTBUFFER" | clipcopy 2>/dev/null
+}
+_cb-kill-word() {
+  zle kill-word
+  printf "%s" "$CUTBUFFER" | clipcopy 2>/dev/null
+}
+_cb-backward-kill-word() {
+  zle backward-kill-word
+  printf "%s" "$CUTBUFFER" | clipcopy 2>/dev/null
+}
+_cb-copy-region-as-kill() {
+  ## https://unix.stackexchange.com/questions/19947/
+  zle copy-region-as-kill
+  zle set-mark-command -n -1
+  printf "%s" "$CUTBUFFER" | clipcopy 2>/dev/null
+}
+
+zle -N _cb-yank
+zle -N _cb-kill-line
+zle -N _cb-kill-whole-line
+zle -N _cb-kill-word
+zle -N _cb-backward-kill-word
+zle -N _cb-copy-region-as-kill
+
+bindkey '^y'   _cb-yank
+bindkey '^k'   _cb-kill-line
+bindkey '^u'   _cb-kill-whole-line
+bindkey '\ed'  _cb-kill-word
+bindkey '\e^?' _cb-backward-kill-word
+bindkey '\ew'  _cb-copy-region-as-kill
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-clipboard/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-clipboard/default.nix
new file mode 100644
index 000000000000..114e0bfd7dc5
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-clipboard/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, lib }:
+
+stdenv.mkDerivation rec {
+  pname = "zsh-clipboard";
+  version = "1.0";
+
+  src = ./.;
+
+  dontBuild = true;
+
+  installPhase = ''
+    install -D -m0444 -t $out/share/zsh/plugins/clipboard ./clipboard.plugin.zsh
+  '';
+
+  meta = with lib; {
+    description = "Ohmyzsh plugin that integrates kill-ring with system clipboard";
+    longDescription = ''
+      Ohmyzsh plugin that integrates kill-ring with system clipboard.
+
+      Key bindings for C-y, C-k, C-u, M-d, M-backspace and M-w are rebound.
+      Behaviour of these keys should not be changed.
+    '';
+    license = licenses.mit;
+    maintainers = with maintainers; [ bb2020 ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-command-time/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-command-time/default.nix
new file mode 100644
index 000000000000..b92ced6be71c
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-command-time/default.nix
@@ -0,0 +1,34 @@
+{ lib, stdenv, fetchFromGitHub }:
+
+# To make use of this plugin, need to add
+#   programs.zsh.interactiveShellInit = ''
+#     source ${pkgs.zsh-command-time}/share/zsh/plugins/command-time/command-time.plugin.zsh
+#     ZSH_COMMAND_TIME_COLOR="yellow"
+#     ZSH_COMMAND_TIME_MIN_SECONDS=3
+#     ZSH_COMMAND_TIME_ECHO=1
+#   '';
+
+stdenv.mkDerivation {
+  version = "2018-04-30";
+  pname = "zsh-command-time";
+
+  src = fetchFromGitHub {
+    owner = "popstas";
+    repo = "zsh-command-time";
+    rev = "afb4a4c9ae7ce64ca9d4f334a79a25e46daad0aa";
+    sha256 = "1bvyjgz6bhgg1nwr56r50p6fblgah6yiql55pgm5abnn2h876fjq";
+  };
+
+  dontUnpack = true;
+
+  installPhase = ''
+    install -Dm0444 $src/command-time.plugin.zsh --target-directory=$out/share/zsh/plugins/command-time
+  '';
+
+  meta = with lib; {
+    description = "Plugin that output time: xx after long commands";
+    homepage = "https://github.com/popstas/zsh-command-time";
+    license = licenses.mit;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-completions/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-completions/default.nix
new file mode 100644
index 000000000000..249826a2a25f
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-completions/default.nix
@@ -0,0 +1,26 @@
+{ lib, stdenv, fetchFromGitHub}:
+
+stdenv.mkDerivation rec {
+  pname = "zsh-completions";
+  version = "0.33.0";
+
+  src = fetchFromGitHub {
+    owner = "zsh-users";
+    repo = pname;
+    rev = version;
+    sha256 = "0vs14n29wvkai84fvz3dz2kqznwsq2i5fzbwpv8nsfk1126ql13i";
+  };
+
+  installPhase= ''
+    install -D --target-directory=$out/share/zsh/site-functions src/*
+  '';
+
+  meta = {
+    description = "Additional completion definitions for zsh";
+    homepage = "https://github.com/zsh-users/zsh-completions";
+    license = lib.licenses.free;
+
+    platforms = lib.platforms.unix;
+    maintainers = [ lib.maintainers.olejorgenb ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-deer/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-deer/default.nix
new file mode 100644
index 000000000000..895ca621cfed
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-deer/default.nix
@@ -0,0 +1,35 @@
+{ lib, stdenv, fetchFromGitHub, perl }:
+
+let
+  version = "1.4";
+  name = "deer-${version}";
+in stdenv.mkDerivation {
+  inherit name;
+
+  src = fetchFromGitHub {
+    owner = "Vifon";
+    repo = "deer";
+    rev = "v${version}";
+    sha256 = "1xnbnbi0zk2xsyn8dqsmyxqlfnl36pb1wwibnlp0dxixw6sfymyl";
+  };
+
+  prePatch = ''
+    substituteInPlace deer \
+      --replace " perl " " ${perl}/bin/perl "
+  '';
+
+  patches = [ ./realpath.patch ];
+
+  installPhase = ''
+    mkdir -p $out/share/zsh/site-functions/
+    cp deer $out/share/zsh/site-functions/
+  '';
+
+  meta = with lib; {
+    description = "Ranger-like file navigation for zsh";
+    homepage = "https://github.com/Vifon/deer";
+    license = licenses.gpl3Plus;
+    maintainers = [ maintainers.vyp ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-deer/realpath.patch b/nixpkgs/pkgs/shells/zsh/zsh-deer/realpath.patch
new file mode 100644
index 000000000000..03850d7e5c12
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-deer/realpath.patch
@@ -0,0 +1,28 @@
+From ceadb2f11119143af4f590ea6b05a531483219b5 Mon Sep 17 00:00:00 2001
+From: xd1le <elisp.vim@gmail.com>
+Date: Wed, 30 Aug 2017 17:27:20 +1000
+Subject: [PATCH] use realpath instead of python to calculate relative path
+
+---
+ deer | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/deer b/deer
+index 3d89dea..804a871 100644
+--- a/deer
++++ b/deer
+@@ -259,10 +259,7 @@ deer-get-relative()
+ {
+     local TMP
+     TMP=${1:-${DEER_DIRNAME%/}/$DEER_BASENAME[$DEER_DIRNAME]}
+-    TMP="`python -c '
+-import sys, os
+-print(os.path.relpath(sys.argv[1], sys.argv[2]))
+-' $TMP ${DEER_STARTDIR:-$PWD}`"
++    TMP="`realpath --relative-to=${DEER_STARTDIR:-$PWD} $TMP`"
+     print -R $TMP:q
+ }
+ 
+-- 
+2.14.1
+
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-fast-syntax-highlighting/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-fast-syntax-highlighting/default.nix
new file mode 100644
index 000000000000..d1791e4962f4
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-fast-syntax-highlighting/default.nix
@@ -0,0 +1,30 @@
+{ stdenvNoCC, lib, fetchFromGitHub }:
+
+stdenvNoCC.mkDerivation rec {
+  pname = "zsh-fast-syntax-highlighting";
+  version = "1.55";
+
+  src = fetchFromGitHub {
+    owner = "zdharma";
+    repo = "fast-syntax-highlighting";
+    rev = "v${version}";
+    sha256 = "0h7f27gz586xxw7cc0wyiv3bx0x3qih2wwh05ad85bh2h834ar8d";
+  };
+
+  dontConfigure = true;
+  dontBuild = true;
+
+  installPhase = ''
+    plugindir="$out/share/zsh/site-functions"
+
+    mkdir -p "$plugindir"
+    cp -r -- {,_,-,.}fast-* *chroma themes "$plugindir"/
+  '';
+
+  meta = with lib; {
+    description = "Syntax-highlighting for Zshell";
+    homepage = "https://github.com/zdharma/fast-syntax-highlighting";
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-fzf-tab/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-fzf-tab/default.nix
new file mode 100644
index 000000000000..ee0f702780f3
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-fzf-tab/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, lib, fetchFromGitHub, ncurses }:
+
+let
+  INSTALL_PATH="${placeholder "out"}/share/fzf-tab";
+in stdenv.mkDerivation rec {
+  pname = "zsh-fzf-tab";
+  version = "unstable-2021-04-01";
+
+  src = fetchFromGitHub {
+    owner = "Aloxaf";
+    repo = "fzf-tab";
+    rev = "0c36bdcf6a80ec009280897f07f56969f94d377e";
+    sha256 = "0ymp9ky0jlkx9b63jajvpac5g3ll8snkf8q081g0yw42b9hwpiid";
+  };
+
+  buildInputs = [ ncurses ];
+
+  postConfigure = ''
+    pushd modules
+    ./configure --disable-gdbm --without-tcsetpgrp
+    popd
+  '';
+
+  postBuild = ''
+    pushd modules
+    make -j$NIX_BUILD_CORES
+    popd
+  '';
+
+  installPhase = ''
+     mkdir -p ${INSTALL_PATH}
+     cp -r lib ${INSTALL_PATH}/lib
+     install -D fzf-tab.zsh ${INSTALL_PATH}/fzf-tab.zsh
+     install -D fzf-tab.plugin.zsh ${INSTALL_PATH}/fzf-tab.plugin.zsh
+     install -D modules/Src/aloxaf/fzftab.so ${INSTALL_PATH}/modules/Src/aloxaf/fzftab.so
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/Aloxaf/fzf-tab";
+    description = "Replace zsh's default completion selection menu with fzf!";
+    license = licenses.mit;
+    maintainers = with maintainers; [ vonfry ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-git-prompt/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-git-prompt/default.nix
new file mode 100644
index 000000000000..7fb2d7861937
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-git-prompt/default.nix
@@ -0,0 +1,70 @@
+# zsh-git-prompt -- Informative git prompt for zsh
+#
+# Usage: to enable this plugin for all users, you could
+# add it to configuration.nix like this:
+#
+#   programs.zsh.interactiveShellInit = ''
+#     source ${pkgs.zsh-git-prompt}/share/zsh-git-prompt/zshrc.sh
+#   '';
+#
+# Or you can install it globally but only enable it in individual
+# users' ~/.zshrc files:
+#
+#   source /run/current-system/sw/share/zsh-git-prompt/zshrc.sh
+#
+# Or if installed locally:
+#
+#   source ~/.nix-profile/share/zsh-git-prompt/zshrc.sh
+#
+# Either way, you then have to set a prompt that incorporates
+# git_super_status, for example:
+#
+#   PROMPT='%B%m%~%b$(git_super_status) %# '
+#
+# More details are in share/doc/zsh-git-prompt/README.md, once
+# installed.
+#
+{ fetchFromGitHub
+, python
+, git
+, lib
+, haskellPackages
+}:
+
+haskellPackages.callPackage
+  ({ mkDerivation, base, HUnit, parsec, process, QuickCheck }:
+   mkDerivation rec {
+     pname = "zsh-git-prompt";
+     version = "0.4z";  # While we await a real 0.5 release.
+     src = fetchFromGitHub {
+       owner = "starcraftman";
+       repo = "zsh-git-prompt";
+       rev = "11b83ba3b85d14c66cf2ab79faefab6d838da28e";
+       sha256 = "04aylsjfb03ckw219plkzpyiq4j9g66bjxa5pa56h1p7df6pjssb";
+     };
+     prePatch = ''
+        substituteInPlace zshrc.sh                       \
+          --replace ':-"python"' ':-"haskell"'           \
+          --replace 'python '    '${python.interpreter} ' \
+          --replace 'git '       '${git}/bin/git '
+     '';
+     preCompileBuildDriver = "cd src";
+     postInstall = ''
+        cd ..
+        gpshare=$out/share/${pname}
+        gpdoc=$out/share/doc/${pname}
+        mkdir -p $gpshare/src $gpdoc
+        cp README.md $gpdoc
+        cp zshrc.sh gitstatus.py $gpshare
+        mv $out/bin $gpshare/src/.bin
+     '';
+     isLibrary = false;
+     isExecutable = true;
+     libraryHaskellDepends = [ base parsec process QuickCheck ];
+     executableHaskellDepends = libraryHaskellDepends;
+     testHaskellDepends = [HUnit] ++ libraryHaskellDepends;
+     homepage = "https://github.com/olivierverdier/zsh-git-prompt#readme";
+     description = "Informative git prompt for zsh";
+     license = lib.licenses.mit;
+     maintainers = [lib.maintainers.league];
+   }) {}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-history-substring-search/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-history-substring-search/default.nix
new file mode 100644
index 000000000000..9890993eed64
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-history-substring-search/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, lib, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  pname = "zsh-history-substring-search";
+  version = "1.0.2";
+
+  src = fetchFromGitHub {
+    owner = "zsh-users";
+    repo = "zsh-history-substring-search";
+    rev = "v${version}";
+    sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y";
+  };
+
+  installPhase = ''
+    install -D zsh-history-substring-search.zsh \
+      "$out/share/zsh-history-substring-search/zsh-history-substring-search.zsh"
+  '';
+
+  meta = with lib; {
+    description = "Fish shell history-substring-search for Zsh";
+    homepage = "https://github.com/zsh-users/zsh-history-substring-search";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ qyliss ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-history/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-history/default.nix
new file mode 100644
index 000000000000..333da40adbb0
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-history/default.nix
@@ -0,0 +1,37 @@
+{ lib, fetchFromGitHub, buildGoModule, installShellFiles, nixosTests }:
+
+buildGoModule rec {
+  pname = "zsh-history";
+  version = "2019-12-10";
+
+  src = fetchFromGitHub {
+    owner = "b4b4r07";
+    repo = "history";
+    rev = "8da016bd91b0c2eb53c9980f00eee6abdbb097e2";
+    sha256 = "13n643ik1zjvpk8h9458yd9ffahhbdnigmbrbmpn7b7g23wqqsi3";
+  };
+
+  nativeBuildInputs = [ installShellFiles ];
+
+  vendorSha256 = "13rc1afds5xg30faqz35haha4kxg73b5nvjirbrkc6kna0vhb54z";
+
+  doCheck = false;
+
+  postInstall = ''
+    install -d $out/share
+    cp -r "$NIX_BUILD_TOP/source/misc/"* "$out/share"
+    installShellCompletion --zsh --name _history $out/share/zsh/completions/_history
+  '';
+
+  meta = with lib; {
+    description = "A CLI to provide enhanced history for your ZSH shell";
+    license = licenses.mit;
+    homepage = "https://github.com/b4b4r07/history";
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ ];
+  };
+
+  passthru.tests = {
+    zsh-history-shell-integration = nixosTests.zsh-history;
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-nix-shell/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-nix-shell/default.nix
new file mode 100644
index 000000000000..20017414cf7d
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-nix-shell/default.nix
@@ -0,0 +1,29 @@
+{ lib, stdenv, fetchFromGitHub, pkgs }:
+
+# To make use of this derivation, use
+# `programs.zsh.interactiveShellInit = "source ${pkgs.zsh-nix-shell}/share/zsh-nix-shell/nix-shell.plugin.zsh";`
+
+stdenv.mkDerivation rec {
+  pname = "zsh-nix-shell";
+  version = "0.1.0";
+
+  src = fetchFromGitHub {
+    owner = "chisui";
+    repo = "zsh-nix-shell";
+    rev = "v${version}";
+    sha256 = "0snhch9hfy83d4amkyxx33izvkhbwmindy0zjjk28hih1a9l2jmx";
+  };
+
+  installPhase = ''
+    install -D nix-shell.plugin.zsh --target-directory=$out/share/zsh-nix-shell
+    install -D scripts/* --target-directory=$out/share/zsh-nix-shell/scripts
+  '';
+
+  meta = with lib; {
+    description = "zsh plugin that lets you use zsh in nix-shell shell";
+    homepage = src.meta.homepage;
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ aw ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-powerlevel10k/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-powerlevel10k/default.nix
new file mode 100644
index 000000000000..419863044b5d
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-powerlevel10k/default.nix
@@ -0,0 +1,53 @@
+{ lib, stdenv, fetchFromGitHub, substituteAll, pkgs }:
+
+# To make use of this derivation, use
+# `programs.zsh.promptInit = "source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme";`
+
+let
+  # match gitstatus version with given `gitstatus_version`:
+  # https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/build.info
+  gitstatus = pkgs.gitstatus.overrideAttrs (oldAtttrs: rec {
+    version = "1.5.1";
+
+    src = fetchFromGitHub {
+      owner = "romkatv";
+      repo = "gitstatus";
+      rev = "v${version}";
+      sha256 = "1ffgh5826985phc8amvzl9iydvsnij5brh4gczfh201vfmw9d4hh";
+    };
+  });
+in
+stdenv.mkDerivation rec {
+  pname = "powerlevel10k";
+  version = "1.15.0";
+
+  src = fetchFromGitHub {
+    owner = "romkatv";
+    repo = "powerlevel10k";
+    rev = "v${version}";
+    sha256 = "1b3j2riainx3zz4irww72z0pb8l8ymnh1903zpsy5wmjgb0wkcwq";
+  };
+
+  patches = [
+    (substituteAll {
+      src = ./gitstatusd.patch;
+      gitstatusdPath = "${gitstatus}/bin/gitstatusd";
+    })
+  ];
+
+  installPhase = ''
+    install -D powerlevel10k.zsh-theme --target-directory=$out/share/zsh-powerlevel10k
+    install -D config/* --target-directory=$out/share/zsh-powerlevel10k/config
+    install -D internal/* --target-directory=$out/share/zsh-powerlevel10k/internal
+    cp -R gitstatus $out/share/zsh-powerlevel10k/gitstatus
+  '';
+
+  meta = {
+    description = "A fast reimplementation of Powerlevel9k ZSH theme";
+    homepage = "https://github.com/romkatv/powerlevel10k";
+    license = lib.licenses.mit;
+
+    platforms = lib.platforms.unix;
+    maintainers = [ lib.maintainers.hexa ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-powerlevel10k/gitstatusd.patch b/nixpkgs/pkgs/shells/zsh/zsh-powerlevel10k/gitstatusd.patch
new file mode 100644
index 000000000000..3d1c1eaa36d4
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-powerlevel10k/gitstatusd.patch
@@ -0,0 +1,13 @@
+diff --git a/gitstatus/gitstatus.plugin.zsh b/gitstatus/gitstatus.plugin.zsh
+index b469072..eb1e3be 100644
+--- a/gitstatus/gitstatus.plugin.zsh
++++ b/gitstatus/gitstatus.plugin.zsh
+@@ -44,6 +44,8 @@
+ 
+ [[ -o 'interactive' ]] || 'return'
+ 
++GITSTATUS_DAEMON=@gitstatusdPath@
++
+ # Temporarily change options.
+ 'builtin' 'local' '-a' '_gitstatus_opts'
+ [[ ! -o 'aliases'         ]] || _gitstatus_opts+=('aliases')
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-powerlevel9k/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-powerlevel9k/default.nix
new file mode 100644
index 000000000000..b681dc2d3a3a
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-powerlevel9k/default.nix
@@ -0,0 +1,29 @@
+{ lib, stdenv, fetchFromGitHub }:
+
+# To make use of this derivation, use
+# `programs.zsh.promptInit = "source ${pkgs.zsh-powerlevel9k}/share/zsh-powerlevel9k/powerlevel9k.zsh-theme";`
+
+stdenv.mkDerivation {
+  pname = "powerlevel9k";
+  version = "2017-11-10";
+  src = fetchFromGitHub {
+    owner = "bhilburn";
+    repo = "powerlevel9k";
+    rev = "87acc51acab3ed4fd33cda2386abed6f98c80720";
+    sha256 = "0v1dqg9hvycdkcvklg2njff97xwr8rah0nyldv4xm39r77f4yfvq";
+  };
+
+  installPhase= ''
+    install -D powerlevel9k.zsh-theme --target-directory=$out/share/zsh-powerlevel9k
+    install -D functions/* --target-directory=$out/share/zsh-powerlevel9k/functions
+  '';
+
+  meta = {
+    description = "A beautiful theme for zsh";
+    homepage = "https://github.com/bhilburn/powerlevel9k";
+    license = lib.licenses.mit;
+
+    platforms = lib.platforms.unix;
+    maintainers = [ lib.maintainers.pierrechevalier83 ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-prezto/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-prezto/default.nix
new file mode 100644
index 000000000000..88451979cbb6
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-prezto/default.nix
@@ -0,0 +1,39 @@
+{ lib, stdenv, fetchFromGitHub, unstableGitUpdater }:
+
+stdenv.mkDerivation rec {
+  pname = "zsh-prezto";
+  version = "unstable-2021-06-02";
+
+  src = fetchFromGitHub {
+    owner = "sorin-ionescu";
+    repo = "prezto";
+    rev = "6833fcd2f2afbc7396ea7a5fa9eb3b49f4678242";
+    sha256 = "1a8gndj1f8sjnq7clc742lm4qyhp1a2zid6g6lmfr1axhcbn38v6";
+    fetchSubmodules = true;
+  };
+
+  postPatch = ''
+    # make zshrc aware of where zsh-prezto is installed
+    sed -i -e "s|\''${ZDOTDIR:\-\$HOME}/.zprezto/|$out/share/zsh-prezto/|g" runcoms/zshrc
+  '';
+
+  installPhase = ''
+    mkdir -p $out/share/zsh-prezto
+    cp -R ./ $out/share/zsh-prezto
+  '';
+
+  passthru.updateScript = unstableGitUpdater {};
+
+  meta = with lib; {
+    description = "The configuration framework for Zsh";
+    longDescription = ''
+      Prezto is the configuration framework for Zsh; it enriches
+      the command line interface environment with sane defaults,
+      aliases, functions, auto completion, and prompt themes.
+    '';
+    homepage = "https://github.com/sorin-ionescu/prezto";
+    license = licenses.mit;
+    maintainers = with maintainers; [ holymonson ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-syntax-highlighting/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-syntax-highlighting/default.nix
new file mode 100644
index 000000000000..4fc8d5d0dc38
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-syntax-highlighting/default.nix
@@ -0,0 +1,27 @@
+{ lib, stdenv, fetchFromGitHub, zsh }:
+
+# To make use of this derivation, use the `programs.zsh.enableSyntaxHighlighting` option
+
+stdenv.mkDerivation rec {
+  version = "0.7.1";
+  pname = "zsh-syntax-highlighting";
+
+  src = fetchFromGitHub {
+    owner = "zsh-users";
+    repo = "zsh-syntax-highlighting";
+    rev = version;
+    sha256 = "03r6hpb5fy4yaakqm3lbf4xcvd408r44jgpv4lnzl9asp4sb9qc0";
+  };
+
+  nativeBuildInputs = [ zsh ];
+
+  installFlags = [ "PREFIX=$(out)" ];
+
+  meta = with lib; {
+    description = "Fish shell like syntax highlighting for Zsh";
+    homepage = "https://github.com/zsh-users/zsh-syntax-highlighting";
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.loskutov ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-system-clipboard/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-system-clipboard/default.nix
new file mode 100644
index 000000000000..b4d407a70bc9
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-system-clipboard/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, lib, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  pname = "zsh-system-clipboard";
+  version = "0.7.0";
+
+  src = fetchFromGitHub {
+    owner = "kutsan";
+    repo = "zsh-system-clipboard";
+    rev = "v${version}";
+    sha256 = "09lqav1mz5zajklr3xa0iaivhpykv3azkjb7yj9wyp0hq3vymp8i";
+  };
+
+  installPhase = ''
+    install -D zsh-system-clipboard.zsh $out/share/zsh/${pname}/zsh-system-clipboard.zsh
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/kutsan/zsh-system-clipboard";
+    description = "A plugin that adds key bindings support for ZLE (Zsh Line Editor) clipboard operations for vi emulation keymaps";
+    license = licenses.gpl3Only;
+    maintainers = with maintainers; [ _0qq ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-you-should-use/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-you-should-use/default.nix
new file mode 100644
index 000000000000..8019e75a8594
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-you-should-use/default.nix
@@ -0,0 +1,26 @@
+{ lib, stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  pname = "zsh-you-should-use";
+  version = "1.7.3";
+
+  src = fetchFromGitHub {
+    owner = "MichaelAquilina";
+    repo = pname;
+    rev = version;
+    sha256 = "1dz48rd66priqhxx7byndqhbmlwxi1nfw8ik25k0z5k7k754brgy";
+  };
+
+  dontBuild = true;
+
+  installPhase = ''
+    install -D you-should-use.plugin.zsh $out/share/zsh/plugins/you-should-use/you-should-use.plugin.zsh
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/MichaelAquilina/zsh-you-should-use";
+    license = licenses.gpl3;
+    description = "ZSH plugin that reminds you to use existing aliases for commands you just typed";
+    maintainers = with maintainers; [ ma27 ];
+  };
+}
diff --git a/nixpkgs/pkgs/shells/zsh/zsh-z/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-z/default.nix
new file mode 100644
index 000000000000..9623ff6648cd
--- /dev/null
+++ b/nixpkgs/pkgs/shells/zsh/zsh-z/default.nix
@@ -0,0 +1,28 @@
+{ lib, stdenvNoCC, fetchFromGitHub }:
+
+stdenvNoCC.mkDerivation rec {
+  pname = "zsh-z";
+  version = "unstable-2021-02-15";
+
+  src = fetchFromGitHub {
+    owner = "agkozak";
+    repo = pname;
+    rev = "595c883abec4682929ffe05eb2d088dd18e97557";
+    sha256 = "sha256-HnwUWqzwavh/Qox+siOe5lwTp7PBdiYx+9M0NMNFx00=";
+  };
+
+  dontBuild = true;
+
+  installPhase = ''
+    mkdir -p $out/share/zsh-z
+    cp _zshz zsh-z.plugin.zsh $out/share/zsh-z
+  '';
+
+  meta = with lib; {
+    description = "Jump quickly to directories that you have visited frequently in the past, or recently";
+    homepage = "https://github.com/agkozak/zsh-z";
+    license = licenses.mit;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.evalexpr ];
+  };
+}