diff options
Diffstat (limited to 'nixpkgs/pkgs/shells')
62 files changed, 3222 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 00000000000..d2b7a4929e1 --- /dev/null +++ b/nixpkgs/pkgs/shells/any-nix-shell/default.nix @@ -0,0 +1,27 @@ +{ stdenv, fetchFromGitHub, makeWrapper }: + +stdenv.mkDerivation rec { + pname = "any-nix-shell"; + version = "1.1.0"; + + src = fetchFromGitHub { + owner = "haslersn"; + repo = "any-nix-shell"; + rev = "v${version}"; + sha256 = "02cv86csk1m8nlh2idvh7bjw43lpssmdawya2jhr4bam2606yzdv"; + }; + + nativeBuildInputs = [ makeWrapper ]; + installPhase = '' + mkdir -p $out/bin + cp -r bin $out + wrapProgram $out/bin/any-nix-shell --prefix PATH ":" $out/bin + ''; + + meta = with stdenv.lib; { + description = "fish and zsh support for nix-shell"; + license = licenses.mit; + homepage = https://github.com/haslersn/any-nix-shell; + maintainers = with maintainers; [ haslersn ]; + }; +}
\ No newline at end of file diff --git a/nixpkgs/pkgs/shells/bash/4.4.nix b/nixpkgs/pkgs/shells/bash/4.4.nix new file mode 100644 index 00000000000..121368abf4c --- /dev/null +++ b/nixpkgs/pkgs/shells/bash/4.4.nix @@ -0,0 +1,135 @@ +{ stdenv, buildPackages +, fetchurl, binutils ? null, bison, autoconf, utillinux + +# patch for cygwin requires readline support +, interactive ? stdenv.isCygwin, readline70 ? null +, withDocs ? false, texinfo ? null +}: + +with stdenv.lib; + +assert interactive -> readline70 != null; +assert withDocs -> texinfo != null; +assert stdenv.hostPlatform.isDarwin -> binutils != null; + +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 + ++ 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 = [ utillinux ]; + 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 stdenv.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.0.nix b/nixpkgs/pkgs/shells/bash/5.0.nix new file mode 100644 index 00000000000..a06b08a5599 --- /dev/null +++ b/nixpkgs/pkgs/shells/bash/5.0.nix @@ -0,0 +1,126 @@ +{ stdenv, buildPackages +, fetchurl, binutils ? null, bison, utillinux + +# patch for cygwin requires readline support +, interactive ? stdenv.isCygwin, readline80 ? null +, withDocs ? false, texinfo ? null +}: + +with stdenv.lib; + +assert interactive -> readline80 != null; +assert withDocs -> texinfo != null; +assert stdenv.hostPlatform.isDarwin -> binutils != null; + +let + upstreamPatches = import ./bash-5.0-patches.nix (nr: sha256: fetchurl { + url = "mirror://gnu/bash/bash-5.0-patches/bash50-${nr}"; + inherit sha256; + }); +in + +stdenv.mkDerivation rec { + name = "bash-${optionalString interactive "interactive-"}${version}-p${toString (builtins.length upstreamPatches)}"; + version = "5.0"; + + src = fetchurl { + url = "mirror://gnu/bash/bash-${version}.tar.gz"; + sha256 = "0kgvfwqdcd90waczf4gx39xnrxzijhjrzyzv7s8v4w31qqm0za5l"; + }; + + 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; + + 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 readline80; + + enableParallelBuilding = true; + + makeFlags = optional stdenv.hostPlatform.isCygwin [ + "LOCAL_LDFLAGS=-Wl,--export-all,--out-implib,libbash.dll.a" + "SHOBJ_LIBS=-lbash" + ]; + + checkInputs = [ utillinux ]; + 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 stdenv.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 00000000000..a79ec90213a --- /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.0-patches.nix b/nixpkgs/pkgs/shells/bash/bash-5.0-patches.nix new file mode 100644 index 00000000000..1f24a6dec12 --- /dev/null +++ b/nixpkgs/pkgs/shells/bash/bash-5.0-patches.nix @@ -0,0 +1,15 @@ +# Automatically generated by `update-patch-set.sh'; do not edit. + +patch: [ +(patch "001" "12bjfdy6bg8nhyw27bdgxn7h4paylx8d927skfmi9pxd1wgrxzpj") +(patch "002" "01w7yrzmz10mw06ys0546vhl7isv2v402ziyvfd7k67588spvs47") +(patch "003" "0ny81ridp5n0j69hb8ixrc7dmxybby54jbsz5hikly8kgg1wvssf") +(patch "004" "021gqqvgydixkrmqss64b6srfdlkvnx88lyfzpxfrn5d6bc7li0l") +(patch "005" "0xl2kyzm84nlyklrqzkn73ixabhzfhn9x91lzcmis89cppclvxav") +(patch "006" "0844749ixk1z60437nkznzms1f0nzh9an62kj7sny6r0zyk2k1fn") +(patch "007" "16xg37gp1b8zlj5969w8mcrparwqlcbj9695vn3qhgb7wdz1xd0p") +(patch "008" "1qyp19krjh8zxvb0jgwmyjz40djslwcf4xi7kc1ab0iaca44bipf") +(patch "009" "00yrjjqd95s81b21qq3ba1y7h879q8jaajlkjggc6grhcwbs4g7d") +(patch "010" "04ca5bjv456v538mkspzvn4xb2zdphh31r4fpvfm9p5my0jw7yyn") +(patch "011" "1sklyixvsv8993kxzs0jigacpdchjrq7jv5xpdx7kbqyp4rf6k9c") +] diff --git a/nixpkgs/pkgs/shells/bash/bash-completion/0001-Revert-build-Do-cmake-pc-and-profile-variable-replac.patch b/nixpkgs/pkgs/shells/bash/bash-completion/0001-Revert-build-Do-cmake-pc-and-profile-variable-replac.patch new file mode 100644 index 00000000000..c0d94a1a76d --- /dev/null +++ b/nixpkgs/pkgs/shells/bash/bash-completion/0001-Revert-build-Do-cmake-pc-and-profile-variable-replac.patch @@ -0,0 +1,86 @@ +From 398f44b4ed545fc1b6c13a057bf0900001f7958b Mon Sep 17 00:00:00 2001 +From: Frederik Rietdijk <fridh@fridh.nl> +Date: Tue, 22 Oct 2019 15:07:05 +0200 +Subject: [PATCH] Revert "build: Do cmake, pc, and profile variable + replacements in Makefile" + +This reverts commit 81ba2c7e7dfbaefbafa1e8615727c9612e5fb314. +--- + Makefile.am | 12 ++++++++---- + bash-completion-config.cmake.in | 4 ++-- + bash-completion.pc.in | 4 ++-- + configure.ac | 3 +++ + 4 files changed, 15 insertions(+), 8 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 8f441185..53979529 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -23,8 +23,7 @@ cmakeconfig_DATA = bash-completion-config.cmake \ + -e 's|@VERSION[@]|$(VERSION)|' \ + <$(srcdir)/$@.in >$@ + +-CLEANFILES = bash_completion.sh bash-completion.pc \ +- bash-completion-config.cmake bash-completion-config-version.cmake ++CLEANFILES = bash_completion.sh bash-completion.pc + + EXTRA_DIST = CHANGES $(pkgdata_DATA) bash_completion.sh.in .dir-locals.el \ + .editorconfig README.md CONTRIBUTING.md pyproject.toml .perltidyrc \ +@@ -34,6 +33,11 @@ EXTRA_DIST = CHANGES $(pkgdata_DATA) bash_completion.sh.in .dir-locals.el \ + install-data-hook: + tmpfile=`mktemp $${TMPDIR:-/tmp}/bash_completion.XXXXXX` && \ + $(SED) -e 's|-/etc/bash_completion\.d|-$(compatdir)|' \ +- $(DESTDIR)$(pkgdatadir)/bash_completion >$$tmpfile && \ +- cat $$tmpfile >$(DESTDIR)$(pkgdatadir)/bash_completion && \ ++ $(DESTDIR)$(pkgdatadir)/bash_completion > $$tmpfile && \ ++ cat $$tmpfile > $(DESTDIR)$(pkgdatadir)/bash_completion && \ ++ $(SED) -e 's|\$${prefix}|$(prefix)|' \ ++ $(DESTDIR)$(datadir)/cmake/$(PACKAGE)/bash-completion-config.cmake \ ++ > $$tmpfile && \ ++ cat $$tmpfile > \ ++ $(DESTDIR)$(datadir)/cmake/$(PACKAGE)/bash-completion-config.cmake && \ + rm $$tmpfile +diff --git a/bash-completion-config.cmake.in b/bash-completion-config.cmake.in +index d907b76c..ccc6e052 100644 +--- a/bash-completion-config.cmake.in ++++ b/bash-completion-config.cmake.in +@@ -5,7 +5,7 @@ set (BASH_COMPLETION_VERSION "@VERSION@") + + set (BASH_COMPLETION_PREFIX "@prefix@") + set (BASH_COMPLETION_COMPATDIR "@compatdir@") +-set (BASH_COMPLETION_COMPLETIONSDIR "@pkgdatadir@/completions") +-set (BASH_COMPLETION_HELPERSDIR "@pkgdatadir@/helpers") ++set (BASH_COMPLETION_COMPLETIONSDIR "@datarootdir@/@PACKAGE@/completions") ++set (BASH_COMPLETION_HELPERSDIR "@datarootdir@/@PACKAGE@/helpers") + + set (BASH_COMPLETION_FOUND "TRUE") +diff --git a/bash-completion.pc.in b/bash-completion.pc.in +index ea03fd75..bde217db 100644 +--- a/bash-completion.pc.in ++++ b/bash-completion.pc.in +@@ -1,7 +1,7 @@ + prefix=@prefix@ + compatdir=@compatdir@ +-completionsdir=@pkgdatadir@/completions +-helpersdir=@pkgdatadir@/helpers ++completionsdir=@datarootdir@/@PACKAGE@/completions ++helpersdir=@datarootdir@/@PACKAGE@/helpers + + Name: bash-completion + Description: programmable completion for the bash shell +diff --git a/configure.ac b/configure.ac +index 1f3b37e8..a216d9b7 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -13,5 +13,8 @@ helpers/Makefile + test/Makefile + test/t/Makefile + test/t/unit/Makefile ++bash-completion.pc ++bash-completion-config.cmake ++bash-completion-config-version.cmake + ]) + AC_OUTPUT +-- +2.21.0 + 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 00000000000..a741633340d --- /dev/null +++ b/nixpkgs/pkgs/shells/bash/bash-completion/default.nix @@ -0,0 +1,60 @@ +{ stdenv, fetchFromGitHub +, fetchpatch +, autoreconfHook +, python3Packages +, bashInteractive +}: + +stdenv.mkDerivation rec { + pname = "bash-completion"; + # TODO: Remove musl patch below upon next release! + version = "2.9"; + + src = fetchFromGitHub { + owner = "scop"; + repo = "bash-completion"; + rev = version; + sha256 = "1813r4jxfa2zgzm2ppjhrq62flfmxai8433pklxcrl4fp5wwx9yv"; + }; + + nativeBuildInputs = [ autoreconfHook ]; + + doCheck = !stdenv.isDarwin; + checkInputs = [ + python3Packages.pexpect + python3Packages.pytest + bashInteractive + ]; + + patches = [ + ./0001-Revert-build-Do-cmake-pc-and-profile-variable-replac.patch + # TODO: Remove when https://github.com/scop/bash-completion/commit/2cdac1b9f24df62a1fa80c1824ee8524c9b02393 + # is availabe in a release in nixpkgs. see https://github.com/scop/bash-completion/issues/312. + # Fixes a test failure with musl. + (fetchpatch { + url = "https://github.com/scop/bash-completion/commit/2cdac1b9f24df62a1fa80c1824ee8524c9b02393.patch"; + name = "bash-completion-musl-test_iconv-skip-option-completion-if-help-fails"; + sha256 = "1l53d62zf01k625nzw3vcrxky93h7bzdpchgk4argxalrn17ckvb"; + }) + ]; + + # ignore ip_addresses because it tries to touch network + # ignore test_ls because impure logic + checkPhase = '' + pytest . \ + --ignore=test/t/unit/test_unit_ip_addresses.py \ + --ignore=test/t/test_ls.py + ''; + + prePatch = stdenv.lib.optionalString stdenv.isDarwin '' + sed -i -e 's/readlink -f/readlink/g' bash_completion completions/* + ''; + + meta = with stdenv.lib; { + homepage = https://github.com/scop/bash-completion; + description = "Programmable completion for the bash shell"; + license = licenses.gpl2Plus; + platforms = platforms.unix; + maintainers = [ maintainers.peti ]; + }; +} 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 00000000000..48837310962 --- /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 00000000000..affbd219958 --- /dev/null +++ b/nixpkgs/pkgs/shells/bash/nix-bash-completions/default.nix @@ -0,0 +1,36 @@ +{ stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + version = "0.6.7"; + pname = "nix-bash-completions"; + + src = fetchFromGitHub { + owner = "hedning"; + repo = "nix-bash-completions"; + rev = "v${version}"; + sha256 = "067j1gavpm9zv3vzw9gq0bi3bi0rjrijwprc1j016g44kvpq49qi"; + }; + + # 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 stdenv.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/update-patch-set.sh b/nixpkgs/pkgs/shells/bash/update-patch-set.sh new file mode 100755 index 00000000000..003c7a26d20 --- /dev/null +++ b/nixpkgs/pkgs/shells/bash/update-patch-set.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +# 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)" + +GPG="$(if $(type -P gpg2 > /dev/null); then echo gpg2; else echo gpg; fi)" +PATCH_LIST="$PROJECT-$VERSION-patches.nix" + +set -e + +start=1 +end=100 # must be > 99 for correct padding + +rm -vf "$PATCH_LIST" + +( 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/default.nix b/nixpkgs/pkgs/shells/dash/default.nix new file mode 100644 index 00000000000..f8d592748b3 --- /dev/null +++ b/nixpkgs/pkgs/shells/dash/default.nix @@ -0,0 +1,23 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation rec { + name = "dash-0.5.10.2"; + + src = fetchurl { + url = "http://gondor.apana.org.au/~herbert/dash/files/${name}.tar.gz"; + sha256 = "0wb0bwmqc661hylqcfdp7l7x12myw3vpqk513ncyqrjwvhckjriw"; + }; + + hardeningDisable = [ "format" ]; + + meta = with stdenv.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 00000000000..e2fd845c286 --- /dev/null +++ b/nixpkgs/pkgs/shells/dgsh/default.nix @@ -0,0 +1,45 @@ +{ stdenv, fetchFromGitHub, autoconf, automake, pkgconfig, + 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 pkgconfig 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 stdenv.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 00000000000..c6676815131 --- /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 00000000000..80b0f386051 --- /dev/null +++ b/nixpkgs/pkgs/shells/elvish/default.nix @@ -0,0 +1,37 @@ +{ stdenv, buildGoPackage, fetchFromGitHub }: + +buildGoPackage rec { + pname = "elvish"; + version = "0.12"; + + goPackagePath = "github.com/elves/elvish"; + excludedPackages = [ "website" ]; + buildFlagsArray = '' + -ldflags= + -X ${goPackagePath}/buildinfo.Version=${version} + ''; + + src = fetchFromGitHub { + owner = "elves"; + repo = pname; + rev = "v${version}"; + sha256 = "1vvbgkpnrnb5aaak4ks45wl0cyp0vbry8bpxl6v2dpmq9x0bscpp"; + }; + + meta = with stdenv.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 00000000000..446f28ba652 --- /dev/null +++ b/nixpkgs/pkgs/shells/es/default.nix @@ -0,0 +1,45 @@ +{ stdenv, fetchurl, readline, yacc }: + +let + version = "0.9.1"; +in +stdenv.mkDerivation { + + pname = "es"; + inherit version; + + 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 yacc ]; + + configureFlags = [ "--with-readline" ]; + + meta = with stdenv.lib; { + description = "Es is an extensible shell"; + 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/default.nix b/nixpkgs/pkgs/shells/fish/default.nix new file mode 100644 index 00000000000..1ef3c4b6fd9 --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/default.nix @@ -0,0 +1,205 @@ +{ stdenv, fetchurl, coreutils, utillinux, + which, gnused, gnugrep, + groff, man-db, getent, libiconv, pcre2, + gettext, ncurses, python3, + cmake + + , writeText + + , useOperatingSystemEtc ? true + +}: + +with stdenv.lib; + +let + etcConfigAppendixText = '' + ############### ↓ 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. + + if test -f /etc/fish/config.fish + source /etc/fish/config.fish + end + + # # + ############### ↑ Nix hook for sourcing /etc/fish/config.fish ↑ ############### + ''; + + fishPreInitHooks = '' + # 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" + 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 (echo $NIX_PROFILES | ${coreutils}/bin/tr ' ' '\n')[-1..1] + + set __extra_completionsdir \ + $__nix_profile_paths"/etc/fish/completions" \ + $__nix_profile_paths"/share/fish/vendor_completions.d" \ + $__extra_completionsdir + set __extra_functionsdir \ + $__nix_profile_paths"/etc/fish/functions" \ + $__nix_profile_paths"/share/fish/vendor_functions.d" \ + $__extra_functionsdir + set __extra_confdir \ + $__nix_profile_paths"/etc/fish/conf.d" \ + $__nix_profile_paths"/share/fish/vendor_conf.d" \ + $__extra_confdir + end + ''; + + fish = stdenv.mkDerivation rec { + pname = "fish"; + version = "3.0.2"; + + etcConfigAppendix = builtins.toFile "etc-config.appendix.fish" etcConfigAppendixText; + + src = fetchurl { + # There are differences between the release tarball and the tarball github packages from the tag + # Hence we cannot use fetchFromGithub + url = "https://github.com/fish-shell/fish-shell/releases/download/${version}/${pname}-${version}.tar.gz"; + sha256 = "03j3jl9jzlnhq4p86zj8wqsh5sx45j1d1fvfa80ks1cfdg68qwhl"; + }; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ ncurses libiconv pcre2 ]; + + preConfigure = '' + patchShebangs ./build_tools/git_version_gen.sh + ''; + + # Required binaries during execution + # Python: Autocompletion generated from manpages and config editing + propagatedBuildInputs = [ + coreutils gnugrep gnused + python3 groff gettext + ] ++ optional (!stdenv.isDarwin) man-db; + + postInstall = '' + sed -r "s|command grep|command ${gnugrep}/bin/grep|" \ + -i "$out/share/fish/functions/grep.fish" + sed -i "s|which |${which}/bin/which |" \ + "$out/share/fish/functions/type.fish" + sed -e "s|\|cut|\|${coreutils}/bin/cut|" \ + -i "$out/share/fish/functions/fish_prompt.fish" + sed -e "s|gettext |${gettext}/bin/gettext |" \ + -e "s|which |${which}/bin/which |" \ + -i "$out/share/fish/functions/_.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 -i "s|/sbin /usr/sbin||" \ + "$out/share/fish/functions/__fish_complete_subcommand_root.fish" + sed -e "s|clear;|${getBin ncurses}/bin/clear;|" \ + -i "$out/share/fish/functions/fish_default_key_bindings.fish" + sed -e "s|python3|${getBin python3}/bin/python3|" \ + -i $out/share/fish/functions/{__fish_config_interactive.fish,fish_config.fish,fish_update_completions.fish} + + '' + optionalString stdenv.isLinux '' + sed -e "s| ul| ${utillinux}/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 < ${(writeText "config.fish.appendix" etcConfigAppendixText)} + '' + '' + tee -a $out/share/fish/__fish_build_paths.fish < ${(writeText "__fish_build_paths_suffix.fish" fishPreInitHooks)} + ''; + + enableParallelBuilding = true; + + meta = with stdenv.lib; { + description = "Smart and user-friendly command line shell"; + homepage = http://fishshell.com/; + license = licenses.gpl2; + platforms = platforms.unix; + maintainers = with maintainers; [ ocharles ]; + }; + + passthru = { + shellPath = "/bin/fish"; + }; + }; + + tests = { + + # 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 * + # 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|.*\(/tmp/.*\)|\1|p' \ + ) | grep 'a href="http://localhost.*Start the Fish Web config' + + # cannot test the http server because it needs a localhost port + ''; + in '' + HOME=$(mktemp -d) + ${fish}/bin/fish ${fishScript} + ''; + }; + + # FIXME(Profpatsch) replace withTests stub + withTests = flip const; + +in withTests tests fish diff --git a/nixpkgs/pkgs/shells/fish/fish-foreign-env/default.nix b/nixpkgs/pkgs/shells/fish/fish-foreign-env/default.nix new file mode 100644 index 00000000000..a5f429ed373 --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/fish-foreign-env/default.nix @@ -0,0 +1,31 @@ +{ stdenv, fetchFromGitHub, gnused, bash, coreutils }: + +stdenv.mkDerivation { + pname = "fish-foreign-env"; + version = "git-20170324"; + + src = fetchFromGitHub { + owner = "oh-my-fish"; + repo = "plugin-foreign-env"; + rev = "baefbd690f0b52cb8746f3e64b326d82834d07c5"; + sha256 = "0lwp6hy3kfk7xfx4xvbk1ir8zkzm7gfjbm4bf6xg1y6iw9jq9dnl"; + }; + + installPhase = '' + mkdir -p $out/share/fish-foreign-env/functions/ + cp functions/* $out/share/fish-foreign-env/functions/ + sed -e "s|sed|${gnused}/bin/sed|" \ + -e "s|bash|${bash}/bin/bash|" \ + -e "s|\| tr|\| ${coreutils}/bin/tr|" \ + -i $out/share/fish-foreign-env/functions/* + ''; + + patches = [ ./suppress-harmless-warnings.patch ]; + + meta = with stdenv.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/fish-foreign-env/suppress-harmless-warnings.patch b/nixpkgs/pkgs/shells/fish/fish-foreign-env/suppress-harmless-warnings.patch new file mode 100644 index 00000000000..5e4569f0a15 --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/fish-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 ^/dev/null ++ else ++ set -g -x $key $value ++ end ++ + end + end diff --git a/nixpkgs/pkgs/shells/ion/default.nix b/nixpkgs/pkgs/shells/ion/default.nix new file mode 100644 index 00000000000..2010f34ef7e --- /dev/null +++ b/nixpkgs/pkgs/shells/ion/default.nix @@ -0,0 +1,30 @@ +{ stdenv, fetchFromGitHub, rustPlatform }: + +with rustPlatform; + +buildRustPackage rec { + pname = "ion"; + version = "1.0.5"; + + src = fetchFromGitHub { + owner = "redox-os"; + repo = "ion"; + rev = version; + sha256 = "0i0acl5nw254mw8dbfmb4792rr71is98a5wg32yylfnlrk7zlf8z"; + }; + + cargoSha256 = "1hs01b1rhbpafxlhw661k907rznqhcgyng85njkb99bg4lxwxaap"; + + meta = with stdenv.lib; { + description = "Modern system shell with simple (and powerful) syntax"; + homepage = https://github.com/redox-os/ion; + license = licenses.mit; + maintainers = with maintainers; [ dywedir ]; + platforms = platforms.all; + broken = stdenv.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 00000000000..833947a6ddb --- /dev/null +++ b/nixpkgs/pkgs/shells/jush/default.nix @@ -0,0 +1,27 @@ +{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, editline }: + +stdenv.mkDerivation rec { + pname = "jush"; + version = "0.1"; + + src = fetchFromGitHub { + owner = "troglobit"; + repo = pname; + rev = "v${version}"; + sha256 = "1azvghrh31gawd798a254ml4id642qvbva64zzg30pjszh1087n8"; + }; + + nativeBuildInputs = [ autoreconfHook pkgconfig ]; + + buildInputs = [ editline ]; + + passthru.shellPath = "/bin/jush"; + + meta = with stdenv.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 00000000000..108d1a58758 --- /dev/null +++ b/nixpkgs/pkgs/shells/ksh/default.nix @@ -0,0 +1,43 @@ +{ stdenv, meson, ninja, fetchFromGitHub, which, python, 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 python ]; + + buildInputs = [ libiconv ]; + + meta = with stdenv.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 00000000000..62efabb022c --- /dev/null +++ b/nixpkgs/pkgs/shells/liquidprompt/default.nix @@ -0,0 +1,32 @@ +{ stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "liquidprompt"; + version = "unstable-2018-05-21"; + + src = fetchFromGitHub { + owner = "nojhan"; + repo = pname; + rev = "eda83efe4e0044f880370ed5e92aa7e3fdbef971"; + sha256 = "1p7ah3x850ajpq07xvxxd7fx2i67cf0n71ww085g32k9fwij4rd4"; + }; + + 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 stdenv.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 00000000000..9b48c5c68a1 --- /dev/null +++ b/nixpkgs/pkgs/shells/mksh/default.nix @@ -0,0 +1,41 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation rec { + pname = "mksh"; + version = "57"; + + src = fetchurl { + urls = [ + "https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R${version}.tgz" + "http://pub.allbsd.org/MirOS/dist/mir/mksh/mksh-R${version}.tgz" + ]; + sha256 = "0xdykm1z710wriwd6nc8s8lwk2dwjl63dq96xxaawlid31a1241x"; + }; + + buildPhase = ''sh ./Build.sh -r -c lto''; + + installPhase = '' + install -D -m 755 mksh $out/bin/mksh + install -D -m 644 mksh.1 $out/share/man/man1/mksh.1 + install -D -m 644 dot.mkshrc $out/share/mksh/mkshrc + ''; + + meta = with stdenv.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 = licenses.bsd3; + maintainers = with maintainers; [ AndersonTorres joachifm ]; + platforms = platforms.unix; + }; + + passthru = { + shellPath = "/bin/mksh"; + }; +} diff --git a/nixpkgs/pkgs/shells/mrsh/default.nix b/nixpkgs/pkgs/shells/mrsh/default.nix new file mode 100644 index 00000000000..9036e085429 --- /dev/null +++ b/nixpkgs/pkgs/shells/mrsh/default.nix @@ -0,0 +1,24 @@ +{ stdenv, lib, fetchFromGitHub, meson, ninja, pkgconfig, readline }: + +stdenv.mkDerivation rec { + pname = "mrsh"; + version = "2020-01-08"; + + src = fetchFromGitHub { + owner = "emersion"; + repo = "mrsh"; + rev = "ef21854fc9ce172fb1f7f580b19a89d030d67c65"; + sha256 = "1iyxmwl61p2x9v9b22416n4lnrlwjqyxybq35x8bcbjxkwypp943"; + }; + + nativeBuildInputs = [ meson ninja pkgconfig ]; + buildInputs = [ readline ]; + + meta = with stdenv.lib; { + description = "A minimal POSIX shell"; + homepage = "https://mrsh.sh"; + license = licenses.mit; + maintainers = with maintainers; [ matthiasbeyer ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/shells/nushell/default.nix b/nixpkgs/pkgs/shells/nushell/default.nix new file mode 100644 index 00000000000..de8502618c6 --- /dev/null +++ b/nixpkgs/pkgs/shells/nushell/default.nix @@ -0,0 +1,52 @@ +{ stdenv +, fetchFromGitHub +, rustPlatform +, openssl +, pkg-config +, python3 +, xorg +, libiconv +, AppKit +, Security +, withStableFeatures ? true +}: + +rustPlatform.buildRustPackage rec { + pname = "nushell"; + version = "0.8.0"; + + src = fetchFromGitHub { + owner = pname; + repo = pname; + rev = version; + sha256 = "1hw9fazf5m80p39wgjqjcxafkfjxh0rkjmiznn2p66gccjnkddm6"; + }; + + cargoSha256 = "17hx02g9m3l2kgxba0n6wmixdbd9g8443h085v8shd70c6vln2v8"; + + nativeBuildInputs = [ pkg-config ] + ++ stdenv.lib.optionals (withStableFeatures && stdenv.isLinux) [ python3 ]; + + buildInputs = stdenv.lib.optionals stdenv.isLinux [ openssl ] + ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv Security ] + ++ stdenv.lib.optionals (withStableFeatures && stdenv.isLinux) [ xorg.libX11 ] + ++ stdenv.lib.optionals (withStableFeatures && stdenv.isDarwin) [ AppKit ]; + + cargoBuildFlags = stdenv.lib.optional withStableFeatures "--features=stable"; + + preCheck = '' + export HOME=$TMPDIR + ''; + + meta = with stdenv.lib; { + description = "A modern shell written in Rust"; + homepage = "https://www.nushell.sh/"; + license = licenses.mit; + maintainers = with maintainers; [ filalex77 marsam ]; + platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ]; + }; + + 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 00000000000..3ae8a7c600a --- /dev/null +++ b/nixpkgs/pkgs/shells/oh/default.nix @@ -0,0 +1,23 @@ +{ stdenv, buildGoPackage, fetchgit, lib }: + +buildGoPackage rec { + pname = "oh"; + version = "20160522-${stdenv.lib.strings.substring 0 7 rev}"; + rev = "0daaf4081475fb9d6b3801c85019bdd57b2ee9b4"; + + goPackagePath = "github.com/michaelmacinnis/oh"; + + src = fetchgit { + inherit rev; + url = "https://github.com/michaelmacinnis/oh"; + sha256 = "0ajidzs0aisbw74nri9ks6sx6644nmwkisc9mvxm3f89zmnlsgwr"; + }; + + goDeps = ./deps.nix; + + meta = with lib;{ + homepage = "https://github.com/michaelmacinnis/oh"; + description = "A Unix shell"; + license = stdenv.lib.licenses.mit; + }; +} diff --git a/nixpkgs/pkgs/shells/oh/deps.nix b/nixpkgs/pkgs/shells/oh/deps.nix new file mode 100644 index 00000000000..b4b98f10c3a --- /dev/null +++ b/nixpkgs/pkgs/shells/oh/deps.nix @@ -0,0 +1,29 @@ +[ + { + goPackagePath = "golang.org/x/sys"; + fetch = { + type = "git"; + url = "https://go.googlesource.com/sys"; + rev = "d9157a9621b69ad1d8d77a1933590c416593f24f"; + sha256 = "1asdbp7rj1j1m1aar1a022wpcwbml6zih6cpbxaw7b2m8v8is931"; + }; + } + { + goPackagePath = "github.com/michaelmacinnis/adapted"; + fetch = { + type = "git"; + url = "https://github.com/michaelmacinnis/adapted"; + rev = "0dd5fa34d6f9d74c7c0deed1fc224f9a87e02978"; + sha256 = "16n3a87m33pqx4qih713q3gw2j6ksj1q3ngjax6bpn5b11rqvikv"; + }; + } + { + goPackagePath = "github.com/peterh/liner"; + fetch = { + type = "git"; + url = "https://github.com/peterh/liner"; + rev = "ad1edfd30321d8f006ccf05f1e0524adeb943060"; + sha256 = "0c24d9j1gnq7r982h1l2isp3d37379qw155hr8ihx9i2mhpfz317"; + }; + } +] diff --git a/nixpkgs/pkgs/shells/oil/default.nix b/nixpkgs/pkgs/shells/oil/default.nix new file mode 100644 index 00000000000..13b36bf54ad --- /dev/null +++ b/nixpkgs/pkgs/shells/oil/default.nix @@ -0,0 +1,41 @@ +{ stdenv, lib, fetchurl, fetchpatch, readline }: + +stdenv.mkDerivation rec { + pname = "oil"; + version = "0.7.pre9"; + + src = fetchurl { + url = "https://www.oilshell.org/download/oil-${version}.tar.xz"; + sha256 = "1j17yxpjqv37vbl3qhnwl3gdmb33n9c6g6byxcc8mhbvbw91zi5i"; + }; + + postPatch = '' + patchShebangs build + ''; + + preInstall = '' + mkdir -p $out/bin + ''; + + buildInputs = [ readline ]; + configureFlags = [ "--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 ]; + }; + + passthru = { + shellPath = "/bin/osh"; + }; +} diff --git a/nixpkgs/pkgs/shells/pash/default.nix b/nixpkgs/pkgs/shells/pash/default.nix new file mode 100644 index 00000000000..8b8601e326c --- /dev/null +++ b/nixpkgs/pkgs/shells/pash/default.nix @@ -0,0 +1,29 @@ +{ stdenv, 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 stdenv.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 00000000000..faab933ae25 --- /dev/null +++ b/nixpkgs/pkgs/shells/powershell/default.nix @@ -0,0 +1,51 @@ +{ stdenv, autoPatchelfHook, fetchzip, libunwind, libuuid, icu, curl +, darwin, makeWrapper, less, openssl_1_0_2, pam, lttng-ust }: + +let platformString = if stdenv.isDarwin then "osx" + else if stdenv.isLinux then "linux" + else throw "unsupported platform"; + platformSha = if stdenv.isDarwin then "0jb2xm79m3m14zk7v730ai1zvxcb5a13jbkkya0qy7332k6gn6bl" + else if stdenv.isLinux then "0s0jvc9ha6fw8qy7f5n0v6zf043rawsjdlm5wvqxq1q2idz7xcw1" + 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_0_2 ] ++ + (if stdenv.isLinux then [ pam lttng-ust ] else [ darwin.Libsystem ]); +in +stdenv.mkDerivation rec { + pname = "powershell"; + version = "6.2.3"; + + src = fetchzip { + url = "https://github.com/PowerShell/PowerShell/releases/download/v${version}/powershell-${version}-${platformString}-x64.tar.gz"; + sha256 = platformSha; + stripRoot = false; + }; + + buildInputs = [ less ] ++ libraries; + nativeBuildInputs = [ autoPatchelfHook makeWrapper ]; + + installPhase = '' + mkdir -p $out/bin + mkdir -p $out/share/powershell + cp -r * $out/share/powershell + makeWrapper $out/share/powershell/pwsh $out/bin/pwsh --prefix ${platformLdLibraryPath} : "${stdenv.lib.makeLibraryPath libraries}" \ + --set TERM xterm --set POWERSHELL_TELEMETRY_OPTOUT 1 --set DOTNET_CLI_TELEMETRY_OPTOUT 1 + ''; + + dontStrip = true; + + meta = with stdenv.lib; { + description = "Cross-platform (Windows, Linux, and macOS) automation and configuration tool/framework"; + homepage = https://github.com/PowerShell/PowerShell; + maintainers = [ maintainers.yrashk ]; + platforms = platforms.unix; + 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 00000000000..a8a7d4f6e77 --- /dev/null +++ b/nixpkgs/pkgs/shells/rc/default.nix @@ -0,0 +1,42 @@ +{ 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 ] + ++ stdenv.lib.optionals (readline != null) [ readline ]; + + configureFlags = [ + "--enable-def-interp=${stdenv.shell}" #183 + ] ++ stdenv.lib.optionals historySupport [ "--with-history" ] + ++ stdenv.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 stdenv.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/rssh/default.nix b/nixpkgs/pkgs/shells/rssh/default.nix new file mode 100644 index 00000000000..ecefbff7d22 --- /dev/null +++ b/nixpkgs/pkgs/shells/rssh/default.nix @@ -0,0 +1,97 @@ +# CAVEATS: +# - Have only tested this with rsync, scp, and sftp. cvs support should work, but chroot integration is unlikely to function without further work +# - It is compiled without rdist support because rdist is ludicrously ancient (and not already in nixpkgs) + +{ stdenv, fetchurl, openssh, rsync, cvs }: + +stdenv.mkDerivation rec { + pname = "rssh"; + version = "2.3.4"; + + src = fetchurl { + url = "mirror://sourceforge/rssh/rssh/${version}/${pname}-${version}.tar.gz"; + sha256 = "f30c6a760918a0ed39cf9e49a49a76cb309d7ef1c25a66e77a41e2b1d0b40cd9"; + }; + + patches = [ + ./fix-config-path.patch + + # Patches from AUR + (fetchurl { + url = https://aur.archlinux.org/cgit/aur.git/plain/0001-fail-logging.patch?h=rssh; + name = "0001-fail-logging.patch"; + sha256 = "d30f2f4fdb1b57f94773f5b0968a4da3356b14a040efe69ec1e976c615035c65"; + }) + (fetchurl { + url = https://aur.archlinux.org/cgit/aur.git/plain/0002-info-to-debug.patch?h=rssh; + name = "0002-info-to-debug.patch"; + sha256 = "86f6ecf34f62415b0d6204d4cbebc47322dc2ec71732d06aa27758e35d688fcd"; + }) + (fetchurl { + url = https://aur.archlinux.org/cgit/aur.git/plain/0003-man-page-spelling.patch?h=rssh; + name = "0003-man-page-spelling.patch"; + sha256 = "455b3bbccddf1493999d00c2cd46e62930ef4fd8211e0b7d3a89d8010d6a5431"; + }) + (fetchurl { + url = https://aur.archlinux.org/cgit/aur.git/plain/0004-mkchroot.patch?h=rssh; + name = "0004-mkchroot.patch"; + sha256 = "f7fd8723d2aa94e64e037c13c2f263a52104af680ab52bfcaea73dfa836457c2"; + }) + (fetchurl { + url = https://aur.archlinux.org/cgit/aur.git/plain/0005-mkchroot-arch.patch?h=rssh; + name = "0005-mkchroot-arch.patch"; + sha256 = "ac8894c4087a063ae8267d2fdfcde69c2fe6b67a8ff5917e4518b8f73f08ba3f"; + }) + (fetchurl { + url = https://aur.archlinux.org/cgit/aur.git/plain/0006-mkchroot-symlink.patch?h=rssh; + name = "0006-mkchroot-symlink.patch"; + sha256 = "bce98728cb9b55c92182d4901c5f9adf49376a07c5603514b0004e3d1c85e9c7"; + }) + (fetchurl { + url = https://aur.archlinux.org/cgit/aur.git/plain/0007-destdir.patch?h=rssh; + name = "0007-destdir.patch"; + sha256 = "7fa03644f81dc37d77cc7e2cad994f17f91b2b8a49b1a74e41030a4ac764385e"; + }) + (fetchurl { + url = https://aur.archlinux.org/cgit/aur.git/plain/0008-rsync-protocol.patch?h=rssh; + name = "0008-rsync-protocol.patch"; + sha256 = "0c772afe9088eeded129ead86775ef18e58c318bbc58fc3e2585e7ff09cc5e91"; + }) + ]; + + # Run this after to avoid conflict with patches above + postPatch = '' + sed -i '/chmod u+s/d' Makefile.in + ''; + + + buildInputs = [ openssh rsync cvs ]; + + configureFlags = [ + "--with-sftp-server=${openssh}/libexec/sftp-server" + "--with-scp=${openssh}/bin/scp" + "--with-rsync=${rsync}/bin/rsync" + "--with-cvs=${cvs}/bin/cvs" + ]; + + + meta = with stdenv.lib; { + description = "A restricted shell for use with OpenSSH, allowing only scp and/or sftp"; + longDescription = '' + rssh also includes support for rsync and cvs. For example, if you have a server which you only want to allow users to copy files off of via scp, without providing shell access, you can use rssh to do that. + ''; + homepage = http://www.pizzashack.org/rssh/; + license = licenses.bsd2; + platforms = platforms.linux; + maintainers = with maintainers; [ arobyn ]; + knownVulnerabilities = [ + "CVE-2019-1000018" + "CVE-2019-3463" + "CVE-2019-3464" + ]; + }; + + passthru = { + shellPath = "/bin/rssh"; + }; +} diff --git a/nixpkgs/pkgs/shells/rssh/fix-config-path.patch b/nixpkgs/pkgs/shells/rssh/fix-config-path.patch new file mode 100644 index 00000000000..eecffb376ab --- /dev/null +++ b/nixpkgs/pkgs/shells/rssh/fix-config-path.patch @@ -0,0 +1,12 @@ +diff -Naur rssh-2.3.4/Makefile.in rssh-2.3.4-fixed/Makefile.in +--- rssh-2.3.4/Makefile.in 2012-11-27 11:19:34.000000000 +1100 ++++ rssh-2.3.4-fixed/Makefile.in 2015-11-11 21:13:58.516651742 +1100 +@@ -186,7 +186,7 @@ + sysconfdir = @sysconfdir@ + target_alias = @target_alias@ + AUTOMAKE_OPTIONS = nostdinc +-ourdefs = -DPATH_RSSH_CONFIG=\"@sysconfdir@/rssh.conf\" -DPATH_CHROOT_HELPER=\"@libexecdir@/rssh_chroot_helper\" ++ourdefs = -DPATH_RSSH_CONFIG=\"/etc/rssh.conf\" -DPATH_CHROOT_HELPER=\"@libexecdir@/rssh_chroot_helper\" + ourflags = @defcflags@ @static@ + AM_CFLAGS = $(ourflags) + nodist_rssh_SOURCES = main.c pathnames.h config.h diff --git a/nixpkgs/pkgs/shells/rush/default.nix b/nixpkgs/pkgs/shells/rush/default.nix new file mode 100644 index 00000000000..9db36bc85fc --- /dev/null +++ b/nixpkgs/pkgs/shells/rush/default.nix @@ -0,0 +1,41 @@ +{ fetchurl, 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 = stdenv.lib.licenses.gpl3Plus; + + maintainers = [ stdenv.lib.maintainers.bjg ]; + platforms = stdenv.lib.platforms.all; + }; + + passthru = { + shellPath = "/bin/rush"; + }; +} diff --git a/nixpkgs/pkgs/shells/tcsh/default.nix b/nixpkgs/pkgs/shells/tcsh/default.nix new file mode 100644 index 00000000000..f13919e52e7 --- /dev/null +++ b/nixpkgs/pkgs/shells/tcsh/default.nix @@ -0,0 +1,49 @@ +{ stdenv, fetchurl, fetchpatch +, ncurses }: + +stdenv.mkDerivation rec { + pname = "tcsh"; + version = "6.21.00"; + + src = fetchurl { + urls = [ + "http://ftp.funet.fi/pub/mirrors/ftp.astron.com/pub/tcsh/${pname}-${version}.tar.gz" + "ftp://ftp.astron.com/pub/tcsh/${pname}-${version}.tar.gz" + "ftp://ftp.funet.fi/pub/unix/shells/tcsh/${pname}-${version}.tar.gz" + ]; + sha256 = "0wp9cqkzdj5ahfyg9bn5z1wnyblqyv9vz4sc5aqmj7rp91a34f64"; + }; + + buildInputs = [ ncurses ]; + + patches = stdenv.lib.optional stdenv.hostPlatform.isMusl + (fetchpatch { + name = "sysmalloc.patch"; + url = "https://git.alpinelinux.org/cgit/aports/plain/community/tcsh/001-sysmalloc.patch?id=184585c046cdd56512f1a76e426dd799b368f8cf"; + sha256 = "1qc6ydxhdfizsbkaxhpn3wib8sfphrw10xnnsxx2prvzg9g2zp67"; + }); + + meta = with stdenv.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 = http://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 00000000000..58dd629929f --- /dev/null +++ b/nixpkgs/pkgs/shells/xonsh/default.nix @@ -0,0 +1,49 @@ +{ stdenv, fetchFromGitHub, python3Packages, glibcLocales, coreutils, git }: + +python3Packages.buildPythonApplication rec { + pname = "xonsh"; + version = "0.9.13"; + + # fetch from github because the pypi package ships incomplete tests + src = fetchFromGitHub { + owner = "xonsh"; + repo = "xonsh"; + rev = "refs/tags/${version}"; + sha256 = "0nk6rjdkbxli510iwqspvray48kdxvbdmq1k8nxn14kqfpqzlbcv"; + }; + + 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 -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' + 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 stdenv.lib; { + description = "A Python-ish, BASHwards-compatible shell"; + homepage = http://xon.sh/; + 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 00000000000..e1bfc68dc4d --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/antibody/default.nix @@ -0,0 +1,24 @@ +{ lib, buildGoModule, fetchFromGitHub }: + +buildGoModule rec { + pname = "antibody"; + version = "4.2.0"; + + goPackagePath = "github.com/getantibody/antibody"; + + src = fetchFromGitHub { + owner = "getantibody"; + repo = "antibody"; + rev = "v${version}"; + sha256 = "1vds7mxqxa7xlhvjvmnh1nr1ra3dciav0qlv45s1dmwn5qrcilci"; + }; + + modSha256 = "1n9sgrm16iig600f4q1cmbwwk0822isjvbyazplylha843510b17"; + + meta = with lib; { + description = "The fastest shell plugin manager"; + homepage = https://github.com/getantibody/antibody; + license = licenses.mit; + maintainers = with maintainers; [ filalex77 worldofpeace ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/antigen/default.nix b/nixpkgs/pkgs/shells/zsh/antigen/default.nix new file mode 100644 index 00000000000..c754d7bbe58 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/antigen/default.nix @@ -0,0 +1,25 @@ +{ 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"; + }; + + phases = "installPhase"; + + 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 = stdenv.lib.licenses.mit; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/default.nix b/nixpkgs/pkgs/shells/zsh/default.nix new file mode 100644 index 00000000000..0a26b8a7821 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/default.nix @@ -0,0 +1,92 @@ +{ stdenv, fetchurl, ncurses, pcre, buildPackages }: + +let + version = "5.7.1"; + + documentation = fetchurl { + url = "mirror://sourceforge/zsh/zsh-${version}-doc.tar.xz"; + sha256 = "1d1r88n1gfdavx4zy3svl1gljrvzim17jb2r834hafg2a016flrh"; + }; +in + +stdenv.mkDerivation { + pname = "zsh"; + inherit version; + + src = fetchurl { + url = "mirror://sourceforge/zsh/zsh-${version}.tar.xz"; + sha256 = "1s3yww0mzgvpc48kp0x868mm3gbna42sbgzya0nknj0x5hn2jq3j"; + }; + + buildInputs = [ ncurses pcre ]; + + configureFlags = [ + "--enable-maildir-support" + "--enable-multibyte" + "--with-tcsetpgrp" + "--enable-pcre" + "--enable-zprofile=${placeholder "out"}/etc/zprofile" + ]; + + # the zsh/zpty module is not available on hydra + # so skip groups Y Z + checkFlags = map (T: "TESTNUM=${T}") (stdenv.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 '' + ${stdenv.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 = http://www.zsh.org/; + maintainers = with stdenv.lib.maintainers; [ pSub ]; + platforms = stdenv.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 00000000000..e97ef1074f1 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/fzf-zsh/default.nix @@ -0,0 +1,37 @@ +{ 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 stdenv.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 00000000000..d13fd8aee00 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/gradle-completion/default.nix @@ -0,0 +1,35 @@ +{ 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 stdenv.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 00000000000..d23999abf3d --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/grml-zsh-config/default.nix @@ -0,0 +1,41 @@ +{ stdenv, fetchFromGitHub, lib +, zsh, coreutils, inetutils, procps, txt2tags }: + +with lib; + +stdenv.mkDerivation rec { + pname = "grml-zsh-config"; + version = "0.16.1"; + + src = fetchFromGitHub { + owner = "grml"; + repo = "grml-etc-core"; + rev = "v${version}"; + sha256 = "1dmhwgs5v4f1yanbi6dg1lbpzmvq1l3dq7sra811ycsf4f6g0d7f"; + }; + + buildInputs = [ zsh coreutils txt2tags procps ] + ++ optional stdenv.isLinux inetutils; + + 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 stdenv.lib; { + description = "grml's zsh setup"; + homepage = http://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 00000000000..1794979bedf --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/lambda-mod-zsh-theme/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchFromGitHub, zsh }: + +stdenv.mkDerivation { + name = "lambda-mod-zsh-theme-unstable-2019-04-17"; + + src = fetchFromGitHub { + owner = "halfo"; + repo = "lambda-mod-zsh-theme"; + rev = "6b83aedf9de41ea4e226cdbc78af1b7b92beb6ac"; + sha256 = "1xf451c349fxnqbvsb07y9r1iqrwslx6x4b6drmnqqqy4yx1r5dj"; + }; + + buildInputs = [ zsh ]; + + installPhase = '' + chmod +x lambda-mod.zsh-theme # only executable scripts are found by `patchShebangs` + patchShebangs . + + install -Dm0644 lambda-mod.zsh-theme $out/share/zsh/themes/lambda-mod.zsh-theme + ''; + + meta = with stdenv.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.linux; + 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 00000000000..036c388fbda --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/nix-zsh-completions/default.nix @@ -0,0 +1,31 @@ +{ stdenv, fetchFromGitHub }: + +let + version = "0.4.3"; +in + +stdenv.mkDerivation { + pname = "nix-zsh-completions"; + inherit version; + + src = fetchFromGitHub { + owner = "spwhitt"; + repo = "nix-zsh-completions"; + rev = version; + sha256 = "0fq1zlnsj1bb7byli7mwlz7nm2yszwmyx43ccczcv51mjjfivyp3"; + }; + + 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 stdenv.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 00000000000..e53ee1394ed --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix @@ -0,0 +1,74 @@ +# This script was inspired by the ArchLinux User Repository package: +# +# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=oh-my-zsh-git +{ stdenv, fetchgit }: + +stdenv.mkDerivation rec { + version = "2020-01-04"; + pname = "oh-my-zsh"; + rev = "78b07e92fd4a3a5e1f92ee4e3d680c39b72c2245"; + + src = fetchgit { inherit rev; + url = "https://github.com/ohmyzsh/ohmyzsh"; + sha256 = "1s5vr89dxgm1g3jcqybx4an80x0gmda4lh8y36r2dafxwmb09qmk"; + }; + + pathsToLink = [ "/share/oh-my-zsh" ]; + + phases = "installPhase"; + + installPhase = '' + outdir=$out/share/oh-my-zsh + template=templates/zshrc.zsh-template + + mkdir -p $outdir + cp -r $src/* $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 + + # 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 + ''; + + meta = with stdenv.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; [ scolobb nequissimus ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/oh-my-zsh/update.sh b/nixpkgs/pkgs/shells/zsh/oh-my-zsh/update.sh new file mode 100755 index 00000000000..0146cac8496 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/oh-my-zsh/update.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl common-updater-scripts jq + +set -eu -o pipefail + +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')" +url="$(nix-instantiate --eval -E "with import ./. {}; oh-my-zsh.src.url" | tr -d '"')" + +if [ ! "null" = "${latestSha}" ]; then + latestDate="$(curl -L -s https://api.github.com/repos/ohmyzsh/ohmyzsh/commits/${latestSha} | jq '.commit.author.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 + nixpkgs="$(git rev-parse --show-toplevel)" + default_nix="$nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix" + git add "${default_nix}" + git commit -m "oh-my-zsh: ${oldVersion} -> ${latestDate}" +else + echo "oh-my-zsh is already up-to-date" +fi 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 00000000000..0e7536b4fa1 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/spaceship-prompt/default.nix @@ -0,0 +1,33 @@ +{ stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "spaceship-prompt"; + version = "3.11.2"; + + src = fetchFromGitHub { + owner = "denysdovhan"; + repo = "spaceship-prompt"; + sha256 = "1q7m9mmg82n4fddfz01y95d5n34xnzhrnn1lli0vih39sgmzim9b"; + rev = "v${version}"; + }; + + installPhase = '' + install -D -m644 LICENSE.md "$out/share/licenses/spaceship-prompt/LICENSE" + install -D -m644 README.md "$out/share/doc/spaceship-prompt/README.md" + find docs -type f -exec install -D -m644 {} "$out/share/doc/spaceship-prompt/{}" \; + find lib -type f -exec install -D -m644 {} "$out/lib/spaceship-prompt/{}" \; + find scripts -type f -exec install -D -m644 {} "$out/lib/spaceship-prompt/{}" \; + find sections -type f -exec install -D -m644 {} "$out/lib/spaceship-prompt/{}" \; + install -D -m644 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" + ''; + + meta = with stdenv.lib; { + description = "Zsh prompt for Astronauts"; + homepage = https://github.com/denysdovhan/spaceship-prompt/; + license = licenses.mit; + platforms = platforms.linux; + maintainers = with maintainers; [ nyanloutre ]; + }; +} 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 00000000000..4e00fee3d27 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-autosuggestions/default.nix @@ -0,0 +1,30 @@ +{ stdenv, fetchFromGitHub, zsh }: + +# To make use of this derivation, use the `programs.zsh.enableAutoSuggestions` option + +stdenv.mkDerivation rec { + pname = "zsh-autosuggestions"; + version = "0.6.3"; + + src = fetchFromGitHub { + owner = "zsh-users"; + repo = "zsh-autosuggestions"; + rev = "v${version}"; + sha256 = "1h8h2mz9wpjpymgl2p7pc146c1jgb3dggpvzwm9ln3in336wl95c"; + }; + + buildInputs = [ zsh ]; + + installPhase = '' + install -D zsh-autosuggestions.zsh \ + $out/share/zsh-autosuggestions/zsh-autosuggestions.zsh + ''; + + meta = with stdenv.lib; { + description = "Fish shell autosuggestions for Zsh"; + homepage = https://github.com/zsh-users/zsh-autosuggestions; + license = licenses.mit; + platforms = platforms.unix; + maintainers = [ maintainers.loskutov ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-command-time/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-command-time/default.nix new file mode 100644 index 00000000000..6228b97685a --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-command-time/default.nix @@ -0,0 +1,34 @@ +{ 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"; + }; + + phases = [ "installPhase" ]; + + installPhase = '' + install -Dm0444 $src/command-time.plugin.zsh --target-directory=$out/share/zsh/plugins/command-time + ''; + + meta = with stdenv.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 00000000000..35355fe374d --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-completions/default.nix @@ -0,0 +1,26 @@ +{ stdenv, fetchFromGitHub}: + +stdenv.mkDerivation rec { + pname = "zsh-completions"; + version = "0.31.0"; + + src = fetchFromGitHub { + owner = "zsh-users"; + repo = pname; + rev = version; + sha256 = "0rw23m8cqxhcb4yjhbzb9lir60zn1xjy7hn3zv1fzz700f0i6fyk"; + }; + + 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 = stdenv.lib.licenses.free; + + platforms = stdenv.lib.platforms.unix; + maintainers = [ stdenv.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 00000000000..735d6a2b761 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-deer/default.nix @@ -0,0 +1,35 @@ +{ 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 stdenv.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 00000000000..03850d7e5c1 --- /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 00000000000..452419bf8b0 --- /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.54"; + + src = fetchFromGitHub { + owner = "zdharma"; + repo = "fast-syntax-highlighting"; + rev = "v${version}"; + sha256 = "019hda2pj8lf7px4h1z07b9l6icxx4b2a072jw36lz9bh6jahp32"; + }; + + 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-git-prompt/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-git-prompt/default.nix new file mode 100644 index 00000000000..6aadf3163d3 --- /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, stdenv }: + 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 = stdenv.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 00000000000..fcd294f4dce --- /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 00000000000..ece3c87cb66 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-history/default.nix @@ -0,0 +1,36 @@ +{ 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 ]; + + modSha256 = "0f10b86gyn7m7lw43c8y1m30mdg0i092a319v3cb2qj05jb9vn42"; + goPackagePath = "github.com/b4b4r07/history"; + + 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; [ kampka ]; + }; + + passthru.tests = { + zsh-history-shell-integration = nixosTests.zsh-history; + }; +} 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 00000000000..d5081476efb --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-powerlevel10k/default.nix @@ -0,0 +1,39 @@ +{ stdenv, fetchFromGitHub, substituteAll, pkgs }: + +# To make use of this derivation, use +# `programs.zsh.promptInit = "source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme";` + +stdenv.mkDerivation { + pname = "powerlevel10k"; + version = "unstable-2019-12-19"; + src = fetchFromGitHub { + owner = "romkatv"; + repo = "powerlevel10k"; + rev = "8ef2b737d1f6099966a1eb16bdfc90d67b367f22"; + sha256 = "02b25klkyyhpdbf2vwzzbrd8hnfjpckbpjy6532ir6jqp2n2ivpj"; + }; + + patches = [ + (substituteAll { + src = ./gitstatusd.patch; + gitstatusdPath = "${pkgs.gitAndTools.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 + rm -r gitstatus/bin + install -D gitstatus/* --target-directory=$out/share/zsh-powerlevel10k/gitstatus + ''; + + meta = { + description = "A fast reimplementation of Powerlevel9k ZSH theme"; + homepage = "https://github.com/romkatv/powerlevel10k"; + license = stdenv.lib.licenses.mit; + + platforms = stdenv.lib.platforms.unix; + maintainers = [ stdenv.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 00000000000..a4440079e4b --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-powerlevel10k/gitstatusd.patch @@ -0,0 +1,14 @@ +diff --git a/gitstatus/gitstatus.plugin.zsh b/gitstatus/gitstatus.plugin.zsh +index 46d0b3c..b082e24 100644 +--- a/gitstatus/gitstatus.plugin.zsh ++++ b/gitstatus/gitstatus.plugin.zsh +@@ -53,6 +53,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 00000000000..c80ff0da60a --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-powerlevel9k/default.nix @@ -0,0 +1,29 @@ +{ 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 = stdenv.lib.licenses.mit; + + platforms = stdenv.lib.platforms.unix; + maintainers = [ stdenv.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 00000000000..383d1967531 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-prezto/default.nix @@ -0,0 +1,32 @@ +{ stdenv, fetchgit }: + +stdenv.mkDerivation { + name = "zsh-prezto-2019-03-18"; + src = fetchgit { + url = "https://github.com/sorin-ionescu/prezto"; + rev = "1f4601e44c989b90dc7314b151891fa60a101251"; + sha256 = "1dcd5r7pc4biiplm0lh7yca0h6hs0xpaq9dwaarmfsh9wrd68350"; + fetchSubmodules = true; + }; + buildPhase = '' + sed -i '/\''${ZDOTDIR:\-\$HOME}\/.zpreztorc" ]]/i\ + if [[ -s "/etc/zpreztorc" ]]; then\ + source "/etc/zpreztorc"\ + fi' init.zsh + sed -i -e "s|\''${ZDOTDIR:\-\$HOME}/.zprezto/|$out/|g" init.zsh + for i in runcoms/*; do + sed -i -e "s|\''${ZDOTDIR:\-\$HOME}/.zprezto/|$out/|g" $i + done + ''; + installPhase = '' + mkdir -p $out + cp ./* $out/ -R + ''; + meta = with stdenv.lib; { + description = "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; [ ]; + platforms = with 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 00000000000..0dbfba52c0f --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-syntax-highlighting/default.nix @@ -0,0 +1,27 @@ +{ stdenv, fetchFromGitHub, zsh }: + +# To make use of this derivation, use the `programs.zsh.enableSyntaxHighlighting` option + +stdenv.mkDerivation rec { + version = "0.6.0"; + pname = "zsh-syntax-highlighting"; + + src = fetchFromGitHub { + owner = "zsh-users"; + repo = "zsh-syntax-highlighting"; + rev = version; + sha256 = "0zmq66dzasmr5pwribyh4kbkk23jxbpdw4rjxx0i7dx8jjp2lzl4"; + }; + + buildInputs = [ zsh ]; + + installFlags = [ "PREFIX=$(out)" ]; + + meta = with stdenv.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-you-should-use/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-you-should-use/default.nix new file mode 100644 index 00000000000..becc4c57e4b --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-you-should-use/default.nix @@ -0,0 +1,26 @@ +{ stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "zsh-you-should-use"; + version = "1.6.0"; + + src = fetchFromGitHub { + owner = "MichaelAquilina"; + repo = pname; + rev = version; + sha256 = "1xzq7xmmx4rg53pd69d0s9n561q4z35hlbb2sq2xd76gk3x6fars"; + }; + + dontBuild = true; + + installPhase = '' + install -D you-should-use.plugin.zsh $out/share/zsh/plugins/you-should-use/you-should-use.plugin.zsh + ''; + + meta = with stdenv.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 ]; + }; +} |