diff options
Diffstat (limited to 'nixpkgs/pkgs/shells')
93 files changed, 3853 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/shells/any-nix-shell/default.nix b/nixpkgs/pkgs/shells/any-nix-shell/default.nix new file mode 100644 index 000000000000..3bd41a53844c --- /dev/null +++ b/nixpkgs/pkgs/shells/any-nix-shell/default.nix @@ -0,0 +1,27 @@ +{ lib, stdenv, fetchFromGitHub, makeWrapper }: + +stdenv.mkDerivation rec { + pname = "any-nix-shell"; + version = "1.2.1"; + + src = fetchFromGitHub { + owner = "haslersn"; + repo = "any-nix-shell"; + rev = "v${version}"; + sha256 = "0q27rhjhh7k0qgcdcfm8ly5za6wm4rckh633d0sjz87faffkp90k"; + }; + + nativeBuildInputs = [ makeWrapper ]; + installPhase = '' + mkdir -p $out/bin + cp -r bin $out + wrapProgram $out/bin/any-nix-shell --prefix PATH ":" $out/bin + ''; + + meta = with lib; { + description = "fish and zsh support for nix-shell"; + license = licenses.mit; + homepage = "https://github.com/haslersn/any-nix-shell"; + maintainers = with maintainers; [ haslersn ]; + }; +} diff --git a/nixpkgs/pkgs/shells/bash/5.1.nix b/nixpkgs/pkgs/shells/bash/5.1.nix new file mode 100644 index 000000000000..efa90b0499eb --- /dev/null +++ b/nixpkgs/pkgs/shells/bash/5.1.nix @@ -0,0 +1,132 @@ +{ lib, stdenv +, buildPackages +, fetchurl +, binutils ? null +, bison +, util-linux + + # patch for cygwin requires readline support +, interactive ? stdenv.isCygwin +, readline81 ? null +, withDocs ? false +, texinfo ? null +}: + +with lib; + +assert interactive -> readline81 != null; +assert withDocs -> texinfo != null; +assert stdenv.hostPlatform.isDarwin -> binutils != null; +let + upstreamPatches = import ./bash-5.1-patches.nix (nr: sha256: fetchurl { + url = "mirror://gnu/bash/bash-5.1-patches/bash51-${nr}"; + inherit sha256; + }); +in +stdenv.mkDerivation rec { + name = "bash-${optionalString interactive "interactive-"}${version}-p${toString (builtins.length upstreamPatches)}"; + version = "5.1"; + + src = fetchurl { + url = "mirror://gnu/bash/bash-${version}.tar.gz"; + sha256 = "1alv68wplnfdm6mh39hm57060xgssb9vqca4yr1cyva0c342n0fc"; + }; + + hardeningDisable = [ "format" ]; + + outputs = [ "out" "dev" "man" "doc" "info" ]; + + NIX_CFLAGS_COMPILE = '' + -DSYS_BASHRC="/etc/bashrc" + -DSYS_BASH_LOGOUT="/etc/bash_logout" + -DDEFAULT_PATH_VALUE="/no-such-path" + -DSTANDARD_UTILS_PATH="/no-such-path" + -DNON_INTERACTIVE_LOGIN_SHELLS + -DSSH_SOURCE_BASHRC + ''; + + patchFlags = [ "-p0" ]; + + patches = upstreamPatches + ++ [ ./pgrp-pipe-5.1.patch ]; + + configureFlags = [ + (if interactive then "--with-installed-readline" else "--disable-readline") + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "bash_cv_job_control_missing=nomissing" + "bash_cv_sys_named_pipes=nomissing" + "bash_cv_getcwd_malloc=yes" + ] ++ optionals stdenv.hostPlatform.isCygwin [ + "--without-libintl-prefix" + "--without-libiconv-prefix" + "--with-installed-readline" + "bash_cv_dev_stdin=present" + "bash_cv_dev_fd=standard" + "bash_cv_termcap_lib=libncurses" + ] ++ optionals (stdenv.hostPlatform.libc == "musl") [ + "--without-bash-malloc" + "--disable-nls" + ]; + + # Note: Bison is needed because the patches above modify parse.y. + depsBuildBuild = [ buildPackages.stdenv.cc ]; + nativeBuildInputs = [ bison ] + ++ optional withDocs texinfo + ++ optional stdenv.hostPlatform.isDarwin binutils; + + buildInputs = optional interactive readline81; + + enableParallelBuilding = true; + + makeFlags = optional stdenv.hostPlatform.isCygwin [ + "LOCAL_LDFLAGS=-Wl,--export-all,--out-implib,libbash.dll.a" + "SHOBJ_LIBS=-lbash" + ]; + + checkInputs = [ util-linux ]; + doCheck = false; # dependency cycle, needs to be interactive + + postInstall = '' + ln -s bash "$out/bin/sh" + rm -f $out/lib/bash/Makefile.inc + ''; + + postFixup = + if interactive + then '' + substituteInPlace "$out/bin/bashbug" \ + --replace '${stdenv.shell}' "$out/bin/bash" + '' + # most space is taken by locale data + else '' + rm -rf "$out/share" "$out/bin/bashbug" + ''; + + meta = with lib; { + homepage = "https://www.gnu.org/software/bash/"; + description = + "GNU Bourne-Again Shell, the de facto standard shell on Linux" + + (if interactive then " (for interactive use)" else ""); + + longDescription = '' + Bash is the shell, or command language interpreter, that will + appear in the GNU operating system. Bash is an sh-compatible + shell that incorporates useful features from the Korn shell + (ksh) and C shell (csh). It is intended to conform to the IEEE + POSIX P1003.2/ISO 9945.2 Shell and Tools standard. It offers + functional improvements over sh for both programming and + interactive use. In addition, most sh scripts can be run by + Bash without modification. + ''; + + license = licenses.gpl3Plus; + + platforms = platforms.all; + + maintainers = with maintainers; [ dtzWill ]; + }; + + passthru = { + shellPath = "/bin/bash"; + }; +} diff --git a/nixpkgs/pkgs/shells/bash/bash-5.1-patches.nix b/nixpkgs/pkgs/shells/bash/bash-5.1-patches.nix new file mode 100644 index 000000000000..e6e9461bcbef --- /dev/null +++ b/nixpkgs/pkgs/shells/bash/bash-5.1-patches.nix @@ -0,0 +1,16 @@ +# Automatically generated by `update-patch-set.sh'; do not edit. + +patch: [ +(patch "001" "1ymm8ppss6gyh9ifznjwiabrb4k91npd09c10y7mk66xp8yppc7b") +(patch "002" "1gjx9zqcm407am3n2sh44b8dxm48kgm15rzfiijqxr01m0hn3shm") +(patch "003" "1cdnpbfc64yhvkjj4d12s9ywp11g195vzfl1cab24sq55wkcrwi2") +(patch "004" "11iwhy6v562bv0kk7lwj7f5jj65ma9bblivy0v02h3ggcibbdbls") +(patch "005" "19bdyigdr81824nxvqr6a7k0cax60wq7376j6b91afbnwvlvbjyc") +(patch "006" "051x8wlwrqk0yr0zg378vh824iklfl5g9pkmcdf62qp8gn9pvqbm") +(patch "007" "0fir80pp1gmlpadmqcgkrv4y119pc7xllchjzg05fd7px73viz5c") +(patch "008" "1lfjgshk8i9vch92p5wgc9r90j3phw79aa7gbai89w183b2z6b7j") +(patch "009" "1vn36dzd9g4y1h3jiss6418crla0rbcd0d6wwsyv9d5l7aaxlp74") +(patch "010" "0amfmvbzsand7bdypylkjdpcp88fa3cplfshn7vyzv2ff2rdgj52") +(patch "011" "0yq24abb4fzfxqnwl20b330sxl9lr9ds0nc4yi30f81l94b1y6aq") +(patch "012" "165bff97ffih49vfs4mkr5w3z5gn1w6zfyrf773iajkw6v48kw8h") +] diff --git a/nixpkgs/pkgs/shells/bash/bash-completion/default.nix b/nixpkgs/pkgs/shells/bash/bash-completion/default.nix new file mode 100644 index 000000000000..6571d572a429 --- /dev/null +++ b/nixpkgs/pkgs/shells/bash/bash-completion/default.nix @@ -0,0 +1,73 @@ +{ lib, stdenv, fetchurl +, fetchpatch +, autoreconfHook +, perl +, ps +, python3Packages +, bashInteractive +}: + +stdenv.mkDerivation rec { + pname = "bash-completion"; + version = "2.11"; + + # Using fetchurl because fetchGithub or fetchzip will have trouble on + # e.g. APFS filesystems (macOS) because of non UTF-8 characters in some of the + # test fixtures that are part of the repository. + # See discussion in https://github.com/NixOS/nixpkgs/issues/107768 + src = fetchurl { + url = "https://github.com/scop/${pname}/releases/download/${version}/${pname}-${version}.tar.xz"; + sha256 = "1b0iz7da1sgifx1a5wdyx1kxbzys53v0kyk8nhxfipllmm5qka3k"; + }; + + nativeBuildInputs = [ autoreconfHook ]; + + # tests are super flaky unfortunately, and regularily break. + # let's disable them for now. + doCheck = false; + checkInputs = [ + # perl is assumed by perldoc completion + perl + # ps assumed to exist by gdb, killall, pgrep, pidof, + # pkill, pwdx, renice, and reptyr completions + ps + python3Packages.pexpect + python3Packages.pytest + bashInteractive + ]; + + # - ignore test_gcc on ARM because it assumes -march=native + # - ignore test_chsh because it assumes /etc/shells exists + # - ignore test_ether_wake, test_ifdown, test_ifstat, test_ifup, + # test_iperf, test_iperf3, test_nethogs and ip_addresses + # because they try to touch network + # - ignore test_ls because impure logic + # - ignore test_screen because it assumes vt terminals exist + checkPhase = '' + pytest . \ + ${lib.optionalString (stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isAarch32) "--ignore=test/t/test_gcc.py"} \ + --ignore=test/t/test_chsh.py \ + --ignore=test/t/test_ether_wake.py \ + --ignore=test/t/test_ifdown.py \ + --ignore=test/t/test_ifstat.py \ + --ignore=test/t/test_ifup.py \ + --ignore=test/t/test_iperf.py \ + --ignore=test/t/test_iperf3.py \ + --ignore=test/t/test_nethogs.py \ + --ignore=test/t/unit/test_unit_ip_addresses.py \ + --ignore=test/t/test_ls.py \ + --ignore=test/t/test_screen.py + ''; + + prePatch = lib.optionalString stdenv.isDarwin '' + sed -i -e 's/readlink -f/readlink/g' bash_completion completions/* + ''; + + meta = with lib; { + homepage = "https://github.com/scop/bash-completion"; + description = "Programmable completion for the bash shell"; + license = licenses.gpl2Plus; + platforms = platforms.unix; + maintainers = [ maintainers.xfix ]; + }; +} diff --git a/nixpkgs/pkgs/shells/bash/nix-bash-completions/default.nix b/nixpkgs/pkgs/shells/bash/nix-bash-completions/default.nix new file mode 100644 index 000000000000..2e8b49385fb4 --- /dev/null +++ b/nixpkgs/pkgs/shells/bash/nix-bash-completions/default.nix @@ -0,0 +1,38 @@ +{ lib, stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + version = "0.6.8"; + pname = "nix-bash-completions"; + + src = fetchFromGitHub { + owner = "hedning"; + repo = "nix-bash-completions"; + rev = "v${version}"; + sha256 = "1n5zs6xcnv4bv1hdaypmz7fv4j7dsr4a0ifah99iyj4p5j85i1bc"; + }; + + # To enable lazy loading via. bash-completion we need a symlink to the script + # from every command name. + installPhase = '' + commands=$( + function complete() { shift 2; echo "$@"; } + shopt -s extglob + source _nix + ) + install -Dm444 -t $out/share/bash-completion/completions _nix + cd $out/share/bash-completion/completions + for c in $commands; do + ln -s _nix $c + done + ''; + + meta = with lib; { + homepage = "https://github.com/hedning/nix-bash-completions"; + description = "Bash completions for Nix, NixOS, and NixOps"; + license = licenses.bsd3; + platforms = platforms.all; + maintainers = with maintainers; [ hedning ]; + # Set a lower priority such that the newly provided completion from Nix 2.4 are preferred. + priority = 10; + }; +} diff --git a/nixpkgs/pkgs/shells/bash/pgrp-pipe-5.1.patch b/nixpkgs/pkgs/shells/bash/pgrp-pipe-5.1.patch new file mode 100644 index 000000000000..478327cafc45 --- /dev/null +++ b/nixpkgs/pkgs/shells/bash/pgrp-pipe-5.1.patch @@ -0,0 +1,16 @@ +diff -u ./configure ../bash-5.0-fixed/configure +--- ./configure 2019-01-02 15:43:31.000000000 +0100 ++++ ../bash-5.0-fixed/configure 2020-01-08 14:18:21.017296179 +0100 +@@ -16312,11 +16312,7 @@ + solaris2*) LOCAL_CFLAGS=-DSOLARIS ;; + lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;; + linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading +- case "`uname -r`" in +- 1.*|2.[0123]*) : ;; +- *) $as_echo "#define PGRP_PIPE 1" >>confdefs.h +- ;; +- esac ;; ++ $as_echo "#define PGRP_PIPE 1" >>confdefs.h ;; + netbsd*|openbsd*) LOCAL_CFLAGS="-DDEV_FD_STAT_BROKEN" ;; + *qnx[67]*) LOCAL_LIBS="-lncurses" ;; + *qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;; diff --git a/nixpkgs/pkgs/shells/bash/undistract-me/default.nix b/nixpkgs/pkgs/shells/bash/undistract-me/default.nix new file mode 100644 index 000000000000..9ed5544713d7 --- /dev/null +++ b/nixpkgs/pkgs/shells/bash/undistract-me/default.nix @@ -0,0 +1,79 @@ +{ lib +, stdenvNoCC +, fetchFromGitHub +, fetchpatch +, coreutils +, gnused +, libnotify +, pulseaudio +, sound-theme-freedesktop +, xprop +}: + +stdenvNoCC.mkDerivation rec { + pname = "undistract-me"; + version = "unstable-2020-08-09"; + + src = fetchFromGitHub { + owner = "jml"; + repo = pname; + rev = "2f8ac25c6ad8efcf160d2b480825b1cbb6772aab"; + hash = "sha256-Qw7Cu9q0ZgK/RTvyDdHM5N3eBaKjtYqYH0J+hKMUZX8="; + }; + + patches = [ + # Don't block the terminal when notification sound is played + # + # See https://github.com/jml/undistract-me/pull/69 + (fetchpatch { + url = "https://github.com/jml/undistract-me/commit/2356ebbe8bf2bcb4b95af1ae2bcdc786ce7cc6e8.patch"; + sha256 = "sha256-Ij3OXTOnIQsYhKVmqjChhN1q4ASZ7waOkfQTTp5XfPo="; + }) + + # Fix showing notifications when using Wayland apps with XWayland + # running, or connection to X server fails. + # + # NOTE: Without a real X server, notifications will not be + # suppressed when the window running the command is focused. + # + # See https://github.com/jml/undistract-me/pull/71 + (fetchpatch { + url = "https://github.com/jml/undistract-me/commit/3f4ceaf5a4eba8e3cb02236c48247f87e3d1124f.patch"; + sha256 = "sha256-9AK9Jp3TXJ75Y+jwZXlwQ6j54FW1rOBddoktrm0VX68="; + }) + ]; + + # Patch in dependencies. Can't use makeWrapper because the bash + # functions will be sourced and invoked in a different environment + # for each command invocation. + postPatch = '' + for script in *.bash *.sh; do + substituteInPlace "$script" \ + --replace /usr/share/undistract-me "$out/share/undistract-me" \ + --replace basename ${coreutils}/bin/basename \ + --replace 'cut ' '${coreutils}/bin/cut ' \ + --replace date ${coreutils}/bin/date \ + --replace dirname ${coreutils}/bin/dirname \ + --replace sed ${gnused}/bin/sed \ + --replace notify-send ${libnotify}/bin/notify-send \ + --replace paplay ${pulseaudio}/bin/paplay \ + --replace /usr/share/sounds/freedesktop ${sound-theme-freedesktop}/share/sounds/freedesktop \ + --replace xprop ${xprop}/bin/xprop + done + ''; + + installPhase = '' + mkdir -p "$out/share/undistract-me" "$out/etc/profile.d" "$out/share/licenses/undistract-me" + cp long-running.bash "$out/share/undistract-me" + cp preexec.bash "$out/share/undistract-me" + cp undistract-me.sh "$out/etc/profile.d" + cp LICENSE "$out/share/licenses/undistract-me" + ''; + + meta = with lib; { + description = "Notifies you when long-running terminal commands complete"; + homepage = "https://github.com/jml/undistract-me"; + license = licenses.mit; + maintainers = with maintainers; [ kira-bruneau ]; + }; +} diff --git a/nixpkgs/pkgs/shells/bash/update-patch-set.sh b/nixpkgs/pkgs/shells/bash/update-patch-set.sh new file mode 100755 index 000000000000..ee785cc83123 --- /dev/null +++ b/nixpkgs/pkgs/shells/bash/update-patch-set.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env nix-shell +#!nix-shell --pure -i bash -p wget -p gnupg -p cacert -p nix + +# 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" +DIR=$(dirname "$0") +VERSION_CONDENSED="$(echo "$VERSION" | sed -es/\\.//g)" +PATCH_LIST="$DIR/$PROJECT-$VERSION-patches.nix" + +set -e + +rm -vf "$PATCH_LIST" + +wget "https://tiswww.case.edu/php/chet/gpgkey.asc" +echo "4ef5051ce7200241e65d29c11eb57df8 gpgkey.asc" > gpgkey.asc.md5 +md5sum -c gpgkey.asc.md5 +gpg --import ./gpgkey.asc +rm gpgkey.asc{,.md5} + +( echo "# Automatically generated by \`$(basename "$0")'; do not edit." ; \ + echo "" ; \ + echo "patch: [" ) \ +>> "$PATCH_LIST" + +for i in {001..100} +do + wget -P "$DIR" "ftp.gnu.org/gnu/$PROJECT/$PROJECT-$VERSION-patches/$PROJECT$VERSION_CONDENSED-$i" || break + wget -P "$DIR" "ftp.gnu.org/gnu/$PROJECT/$PROJECT-$VERSION-patches/$PROJECT$VERSION_CONDENSED-$i.sig" + gpg --verify "$DIR/$PROJECT$VERSION_CONDENSED-$i.sig" + hash=$(nix-hash --flat --type sha256 --base32 "$DIR/$PROJECT$VERSION_CONDENSED-$i") + echo "(patch \"$i\" \"$hash\")" \ + >> "$PATCH_LIST" + + rm -f "$DIR/$PROJECT$VERSION_CONDENSED-$i"{,.sig} +done + +echo "]" >> "$PATCH_LIST" + +# bash interprets numbers starting with 0 as octals +echo "Got $((10#$i - 1)) patches." +echo "Patch list has been written to \`$PATCH_LIST'." diff --git a/nixpkgs/pkgs/shells/bash/yarn-completion/default.nix b/nixpkgs/pkgs/shells/bash/yarn-completion/default.nix new file mode 100644 index 000000000000..fabfc0a1ce23 --- /dev/null +++ b/nixpkgs/pkgs/shells/bash/yarn-completion/default.nix @@ -0,0 +1,34 @@ +{ lib +, stdenv +, fetchFromGitHub +, installShellFiles +}: + +stdenv.mkDerivation rec { + pname = "yarn-bash-completion"; + version = "0.17.0"; + + src = fetchFromGitHub { + owner = "dsifford"; + repo = "yarn-completion"; + rev = "v${version}"; + sha256 = "0xflbrbwskjqv3knvc8jqygpvfxh5ak66q7w22d1ng8gwrfqzcng"; + }; + + nativeBuildInputs = [ installShellFiles ]; + + installPhase = '' + runHook preInstall + + installShellCompletion --cmd yarn ./yarn-completion.bash + + runHook postInstall + ''; + + meta = with lib; { + homepage = "https://github.com/dsifford/yarn-completion/"; + description = "Bash completion for Yarn"; + license = licenses.mit; + maintainers = with maintainers; [ DamienCassou ]; + }; +} diff --git a/nixpkgs/pkgs/shells/dash/default.nix b/nixpkgs/pkgs/shells/dash/default.nix new file mode 100644 index 000000000000..2a0d73145607 --- /dev/null +++ b/nixpkgs/pkgs/shells/dash/default.nix @@ -0,0 +1,56 @@ +{ lib +, stdenv +, buildPackages +, autoreconfHook +, fetchurl +, fetchpatch +, libedit +}: + +stdenv.mkDerivation rec { + pname = "dash"; + version = "0.5.11.4"; + + src = fetchurl { + url = "http://gondor.apana.org.au/~herbert/dash/files/${pname}-${version}.tar.gz"; + sha256 = "13g06zqfy4n7jkrbb5l1vw0xcnjvq76i16al8fjc5g33afxbf5af"; + }; + + hardeningDisable = [ "format" ]; + + patches = [ + (fetchpatch { + # Dash executes code when noexec ("-n") is specified + # https://www.openwall.com/lists/oss-security/2020/11/11/3 + url = "https://git.kernel.org/pub/scm/utils/dash/dash.git/patch/?id=29d6f2148f10213de4e904d515e792d2cf8c968e"; + sha256 = "0aadb7aaaan6jxmi6icv4p5gqx7k510yszaqsa29b5giyxz5l9i1"; + }) + + # aarch64-darwin fix from upstream; remove on next release + (fetchpatch { + url = "https://git.kernel.org/pub/scm/utils/dash/dash.git/patch/?id=6f6d1f2da03468c0e131fdcbdcfa9771ffca2614"; + sha256 = "16iz2ylkyhpxqq411ns8pjk8rizh6afhavvsf052wvzsnmmlvfbw"; + }) + ]; + + # configure.ac patched; remove on next release + nativeBuildInputs = [ autoreconfHook ]; + + depsBuildBuild = [ buildPackages.stdenv.cc ]; + buildInputs = [ libedit ]; + + configureFlags = [ "--with-libedit" ]; + + enableParallelBuilding = true; + + meta = with lib; { + homepage = "http://gondor.apana.org.au/~herbert/dash/"; + description = "A POSIX-compliant implementation of /bin/sh that aims to be as small as possible"; + platforms = platforms.unix; + license = with licenses; [ bsd3 gpl2 ]; + }; + + passthru = { + shellPath = "/bin/dash"; + }; +} diff --git a/nixpkgs/pkgs/shells/dgsh/default.nix b/nixpkgs/pkgs/shells/dgsh/default.nix new file mode 100644 index 000000000000..7a6ae67c3ae8 --- /dev/null +++ b/nixpkgs/pkgs/shells/dgsh/default.nix @@ -0,0 +1,45 @@ +{ lib, stdenv, fetchFromGitHub, autoconf, automake, pkg-config, + libtool, check, bison, git, gperf, + perl, texinfo, help2man, gettext, ncurses +}: + +stdenv.mkDerivation { + pname = "dgsh-unstable"; + version = "2017-02-05"; + + src = fetchFromGitHub { + owner = "dspinellis"; + repo = "dgsh"; + rev = "bc4fc2e8009c069ee4df5140c32a2fc15d0acdec"; + sha256 = "0k3hmnarz56wphw45mabn5zcc427l5p77jldh1qqy89pxqy1wnql"; + fetchSubmodules = true; + }; + + patches = [ ./glibc-2.26.patch ]; + + nativeBuildInputs = [ autoconf automake pkg-config libtool check + bison git gettext gperf perl texinfo help2man ncurses + ]; + + configurePhase = '' + cp -r ./unix-tools/coreutils/gnulib gnulib + perl -pi -e \ + 's#./bootstrap #./bootstrap --no-bootstrap-sync --skip-po --no-git --gnulib-srcdir='$PWD/gnulib' #g' \ + unix-tools/Makefile + find . -name \*.diff | xargs rm -f + rm -rf unix-tools/*/gnulib + patchShebangs unix-tools/diffutils/man/help2man + export RSYNC=true # set to rsync binary, eventhough it is not used. + make PREFIX=$out config + ''; + + enableParallelBuilding = true; + + meta = with lib; { + description = "The Directed Graph Shell"; + homepage = "http://www.dmst.aueb.gr/dds/sw/dgsh"; + license = with licenses; asl20; + maintainers = with maintainers; [ vrthra ]; + platforms = with platforms; all; + }; +} diff --git a/nixpkgs/pkgs/shells/dgsh/glibc-2.26.patch b/nixpkgs/pkgs/shells/dgsh/glibc-2.26.patch new file mode 100644 index 000000000000..c66768151316 --- /dev/null +++ b/nixpkgs/pkgs/shells/dgsh/glibc-2.26.patch @@ -0,0 +1,12 @@ +diff --git a/core-tools/src/dgsh-httpval.c b/core-tools/src/dgsh-httpval.c +index 8b5dce3..7b43c3d 100644 +--- a/core-tools/src/dgsh-httpval.c ++++ b/core-tools/src/dgsh-httpval.c +@@ -40,6 +40,7 @@ + #include <sys/stat.h> + #include <unistd.h> + #include <stdlib.h> ++#include <stdint.h> + #include <stdio.h> + #include <string.h> + #include <ctype.h> diff --git a/nixpkgs/pkgs/shells/elvish/default.nix b/nixpkgs/pkgs/shells/elvish/default.nix new file mode 100644 index 000000000000..e94354d68045 --- /dev/null +++ b/nixpkgs/pkgs/shells/elvish/default.nix @@ -0,0 +1,37 @@ +{ lib, buildGoModule, fetchFromGitHub }: + +buildGoModule rec { + pname = "elvish"; + version = "0.17.0"; + + subPackages = [ "cmd/elvish" ]; + + ldflags = [ "-s" "-w" "-X github.com/elves/elvish/pkg/buildinfo.Version==${version}" "-X github.com/elves/elvish/pkg/buildinfo.Reproducible=true" ]; + + src = fetchFromGitHub { + owner = "elves"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-F6yjfsEEBrD6kXUgbMrz+1mxrz0z+sdfeoyztpy7rEk="; + }; + + vendorSha256 = "sha256-810YVxO1rjeDV1XWvE4RmJjGOMdTlicnv7YbvKtoDbM="; + + doCheck = false; + + meta = with lib; { + description = "A friendly and expressive command shell"; + longDescription = '' + Elvish is a friendly interactive shell and an expressive programming + language. It runs on Linux, BSDs, macOS and Windows. Despite its pre-1.0 + status, it is already suitable for most daily interactive use. + ''; + homepage = "https://elv.sh/"; + license = licenses.bsd2; + maintainers = with maintainers; [ vrthra AndersonTorres ]; + }; + + passthru = { + shellPath = "/bin/elvish"; + }; +} diff --git a/nixpkgs/pkgs/shells/es/default.nix b/nixpkgs/pkgs/shells/es/default.nix new file mode 100644 index 000000000000..52131a214a5e --- /dev/null +++ b/nixpkgs/pkgs/shells/es/default.nix @@ -0,0 +1,42 @@ +{ lib, stdenv, fetchurl, readline, bison }: + +stdenv.mkDerivation rec { + + pname = "es"; + version = "0.9.1"; + + src = fetchurl { + url = "https://github.com/wryun/es-shell/releases/download/v${version}/es-${version}.tar.gz"; + sha256 = "1fplzxc6lncz2lv2fyr2ig23rgg5j96rm2bbl1rs28mik771zd5h"; + }; + + # The distribution tarball does not have a single top-level directory. + preUnpack = '' + mkdir $name + cd $name + sourceRoot=. + ''; + + buildInputs = [ readline bison ]; + + configureFlags = [ "--with-readline" ]; + + meta = with lib; { + description = "An extensible shell with higher order functions"; + longDescription = + '' + Es is an extensible shell. The language was derived + from the Plan 9 shell, rc, and was influenced by + functional programming languages, such as Scheme, + and the Tcl embeddable programming language. + ''; + homepage = "http://wryun.github.io/es-shell/"; + license = licenses.publicDomain; + maintainers = with maintainers; [ sjmackenzie ttuegel ]; + platforms = platforms.all; + }; + + passthru = { + shellPath = "/bin/es"; + }; +} diff --git a/nixpkgs/pkgs/shells/fish/babelfish.nix b/nixpkgs/pkgs/shells/fish/babelfish.nix new file mode 100644 index 000000000000..fb938b8f37de --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/babelfish.nix @@ -0,0 +1,21 @@ +{ lib, buildGoModule, fetchFromGitHub }: +buildGoModule rec { + pname = "babelfish"; + version = "1.1.0"; + + src = fetchFromGitHub { + owner = "bouk"; + repo = "babelfish"; + rev = "v${version}"; + sha256 = "0b1knj9llwzwnl4w3d6akvlc57dp0fszjkq98w8wybcvkbpd3ip1"; + }; + + vendorSha256 = "0kspqwbgiqfkfj9a9pdwzc0jdi9p35abqqqjhcpvqwdxw378w5lz"; + + meta = with lib; { + description = "Translate bash scripts to fish"; + homepage = "https://github.com/bouk/babelfish"; + license = licenses.mit; + maintainers = with maintainers; [ bouk kevingriffin ]; + }; +} diff --git a/nixpkgs/pkgs/shells/fish/default.nix b/nixpkgs/pkgs/shells/fish/default.nix new file mode 100644 index 000000000000..cf264f11de8c --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/default.nix @@ -0,0 +1,318 @@ +{ stdenv +, lib +, fetchurl +, coreutils +, which +, gnused +, gnugrep +, groff +, gawk +, man-db +, getent +, libiconv +, pcre2 +, gettext +, ncurses +, python3 +, cmake +, fishPlugins +, procps + +# used to generate autocompletions from manpages and for configuration editing in the browser +, usePython ? true + +, runCommand +, writeText +, nixosTests +, useOperatingSystemEtc ? true + # An optional string containing Fish code that initializes the environment. + # This is run at the very beginning of initialization. If it sets $NIX_PROFILES + # then Fish will use that to configure its function, completion, and conf.d paths. + # For example: + # fishEnvPreInit = "source /etc/fish/my-env-preinit.fish"; + # It can also be a function that takes one argument, which is a function that + # takes a path to a bash file and converts it to fish. For example: + # fishEnvPreInit = source: source "${nix}/etc/profile.d/nix-daemon.sh"; +, fishEnvPreInit ? null +}: +let + etcConfigAppendix = writeText "config.fish.appendix" '' + ############### ↓ Nix hook for sourcing /etc/fish/config.fish ↓ ############### + # # + # Origin: + # This fish package was called with the attribute + # "useOperatingSystemEtc = true;". + # + # Purpose: + # Fish ordinarily sources /etc/fish/config.fish as + # $__fish_sysconfdir/config.fish, + # and $__fish_sysconfdir is defined at compile-time, baked into the C++ + # component of fish. By default, it is set to "/etc/fish". When building + # through Nix, $__fish_sysconfdir gets set to $out/etc/fish. Here we may + # have included a custom $out/etc/config.fish in the fish package, + # as specified, but according to the value of useOperatingSystemEtc, we + # may want to further source the real "/etc/fish/config.fish" file. + # + # When this option is enabled, this segment should appear the very end of + # "$out/etc/config.fish". This is to emulate the behavior of fish itself + # with respect to /etc/fish/config.fish and ~/.config/fish/config.fish: + # source both, but source the more global configuration files earlier + # than the more local ones, so that more local configurations inherit + # from but override the more global locations. + # + # Special care needs to be taken, when fish is called from an FHS user env + # or similar setup, because this configuration file will then be relocated + # to /etc/fish/config.fish, so we test for this case to avoid nontermination. + + if test -f /etc/fish/config.fish && test /etc/fish/config.fish != (status filename) + source /etc/fish/config.fish + end + + # # + ############### ↑ Nix hook for sourcing /etc/fish/config.fish ↑ ############### + ''; + + fishPreInitHooks = writeText "__fish_build_paths_suffix.fish" '' + # source nixos environment + # note that this is required: + # 1. For all shells, not just login shells (mosh needs this as do some other command-line utilities) + # 2. Before the shell is initialized, so that config snippets can find the commands they use on the PATH + builtin status --is-login + or test -z "$__fish_nixos_env_preinit_sourced" -a -z "$ETC_PROFILE_SOURCED" -a -z "$ETC_ZSHENV_SOURCED" + ${if fishEnvPreInit != null then '' + and begin + ${lib.removeSuffix "\n" (if lib.isFunction fishEnvPreInit then fishEnvPreInit sourceWithFenv else fishEnvPreInit)} + end'' else '' + and test -f /etc/fish/nixos-env-preinit.fish + and source /etc/fish/nixos-env-preinit.fish''} + and set -gx __fish_nixos_env_preinit_sourced 1 + + test -n "$NIX_PROFILES" + and begin + # We ensure that __extra_* variables are read in $__fish_datadir/config.fish + # with a preference for user-configured data by making sure the package-specific + # data comes last. Files are loaded/sourced in encounter order, duplicate + # basenames get skipped, so we assure this by prepending Nix profile paths + # (ordered in reverse of the $NIX_PROFILE variable) + # + # Note that at this point in evaluation, there is nothing whatsoever on the + # fish_function_path. That means we don't have most fish builtins, e.g., `eval`. + + + # additional profiles are expected in order of precedence, which means the reverse of the + # NIX_PROFILES variable (same as config.environment.profiles) + set -l __nix_profile_paths (string split ' ' $NIX_PROFILES)[-1..1] + + set -p __extra_completionsdir \ + $__nix_profile_paths"/etc/fish/completions" \ + $__nix_profile_paths"/share/fish/vendor_completions.d" + set -p __extra_functionsdir \ + $__nix_profile_paths"/etc/fish/functions" \ + $__nix_profile_paths"/share/fish/vendor_functions.d" + set -p __extra_confdir \ + $__nix_profile_paths"/etc/fish/conf.d" \ + $__nix_profile_paths"/share/fish/vendor_conf.d" + end + ''; + + # This is wrapped in begin/end in case the user wants to apply redirections. + # This does mean the basic usage of sourcing a single file will produce + # `begin; begin; …; end; end` but that's ok. + sourceWithFenv = path: '' + begin # fenv + # This happens before $__fish_datadir/config.fish sets fish_function_path, so it is currently + # unset. We set it and then completely erase it, leaving its configuration to $__fish_datadir/config.fish + set fish_function_path ${fishPlugins.foreign-env}/share/fish/vendor_functions.d $__fish_datadir/functions + fenv source ${lib.escapeShellArg path} + set -l fenv_status $status + # clear fish_function_path so that it will be correctly set when we return to $__fish_datadir/config.fish + set -e fish_function_path + test $fenv_status -eq 0 + end # fenv + ''; + + fish = stdenv.mkDerivation rec { + pname = "fish"; + version = "3.3.1"; + + src = fetchurl { + # There are differences between the release tarball and the tarball GitHub + # packages from the tag. Specifically, it comes with a file containing its + # version, which is used in `build_tools/git_version_gen.sh` to determine + # the shell's actual version (and what it displays when running `fish + # --version`), as well as the local documentation for all builtins (and + # maybe other things). + url = "https://github.com/fish-shell/fish-shell/releases/download/${version}/${pname}-${version}.tar.xz"; + sha256 = "sha256-tbTuGlJpdiy76ZOkvWUH5nXkEAzpu+hCFKXusrGfrok="; + }; + + # Fix FHS paths in tests + postPatch = '' + # src/fish_tests.cpp + sed -i 's|/bin/ls|${coreutils}/bin/ls|' src/fish_tests.cpp + sed -i 's|is_potential_path(L"/usr"|is_potential_path(L"/nix"|' src/fish_tests.cpp + sed -i 's|L"/bin/echo"|L"${coreutils}/bin/echo"|' src/fish_tests.cpp + sed -i 's|L"/bin/c"|L"${coreutils}/bin/c"|' src/fish_tests.cpp + sed -i 's|L"/bin/ca"|L"${coreutils}/bin/ca"|' src/fish_tests.cpp + + # tests/checks/cd.fish + sed -i 's|/bin/pwd|${coreutils}/bin/pwd|' tests/checks/cd.fish + + # tests/checks/redirect.fish + sed -i 's|/bin/echo|${coreutils}/bin/echo|' tests/checks/redirect.fish + + # tests/checks/vars_as_commands.fish + sed -i 's|/usr/bin|${coreutils}/bin|' tests/checks/vars_as_commands.fish + + # tests/checks/jobs.fish + sed -i 's|ps -o stat|${procps}/bin/ps -o stat|' tests/checks/jobs.fish + sed -i 's|/bin/echo|${coreutils}/bin/echo|' tests/checks/jobs.fish + + # tests/checks/job-control-noninteractive.fish + sed -i 's|/bin/echo|${coreutils}/bin/echo|' tests/checks/job-control-noninteractive.fish + + # tests/checks/complete.fish + sed -i 's|/bin/ls|${coreutils}/bin/ls|' tests/checks/complete.fish + '' + lib.optionalString stdenv.isDarwin '' + # Tests use pkill/pgrep which are currently not built on Darwin + # See https://github.com/NixOS/nixpkgs/pull/103180 + rm tests/pexpects/exit.py + rm tests/pexpects/job_summary.py + rm tests/pexpects/signals.py + ''; + + nativeBuildInputs = [ + cmake + ]; + + buildInputs = [ + ncurses + libiconv + pcre2 + ]; + + cmakeFlags = [ + "-DCMAKE_INSTALL_DOCDIR=${placeholder "out"}/share/doc/fish" + ] ++ lib.optionals stdenv.isDarwin [ + "-DMAC_CODESIGN_ID=OFF" + ]; + + preConfigure = '' + patchShebangs ./build_tools/git_version_gen.sh + ''; + + # Required binaries during execution + propagatedBuildInputs = [ + coreutils + gnugrep + gnused + groff + gettext + ] ++ lib.optional (!stdenv.isDarwin) man-db; + + doCheck = true; + + checkInputs = [ + coreutils + (python3.withPackages (ps: [ ps.pexpect ])) + procps + ]; + + checkPhase = '' + make test + ''; + + postInstall = with lib; '' + sed -r "s|command grep|command ${gnugrep}/bin/grep|" \ + -i "$out/share/fish/functions/grep.fish" + sed -e "s|\|cut|\|${coreutils}/bin/cut|" \ + -i "$out/share/fish/functions/fish_prompt.fish" + sed -e "s|uname|${coreutils}/bin/uname|" \ + -i "$out/share/fish/functions/__fish_pwd.fish" \ + "$out/share/fish/functions/prompt_pwd.fish" + sed -e "s|sed |${gnused}/bin/sed |" \ + -i "$out/share/fish/functions/alias.fish" \ + "$out/share/fish/functions/prompt_pwd.fish" + sed -i "s|nroff|${groff}/bin/nroff|" \ + "$out/share/fish/functions/__fish_print_help.fish" + sed -e "s|clear;|${getBin ncurses}/bin/clear;|" \ + -i "$out/share/fish/functions/fish_default_key_bindings.fish" + sed -i "s|/usr/local/sbin /sbin /usr/sbin||" \ + $out/share/fish/completions/{sudo.fish,doas.fish} + sed -e "s| awk | ${gawk}/bin/awk |" \ + -i $out/share/fish/functions/{__fish_print_packages.fish,__fish_print_addresses.fish,__fish_describe_command.fish,__fish_complete_man.fish,__fish_complete_convert_options.fish} \ + $out/share/fish/completions/{cwebp,adb,ezjail-admin,grunt,helm,heroku,lsusb,make,p4,psql,rmmod,vim-addons}.fish + + '' + optionalString usePython '' + cat > $out/share/fish/functions/__fish_anypython.fish <<EOF + function __fish_anypython + echo ${python3.interpreter} + return 0 + end + EOF + + '' + optionalString stdenv.isLinux '' + for cur in $out/share/fish/functions/*.fish; do + sed -e "s|/usr/bin/getent|${getent}/bin/getent|" \ + -i "$cur" + done + + '' + optionalString (!stdenv.isDarwin) '' + sed -i "s|Popen(\['manpath'|Popen(\['${man-db}/bin/manpath'|" \ + "$out/share/fish/tools/create_manpage_completions.py" + sed -i "s|command manpath|command ${man-db}/bin/manpath|" \ + "$out/share/fish/functions/man.fish" + '' + optionalString useOperatingSystemEtc '' + tee -a $out/etc/fish/config.fish < ${etcConfigAppendix} + '' + '' + tee -a $out/share/fish/__fish_build_paths.fish < ${fishPreInitHooks} + ''; + + meta = with lib; { + description = "Smart and user-friendly command line shell"; + homepage = "https://fishshell.com/"; + license = licenses.gpl2; + platforms = platforms.unix; + maintainers = with maintainers; [ cole-h ]; + }; + + passthru = { + shellPath = "/bin/fish"; + tests = { + nixos = nixosTests.fish; + + # Test the fish_config tool by checking the generated splash page. + # Since the webserver requires a port to run, it is not started. + fishConfig = + let fishScript = writeText "test.fish" '' + set -x __fish_bin_dir ${fish}/bin + echo $__fish_bin_dir + cp -r ${fish}/share/fish/tools/web_config/* . + chmod -R +w * + + # if we don't set `delete=False`, the file will get cleaned up + # automatically (leading the test to fail because there's no + # tempfile to check) + sed -e 's@, mode="w"@, mode="w", delete=False@' -i webconfig.py + + # we delete everything after the fileurl is assigned + sed -e '/fileurl =/q' -i webconfig.py + echo "print(fileurl)" >> webconfig.py + + # and check whether the message appears on the page + cat (${python3}/bin/python ./webconfig.py \ + | tail -n1 | sed -ne 's|.*\(/build/.*\)|\1|p' \ + ) | grep 'a href="http://localhost.*Start the Fish Web config' + + # cannot test the http server because it needs a localhost port + ''; + in + runCommand "test-web-config" { } '' + HOME=$(mktemp -d) + ${fish}/bin/fish ${fishScript} && touch $out + ''; + }; + }; + }; +in +fish diff --git a/nixpkgs/pkgs/shells/fish/oh-my-fish/default.nix b/nixpkgs/pkgs/shells/fish/oh-my-fish/default.nix new file mode 100644 index 000000000000..e0dca9419ebc --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/oh-my-fish/default.nix @@ -0,0 +1,60 @@ +{ lib +, stdenv +, fetchFromGitHub +, fish +, runtimeShell +, writeShellScript +}: + +stdenv.mkDerivation rec { + pname = "oh-my-fish"; + version = "7+unstable=2021-03-03"; + + src = fetchFromGitHub { + owner = pname; + repo = pname; + rev = "0b1396ad7962073fa25615bf03c43b53eddc2d56"; + hash = "sha256-lwMo4+PcYR9kYJPWK+ALiMfBdxFSgB2vjtSn8QrmmEA="; + }; + + buildInputs = [ + fish + ]; + + dontConfigure = true; + dontBuild = true; + + installPhase = '' + runHook preInstall + + mkdir -pv $out/bin $out/share/${pname} + cp -vr * $out/share/${pname} + + cat << EOF > $out/bin/omf-install + #!${runtimeShell} + + ${fish}/bin/fish \\ + $out/share/${pname}/bin/install \\ + --noninteractive \\ + --offline=$out/share/${pname} + + EOF + chmod +x $out/bin/omf-install + + runHook PostInstall + ''; + + meta = with lib; { + homepage = "https://github.com/oh-my-fish/oh-my-fish"; + description = "The Fish Shell Framework"; + longDescription = '' + Oh My Fish provides core infrastructure to allow you to install packages + which extend or modify the look of your shell. It's fast, extensible and + easy to use. + ''; + license = licenses.mit; + maintainers = with maintainers; [ AndersonTorres ]; + platforms = fish.meta.platforms; + }; +} +# TODO: customize the omf-install script diff --git a/nixpkgs/pkgs/shells/fish/plugins/build-fish-plugin.nix b/nixpkgs/pkgs/shells/fish/plugins/build-fish-plugin.nix new file mode 100644 index 000000000000..5bb4ffa243fc --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/plugins/build-fish-plugin.nix @@ -0,0 +1,73 @@ +{ stdenv, lib, writeScript, wrapFish }: + +attrs@{ + pname, + version, + src, + + name ? "fishplugin-${pname}-${version}", + unpackPhase ? "", + configurePhase ? ":", + buildPhase ? ":", + preInstall ? "", + postInstall ? "", + + checkInputs ? [], + # plugin packages to add to the vendor paths of the test fish shell + checkPlugins ? [], + # vendor directories to add to the function path of the test fish shell + checkFunctionDirs ? [], + # test script to be executed in a fish shell + checkPhase ? "", + doCheck ? checkPhase != "", + + ... +}: + +let + # Do not pass attributes that are only relevant to buildFishPlugin to mkDerivation. + drvAttrs = builtins.removeAttrs attrs [ + "checkPlugins" + "checkFunctionDirs" + ]; +in + +stdenv.mkDerivation (drvAttrs // { + inherit name; + inherit unpackPhase configurePhase buildPhase; + + inherit preInstall postInstall; + installPhase = '' + runHook preInstall + + ( + install_vendor_files() { + source="$1" + target="$out/share/fish/vendor_$2.d" + + [ -d $source ] || return 0 + mkdir -p $target + cp -r $source/*.fish "$target/" + } + + install_vendor_files completions completions + install_vendor_files functions functions + install_vendor_files conf conf + install_vendor_files conf.d conf + ) + + runHook postInstall + ''; + + inherit doCheck; + + checkInputs = [ (wrapFish { + pluginPkgs = checkPlugins; + functionDirs = checkFunctionDirs; + }) ] ++ checkInputs; + + checkPhase = '' + export HOME=$(mktemp -d) # fish wants a writable home + fish "${writeScript "${name}-test" checkPhase}" + ''; +}) diff --git a/nixpkgs/pkgs/shells/fish/plugins/clownfish.nix b/nixpkgs/pkgs/shells/fish/plugins/clownfish.nix new file mode 100644 index 000000000000..cd5c997d3114 --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/plugins/clownfish.nix @@ -0,0 +1,20 @@ +{ lib, buildFishPlugin, fetchFromGitHub }: + +buildFishPlugin { + pname = "clownfish"; + version = "unstable-2021-01-17"; + + src = fetchFromGitHub { + owner = "IlanCosman"; + repo = "clownfish"; + rev = "a0db28d8280d05561b8f48c0465480725feeca4c"; + sha256 = "04xvikyrdm6yxh588vbpwvm04fas76pa7sigsaqrip7yh021xxab"; + }; + + meta = with lib; { + description = "Fish function to mock the behaviour of commands"; + homepage = "https://github.com/IlanCosman/clownfish"; + license = licenses.mit; + maintainers = with maintainers; [ pacien ]; + }; +} diff --git a/nixpkgs/pkgs/shells/fish/plugins/default.nix b/nixpkgs/pkgs/shells/fish/plugins/default.nix new file mode 100644 index 000000000000..ab244d282ec6 --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/plugins/default.nix @@ -0,0 +1,26 @@ +{ lib, newScope }: + +lib.makeScope newScope (self: with self; { + + buildFishPlugin = callPackage ./build-fish-plugin.nix { }; + + clownfish = callPackage ./clownfish.nix { }; + + done = callPackage ./done.nix { }; + + # Fishtape 2.x and 3.x aren't compatible, + # but both versions are used in the tests of different other plugins. + fishtape = callPackage ./fishtape.nix { }; + fishtape_3 = callPackage ./fishtape_3.nix { }; + + foreign-env = callPackage ./foreign-env { }; + + forgit = callPackage ./forgit.nix { }; + + fzf-fish = callPackage ./fzf-fish.nix { }; + + pisces = callPackage ./pisces.nix { }; + + pure = callPackage ./pure.nix { }; + +}) diff --git a/nixpkgs/pkgs/shells/fish/plugins/done.nix b/nixpkgs/pkgs/shells/fish/plugins/done.nix new file mode 100644 index 000000000000..ffbd8dfdaa03 --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/plugins/done.nix @@ -0,0 +1,25 @@ +{ lib, buildFishPlugin, fetchFromGitHub, fishtape }: + +buildFishPlugin rec { + pname = "done"; + version = "1.16.5"; + + src = fetchFromGitHub { + owner = "franciscolourenco"; + repo = "done"; + rev = version; + sha256 = "E0wveeDw1VzEH2kzn63q9hy1xkccfxQHBV2gVpu2IdQ="; + }; + + checkPlugins = [ fishtape ]; + checkPhase = '' + fishtape test/done.fish + ''; + + meta = { + description = "Automatically receive notifications when long processes finish"; + homepage = "https://github.com/franciscolourenco/done"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ malo ]; + }; +} diff --git a/nixpkgs/pkgs/shells/fish/plugins/fishtape.nix b/nixpkgs/pkgs/shells/fish/plugins/fishtape.nix new file mode 100644 index 000000000000..82f2375d5e3f --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/plugins/fishtape.nix @@ -0,0 +1,32 @@ +{ lib, buildFishPlugin, fetchFromGitHub }: + +buildFishPlugin rec { + pname = "fishtape"; + version = "2.1.3"; + + src = fetchFromGitHub { + owner = "jorgebucaran"; + repo = "fishtape"; + rev = version; + sha256 = "0dxcyhs2shhgy5xnwcimqja8vqsyk841x486lgq13i3y1h0kp2kd"; + }; + + checkFunctionDirs = [ "./" ]; # fishtape is introspective + checkPhase = '' + rm test/tty.fish # test expects a tty + fishtape test/*.fish + ''; + + preInstall = '' + # move the function script in the proper sub-directory + mkdir functions + mv fishtape.fish functions/ + ''; + + meta = { + description = "TAP-based test runner for Fish"; + homepage = "https://github.com/jorgebucaran/fishtape"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ pacien ]; + }; +} diff --git a/nixpkgs/pkgs/shells/fish/plugins/fishtape_3.nix b/nixpkgs/pkgs/shells/fish/plugins/fishtape_3.nix new file mode 100644 index 000000000000..893e6d65ffb3 --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/plugins/fishtape_3.nix @@ -0,0 +1,25 @@ +{ lib, buildFishPlugin, fetchFromGitHub }: + +buildFishPlugin rec { + pname = "fishtape"; + version = "3.0.1"; + + src = fetchFromGitHub { + owner = "jorgebucaran"; + repo = "fishtape"; + rev = version; + sha256 = "072a3qbk1lpxw53bxp91drsffylx8fbywhss3x0jbnayn9m8i7aa"; + }; + + checkFunctionDirs = [ "./functions" ]; # fishtape is introspective + checkPhase = '' + fishtape tests/*.fish + ''; + + meta = with lib; { + description = "100% pure-Fish test runner"; + homepage = "https://github.com/jorgebucaran/fishtape"; + license = licenses.mit; + maintainers = with maintainers; [ pacien ]; + }; +} diff --git a/nixpkgs/pkgs/shells/fish/plugins/foreign-env/default.nix b/nixpkgs/pkgs/shells/fish/plugins/foreign-env/default.nix new file mode 100644 index 000000000000..d0b5b77a03b1 --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/plugins/foreign-env/default.nix @@ -0,0 +1,29 @@ +{ lib, buildFishPlugin, fetchFromGitHub, gnused, bash, coreutils }: + +buildFishPlugin { + pname = "foreign-env"; + version = "unstable-2020-02-09"; + + src = fetchFromGitHub { + owner = "oh-my-fish"; + repo = "plugin-foreign-env"; + rev = "dddd9213272a0ab848d474d0cbde12ad034e65bc"; + sha256 = "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs"; + }; + + patches = [ ./suppress-harmless-warnings.patch ]; + + preInstall = '' + sed -e "s|sed|${gnused}/bin/sed|" \ + -e "s|bash|${bash}/bin/bash|" \ + -e "s|\| tr|\| ${coreutils}/bin/tr|" \ + -i functions/* + ''; + + meta = with lib; { + description = "A foreign environment interface for Fish shell"; + license = licenses.mit; + maintainers = with maintainers; [ jgillich ]; + platforms = with platforms; unix; + }; +} diff --git a/nixpkgs/pkgs/shells/fish/plugins/foreign-env/suppress-harmless-warnings.patch b/nixpkgs/pkgs/shells/fish/plugins/foreign-env/suppress-harmless-warnings.patch new file mode 100644 index 000000000000..6eed35152120 --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/plugins/foreign-env/suppress-harmless-warnings.patch @@ -0,0 +1,23 @@ +diff --git a/functions/fenv.apply.fish b/functions/fenv.apply.fish +index 34a25e3..3d94135 100644 +--- a/functions/fenv.apply.fish ++++ b/functions/fenv.apply.fish +@@ -27,11 +27,17 @@ function fenv.apply + for variable in $variables + set key (echo $variable | sed 's/=.*//') + set value (echo $variable | sed 's/[^=]*=//') ++ set ignore PATH _ + + if test "$key" = 'PATH' + set value (echo $value | tr ':' '\n') + end + +- set -g -x $key $value ++ if contains $key $ignore ++ set -g -x $key $value 2>/dev/null ++ else ++ set -g -x $key $value ++ end ++ + end + end diff --git a/nixpkgs/pkgs/shells/fish/plugins/forgit.nix b/nixpkgs/pkgs/shells/fish/plugins/forgit.nix new file mode 100644 index 000000000000..5fc647c73ee3 --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/plugins/forgit.nix @@ -0,0 +1,26 @@ +{ lib, buildFishPlugin, fetchFromGitHub, git, fzf }: + +buildFishPlugin rec { + pname = "forgit"; + version = "unstable-2021-04-09"; + + preFixup = '' + substituteInPlace $out/share/fish/vendor_conf.d/forgit.plugin.fish \ + --replace "fzf " "${fzf}/bin/fzf " \ + --replace "git " "${git}/bin/git " + ''; + + src = fetchFromGitHub { + owner = "wfxr"; + repo = "forgit"; + rev = "7806fc3ab37ac479c315eb54b164f67ba9ed17ea"; + sha256 = "sha256-a7wjuqXe3+y5zlgSLk5J31WoORbieFimvtr0FQHRY5M="; + }; + + meta = with lib; { + description = "A utility tool powered by fzf for using git interactively."; + homepage = "https://github.com/wfxr/forgit"; + license = licenses.mit; + maintainers = with maintainers; [ happysalada ]; + }; +} diff --git a/nixpkgs/pkgs/shells/fish/plugins/fzf-fish.nix b/nixpkgs/pkgs/shells/fish/plugins/fzf-fish.nix new file mode 100644 index 000000000000..9fbc09a831db --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/plugins/fzf-fish.nix @@ -0,0 +1,40 @@ +{ lib, stdenv, buildFishPlugin, fetchFromGitHub, fd, fzf, util-linux, clownfish, fishtape_3 }: + +buildFishPlugin rec { + pname = "fzf.fish"; + version = "7.4"; + + src = fetchFromGitHub { + owner = "PatrickF1"; + repo = "fzf.fish"; + rev = "v${version}"; + sha256 = "sha256-dngAKzyD+lmqmxsCSOMViyCgA/+Ve35gLtPS+Lgs8Pc="; + }; + + checkInputs = [ fzf fd util-linux ]; + checkPlugins = [ clownfish fishtape_3 ]; + checkFunctionDirs = [ "./functions" ]; + checkPhase = '' + # Disable git tests which inspect the project's git repo, which isn't + # possible since we strip the impure .git from our build input + rm -r tests/*git* + + # Disable tests that are failing, probably because of our wrappers + rm -r tests/configure_bindings + rm -r tests/search_shell_variables + + # Disable tests that are failing, because there is not 'rev' command + rm tests/preview_file/custom_file_preview.fish + + '' + ( + if stdenv.isDarwin then ''script /dev/null fish -c "fishtape tests/*/*.fish"'' + else ''script -c 'fish -c "fishtape tests/*/*.fish"' '' + ); + + meta = with lib; { + description = "Augment your fish command line with fzf key bindings"; + homepage = "https://github.com/PatrickF1/fzf.fish"; + license = licenses.mit; + maintainers = with maintainers; [ pacien ]; + }; +} diff --git a/nixpkgs/pkgs/shells/fish/plugins/pisces.nix b/nixpkgs/pkgs/shells/fish/plugins/pisces.nix new file mode 100644 index 000000000000..c1ed37f41227 --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/plugins/pisces.nix @@ -0,0 +1,20 @@ +{ lib, buildFishPlugin, fetchFromGitHub }: + +buildFishPlugin rec { + pname = "pisces"; + version = "0.7.0"; + + src = fetchFromGitHub { + owner = "laughedelic"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-Oou2IeNNAqR00ZT3bss/DbhrJjGeMsn9dBBYhgdafBw="; + }; + + meta = with lib; { + description = "Paired symbols in the command line"; + homepage = "https://github.com/laughedelic/pisces"; + license = licenses.lgpl3; + maintainers = with maintainers; [ vanilla ]; + }; +} diff --git a/nixpkgs/pkgs/shells/fish/plugins/pure.nix b/nixpkgs/pkgs/shells/fish/plugins/pure.nix new file mode 100644 index 000000000000..68da97633c4f --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/plugins/pure.nix @@ -0,0 +1,37 @@ +{ lib, buildFishPlugin, fetchFromGitHub, git, fishtape }: + +buildFishPlugin rec { + pname = "pure"; + version = "4.1.1"; + + src = fetchFromGitHub { + owner = "pure-fish"; + repo = "pure"; + rev = "v${version}"; + sha256 = "1x1h65l8582p7h7w5986sc9vfd7b88a7hsi68dbikm090gz8nlxx"; + }; + + # The tests aren't passing either on the project's CI. + # The release notes of the program for v3.5.0 say: + # > Tests are going crazy at the moment, should be fixed once fishtape 3.0 + # > is released, and we do the switch. + # This is tracked in https://github.com/pure-fish/pure/issues/272 + # and https://github.com/pure-fish/pure/pull/275. + doCheck = false; + + checkInputs = [ git ]; + checkPlugins = [ fishtape ]; + checkPhase = '' + # https://github.com/rafaelrinaldi/pure/issues/264 + rm tests/_pure_string_width.test.fish + + fishtape tests/*.test.fish + ''; + + meta = { + description = "Pretty, minimal and fast Fish prompt, ported from zsh"; + homepage = "https://github.com/rafaelrinaldi/pure"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ pacien ]; + }; +} diff --git a/nixpkgs/pkgs/shells/fish/wrapper.nix b/nixpkgs/pkgs/shells/fish/wrapper.nix new file mode 100644 index 000000000000..f978f2bdfa4d --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/wrapper.nix @@ -0,0 +1,25 @@ +{ lib, writeShellScriptBin, fish }: + +with lib; + +makeOverridable ({ + completionDirs ? [], + functionDirs ? [], + confDirs ? [], + pluginPkgs ? [] +}: + +let + vendorDir = kind: plugin: "${plugin}/share/fish/vendor_${kind}.d"; + complPath = completionDirs ++ map (vendorDir "completions") pluginPkgs; + funcPath = functionDirs ++ map (vendorDir "functions") pluginPkgs; + confPath = confDirs ++ map (vendorDir "conf") pluginPkgs; + +in writeShellScriptBin "fish" '' + ${fish}/bin/fish --init-command " + set --prepend fish_complete_path ${escapeShellArgs complPath} + set --prepend fish_function_path ${escapeShellArgs funcPath} + set --local fish_conf_source_path ${escapeShellArgs confPath} + for c in \$fish_conf_source_path/*; source \$c; end + " "$@" +'') diff --git a/nixpkgs/pkgs/shells/hilbish/default.nix b/nixpkgs/pkgs/shells/hilbish/default.nix new file mode 100644 index 000000000000..55a28ceb8892 --- /dev/null +++ b/nixpkgs/pkgs/shells/hilbish/default.nix @@ -0,0 +1,46 @@ +{ lib, buildGoModule, fetchFromGitHub, readline }: + +buildGoModule rec { + pname = "hilbish"; + version = "0.7.1"; + + src = fetchFromGitHub { + owner = "Rosettea"; + repo = "Hilbish"; + rev = "v${version}"; + sha256 = "sha256-YQNLv6/4I5WM/xhlWIjThgO23tN+ZCyJVZVatnIUllc="; + fetchSubmodules = true; + }; + + vendorSha256 = "sha256-xzB6sqBnDuvqTFMmLcXdSj6UFWYzA54PxUBKrFKhyQk="; + + buildInputs = [ readline ]; + + ldflags = [ + "-s" + "-w" + "-X main.dataDir=${placeholder "out"}/share/hilbish" + ]; + + postInstall = '' + mkdir -p "$out/share/hilbish" + + cp .hilbishrc.lua $out/share/hilbish/ + cp -r docs -t $out/share/hilbish + cp -r libs -t $out/share/hilbish/ + cp preload.lua $out/share/hilbish/ + + # segfaults and it's already been generated upstream + # we copy the docs over with the above cp command + rm $out/bin/docgen + ''; + + meta = with lib; { + description = "An interactive Unix-like shell written in Go"; + changelog = "https://github.com/Rosettea/Hilbish/releases/tag/v${version}"; + homepage = "https://github.com/Rosettea/Hilbish"; + maintainers = with maintainers; [ fortuneteller2k ]; + license = licenses.mit; + platforms = platforms.linux; # only officially supported on Linux + }; +} diff --git a/nixpkgs/pkgs/shells/ion/default.nix b/nixpkgs/pkgs/shells/ion/default.nix new file mode 100644 index 000000000000..f20c80810a0b --- /dev/null +++ b/nixpkgs/pkgs/shells/ion/default.nix @@ -0,0 +1,33 @@ +{ lib, stdenv, fetchFromGitHub, rustPlatform, Security, libiconv }: + +rustPlatform.buildRustPackage rec { + pname = "ion"; + version = "unstable-2021-05-10"; + + src = fetchFromGitHub { + owner = "redox-os"; + repo = "ion"; + rev = "1170b84587bbad260a3ecac8e249a216cb1fd5e9"; + sha256 = "sha256-lI1GwA3XerRJaC/Z8vTZc6GzRDLjv3w768C+Ui6Q+3Q="; + }; + + cargoSha256 = "sha256-hURpgxc99iIMtzIlR6Kbfqcbu1uYLDHnfVLqgmMbvFA="; + + meta = with lib; { + description = "Modern system shell with simple (and powerful) syntax"; + homepage = "https://gitlab.redox-os.org/redox-os/ion"; + license = licenses.mit; + maintainers = with maintainers; [ dywedir ]; + }; + + buildInputs = lib.optional stdenv.hostPlatform.isDarwin [ + Security + libiconv + ]; + + doCheck = !stdenv.hostPlatform.isDarwin; + + passthru = { + shellPath = "/bin/ion"; + }; +} diff --git a/nixpkgs/pkgs/shells/jush/default.nix b/nixpkgs/pkgs/shells/jush/default.nix new file mode 100644 index 000000000000..12cd6c935c05 --- /dev/null +++ b/nixpkgs/pkgs/shells/jush/default.nix @@ -0,0 +1,27 @@ +{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, editline }: + +stdenv.mkDerivation rec { + pname = "jush"; + version = "0.1"; + + src = fetchFromGitHub { + owner = "troglobit"; + repo = pname; + rev = "v${version}"; + sha256 = "1azvghrh31gawd798a254ml4id642qvbva64zzg30pjszh1087n8"; + }; + + nativeBuildInputs = [ autoreconfHook pkg-config ]; + + buildInputs = [ editline ]; + + passthru.shellPath = "/bin/jush"; + + meta = with lib; { + description = "just a useless shell"; + homepage = "https://github.com/troglobit/jush"; + license = licenses.isc; + platforms = platforms.all; + maintainers = with maintainers; [ dtzWill ]; + }; +} diff --git a/nixpkgs/pkgs/shells/ksh/default.nix b/nixpkgs/pkgs/shells/ksh/default.nix new file mode 100644 index 000000000000..cfd278aaca65 --- /dev/null +++ b/nixpkgs/pkgs/shells/ksh/default.nix @@ -0,0 +1,45 @@ +{ lib, stdenv, meson, ninja, fetchFromGitHub, which, python3, fetchpatch +, libiconv }: + +stdenv.mkDerivation rec { + pname = "ksh"; + version = "2020.0.0"; + + src = fetchFromGitHub { + owner = "att"; + repo = "ast"; + rev = version; + sha256 = "0cdxz0nhpq03gb9rd76fn0x1yzs2c8q289b7vcxnzlsrz1imz65j"; + }; + + patches = [ + (fetchpatch { + url = "https://github.com/att/ast/commit/11983a71f5e29df578b7e2184400728b4e3f451d.patch"; + sha256 = "1n9558c4v2qpgpjb1vafs29n3qn3z0770wr1ayc0xjf5z5j4g3kv"; + }) + ]; + + nativeBuildInputs = [ meson ninja which python3 ]; + + buildInputs = [ libiconv ]; + + strictDeps = true; + + meta = with lib; { + description = "KornShell Command And Programming Language"; + longDescription = '' + The KornShell language was designed and developed by David G. Korn at + AT&T Bell Laboratories. It is an interactive command language that + provides access to the UNIX system and to many other systems, on the + many different computers and workstations on which it is implemented. + ''; + homepage = "https://github.com/att/ast"; + license = licenses.cpl10; + maintainers = with maintainers; [ ]; + platforms = platforms.all; + }; + + passthru = { + shellPath = "/bin/ksh"; + }; +} diff --git a/nixpkgs/pkgs/shells/liquidprompt/default.nix b/nixpkgs/pkgs/shells/liquidprompt/default.nix new file mode 100644 index 000000000000..c4a9fa141315 --- /dev/null +++ b/nixpkgs/pkgs/shells/liquidprompt/default.nix @@ -0,0 +1,32 @@ +{ lib, stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "liquidprompt"; + version = "2.0.3"; + + src = fetchFromGitHub { + owner = "nojhan"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-BY0/lcBxcfIgKXbXZjiEgVdugmo8vD6UWGsjEVq6j6E="; + }; + + installPhase = '' + install -D -m 0444 liquidprompt $out/bin/liquidprompt + install -D -m 0444 liquidpromptrc-dist $out/share/doc/liquidprompt/liquidpromptrc-dist + install -D -m 0444 liquid.theme $out/share/doc/liquidprompt/liquid.theme + + install -D -m 0444 liquidprompt.plugin.zsh \ + $out/share/zsh/plugins/liquidprompt/liquidprompt.plugin.zsh + install -D -m 0444 liquidprompt \ + $out/share/zsh/plugins/liquidprompt/liquidprompt + ''; + + meta = with lib; { + description = "A full-featured & carefully designed adaptive prompt for Bash & Zsh"; + homepage = "https://github.com/nojhan/liquidprompt"; + license = licenses.agpl3; + platforms = platforms.all; + maintainers = with maintainers; [ gerschtli ]; + }; +} diff --git a/nixpkgs/pkgs/shells/loksh/default.nix b/nixpkgs/pkgs/shells/loksh/default.nix new file mode 100644 index 000000000000..b9f7d5ef7e7f --- /dev/null +++ b/nixpkgs/pkgs/shells/loksh/default.nix @@ -0,0 +1,50 @@ +{ lib +, stdenv +, meson +, ninja +, pkg-config +, ncurses +, fetchFromGitHub +}: + +stdenv.mkDerivation rec { + pname = "loksh"; + version = "7.0"; + + src = fetchFromGitHub { + owner = "dimkr"; + repo = pname; + rev = version; + fetchSubmodules = true; + sha256 = "sha256-q5RiY9/xEFCk+oHlxgNwDOB+TNjRWHKzU2kQH2LjCWY="; + }; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + buildInputs = [ + ncurses + ]; + + postInstall = '' + mv $out/bin/ksh $out/bin/loksh + mv $out/share/man/man1/ksh.1 $out/share/man/man1/loksh.1 + mv $out/share/man/man1/sh.1 $out/share/man/man1/loksh-sh.1 + ''; + + passthru = { + shellPath = "/bin/loksh"; + }; + + meta = with lib; { + description = "Linux port of OpenBSD's ksh"; + homepage = "https://github.com/dimkr/loksh"; + license = licenses.publicDomain; + maintainers = with maintainers; [ cameronnemo ]; + platforms = platforms.linux; + }; +} + diff --git a/nixpkgs/pkgs/shells/mksh/default.nix b/nixpkgs/pkgs/shells/mksh/default.nix new file mode 100644 index 000000000000..360380e19b34 --- /dev/null +++ b/nixpkgs/pkgs/shells/mksh/default.nix @@ -0,0 +1,59 @@ +{ lib +, stdenv +, fetchurl +, installShellFiles +}: + +stdenv.mkDerivation rec { + pname = "mksh"; + version = "59c"; + + src = fetchurl { + urls = [ + "https://www.mirbsd.org/MirOS/dist/mir/mksh/${pname}-R${version}.tgz" + "http://pub.allbsd.org/MirOS/dist/mir/mksh/${pname}-R${version}.tgz" + ]; + hash = "sha256-d64WZaM38cSMYda5Yds+UhGbOOWIhNHIloSvMfh7xQY="; + }; + + nativeBuildInputs = [ + installShellFiles + ]; + + dontConfigure = true; + + buildPhase = '' + runHook preBuild + sh ./Build.sh -r + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + install -D mksh $out/bin/mksh + install -D dot.mkshrc $out/share/mksh/mkshrc + installManPage mksh.1 + runHook postInstall + ''; + + meta = with lib; { + description = "MirBSD Korn Shell"; + longDescription = '' + The MirBSD Korn Shell is a DFSG-free and OSD-compliant (and OSI + approved) successor to pdksh, developed as part of the MirOS + Project as native Bourne/POSIX/Korn shell for MirOS BSD, but + also to be readily available under other UNIX(R)-like operating + systems. + ''; + homepage = "https://www.mirbsd.org/mksh.htm"; + license = with licenses; [ miros isc unicode-dfs-2016 ]; + maintainers = with maintainers; [ AndersonTorres joachifm ]; + platforms = platforms.unix; + }; + + passthru = { + shellPath = "/bin/mksh"; + }; +} +# TODO [ AndersonTorres ]: lksh +# TODO [ AndersonTorres ]: a more accurate licensing info diff --git a/nixpkgs/pkgs/shells/mrsh/default.nix b/nixpkgs/pkgs/shells/mrsh/default.nix new file mode 100644 index 000000000000..be87b97ebd72 --- /dev/null +++ b/nixpkgs/pkgs/shells/mrsh/default.nix @@ -0,0 +1,30 @@ +{ lib, stdenv, fetchFromGitHub, meson, ninja, pkg-config, readline }: + +stdenv.mkDerivation rec { + pname = "mrsh-unstable"; + version = "2021-01-10"; + + src = fetchFromGitHub { + owner = "emersion"; + repo = "mrsh"; + rev = "9f9884083831ea1f94bdda5151c5df3888932849"; + sha256 = "0vvdwzw3fq74lwgmy6xxkk01sd68fzhsw84c750lm1dma22xhjci"; + }; + + nativeBuildInputs = [ meson ninja pkg-config ]; + buildInputs = [ readline ]; + + doCheck = true; + + meta = with lib; { + description = "A minimal POSIX shell"; + homepage = "https://mrsh.sh"; + license = licenses.mit; + maintainers = with maintainers; [ matthiasbeyer ]; + platforms = platforms.unix; + }; + + passthru = { + shellPath = "/bin/mrsh"; + }; +} diff --git a/nixpkgs/pkgs/shells/nsh/default.nix b/nixpkgs/pkgs/shells/nsh/default.nix new file mode 100644 index 000000000000..881d14002ebd --- /dev/null +++ b/nixpkgs/pkgs/shells/nsh/default.nix @@ -0,0 +1,29 @@ +{ lib, rustPlatform, fetchFromGitHub }: + +rustPlatform.buildRustPackage rec { + pname = "nsh"; + version = "0.4.2"; + + src = fetchFromGitHub { + owner = "nuta"; + repo = pname; + rev = "v${version}"; + sha256 = "1479wv8h5l2b0cwp27vpybq50nyvszhjxmn76n2bz3fchr0lrcbp"; + }; + + cargoSha256 = "1kxjr4ymns95g6jz94107nqmd71m2xh8k19gcsy08650gjrn5cz3"; + + doCheck = false; + + meta = with lib; { + description = "A command-line shell like fish, but POSIX compatible"; + homepage = "https://github.com/nuta/nsh"; + changelog = "https://github.com/nuta/nsh/raw/v${version}/docs/changelog.md"; + license = [ licenses.cc0 /* or */ licenses.mit ]; + maintainers = [ maintainers.marsam ]; + }; + + passthru = { + shellPath = "/bin/nsh"; + }; +} diff --git a/nixpkgs/pkgs/shells/nushell/default.nix b/nixpkgs/pkgs/shells/nushell/default.nix new file mode 100644 index 000000000000..a6ca5242e498 --- /dev/null +++ b/nixpkgs/pkgs/shells/nushell/default.nix @@ -0,0 +1,78 @@ +{ stdenv +, lib +, fetchFromGitHub +, rustPlatform +, openssl +, zlib +, zstd +, pkg-config +, python3 +, xorg +, libiconv +, AppKit +, Security +, nghttp2 +, libgit2 +, withExtraFeatures ? true +}: + +rustPlatform.buildRustPackage rec { + pname = "nushell"; + version = "0.42.0"; + + src = fetchFromGitHub { + owner = pname; + repo = pname; + rev = version; + sha256 = "sha256-2EBy61K/HCdCFZkVT5XrflQGuQrRWfdrevV3OPjpUcQ="; + }; + + cargoSha256 = "sha256-iU19rHb1td4NIF+P3wctIcZKL09H+51XwD3NaSBKK18="; + + nativeBuildInputs = [ pkg-config ] + ++ lib.optionals (withExtraFeatures && stdenv.isLinux) [ python3 ]; + + buildInputs = [ openssl zstd ] + ++ lib.optionals stdenv.isDarwin [ zlib libiconv Security ] + ++ lib.optionals (withExtraFeatures && stdenv.isLinux) [ xorg.libX11 ] + ++ lib.optionals (withExtraFeatures && stdenv.isDarwin) [ AppKit nghttp2 libgit2 ]; + + buildFeatures = lib.optional withExtraFeatures "extra"; + + # Since 0.34, nu has an indirect dependency on `zstd-sys` (via `polars` and + # `parquet`, for dataframe support), which by default has an impure build + # (git submodule for the `zstd` C library). The `pkg-config` feature flag + # fixes this, but it's hard to invoke this in the right place, because of + # the indirect dependencies. So add a direct dependency on `zstd-sys` here + # at the top level, along with this feature flag, to ensure that when + # `zstd-sys` is transitively invoked, it triggers a pure build using the + # system `zstd` library provided above. + # + # (If this patch needs updating, in a nushell repo add the zstd-sys line to + # Cargo.toml, then `cargo update --package zstd-sys` to update Cargo.lock.) + cargoPatches = [ ./use-system-zstd-lib.diff ]; + + # TODO investigate why tests are broken on darwin + # failures show that tests try to write to paths + # outside of TMPDIR + doCheck = ! stdenv.isDarwin; + + checkPhase = '' + runHook preCheck + echo "Running cargo test" + HOME=$TMPDIR cargo test + runHook postCheck + ''; + + meta = with lib; { + description = "A modern shell written in Rust"; + homepage = "https://www.nushell.sh/"; + license = licenses.mit; + maintainers = with maintainers; [ Br1ght0ne johntitor marsam ]; + mainProgram = "nu"; + }; + + passthru = { + shellPath = "/bin/nu"; + }; +} diff --git a/nixpkgs/pkgs/shells/nushell/use-system-zstd-lib.diff b/nixpkgs/pkgs/shells/nushell/use-system-zstd-lib.diff new file mode 100644 index 000000000000..271ad6c692ed --- /dev/null +++ b/nixpkgs/pkgs/shells/nushell/use-system-zstd-lib.diff @@ -0,0 +1,32 @@ +diff --git a/Cargo.lock b/Cargo.lock +index 8833c3e5..0c90d2fe 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -3188,6 +3188,7 @@ dependencies = [ + "nu_plugin_xpath", + "rstest", + "serial_test", ++ "zstd-sys", + ] + + [[package]] +@@ -6954,4 +6955,5 @@ checksum = "615120c7a2431d16cf1cf979e7fc31ba7a5b5e5707b29c8a99e5dbf8a8392a33" + dependencies = [ + "cc", + "libc", ++ "pkg-config", + ] +diff --git a/Cargo.toml b/Cargo.toml +index 89e8a311..4cc2331a 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -63,6 +63,9 @@ serial_test = "0.5.1" + hamcrest2 = "0.3.0" + rstest = "0.10.0" + ++# Specify that the indirect dependency ztsd-sys should pick up the system zstd C library ++zstd-sys = { version = "1", features = [ "pkg-config" ] } ++ + [build-dependencies] + + [features] diff --git a/nixpkgs/pkgs/shells/oh/default.nix b/nixpkgs/pkgs/shells/oh/default.nix new file mode 100644 index 000000000000..68f34fe8eb17 --- /dev/null +++ b/nixpkgs/pkgs/shells/oh/default.nix @@ -0,0 +1,25 @@ +{ buildGoModule, fetchFromGitHub, lib }: + +buildGoModule rec { + pname = "oh"; + version = "0.8.0"; + + src = fetchFromGitHub { + owner = "michaelmacinnis"; + repo = pname; + rev = "v${version}"; + sha256 = "0sdpk77i5mfamkdqldybl9znzz92hqgi4xvby5j28m0a5gw46kj0"; + }; + + vendorSha256 = "12vlvh37hvi8c1i9arppm5wj4v9c98s7myxra10q6qpdqssgc8a0"; + + meta = with lib; { + homepage = "https://github.com/michaelmacinnis/oh"; + description = "A new Unix shell"; + license = licenses.mit; + }; + + passthru = { + shellPath = "/bin/oh"; + }; +} diff --git a/nixpkgs/pkgs/shells/oil/default.nix b/nixpkgs/pkgs/shells/oil/default.nix new file mode 100644 index 000000000000..2a019d75e728 --- /dev/null +++ b/nixpkgs/pkgs/shells/oil/default.nix @@ -0,0 +1,43 @@ +{ stdenv, lib, fetchurl, withReadline ? true, readline }: + +stdenv.mkDerivation rec { + pname = "oil"; + version = "0.9.6"; + + src = fetchurl { + url = "https://www.oilshell.org/download/oil-${version}.tar.xz"; + sha256 = "sha256-4cfRysJ202y1996TB/7jvlWO5K2vNJ70IjIkANXIpcQ="; + }; + + postPatch = '' + patchShebangs build + ''; + + preInstall = '' + mkdir -p $out/bin + ''; + + buildInputs = lib.optional withReadline readline; + configureFlags = lib.optional withReadline "--with-readline"; + + # Stripping breaks the bundles by removing the zip file from the end. + dontStrip = true; + + meta = { + description = "A new unix shell"; + homepage = "https://www.oilshell.org/"; + + license = with lib.licenses; [ + psfl # Includes a portion of the python interpreter and standard library + asl20 # Licence for Oil itself + ]; + + platforms = lib.platforms.all; + maintainers = with lib.maintainers; [ lheckemann alva ]; + changelog = "https://www.oilshell.org/release/${version}/changelog.html"; + }; + + passthru = { + shellPath = "/bin/osh"; + }; +} diff --git a/nixpkgs/pkgs/shells/oksh/default.nix b/nixpkgs/pkgs/shells/oksh/default.nix new file mode 100644 index 000000000000..9ea851adbbf6 --- /dev/null +++ b/nixpkgs/pkgs/shells/oksh/default.nix @@ -0,0 +1,25 @@ +{ stdenv, lib, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "oksh"; + version = "7.0"; + + src = fetchFromGitHub { + owner = "ibara"; + repo = pname; + rev = "${pname}-${version}"; + sha256 = "sha256-076nD0aPps6n5qkR3LQJ6Kn2g3mkov+/M0qSvxNLZ6o="; + }; + + meta = with lib; { + description = "Portable OpenBSD ksh, based on the Public Domain Korn Shell (pdksh)"; + homepage = "https://github.com/ibara/oksh"; + license = licenses.publicDomain; + maintainers = with maintainers; [ siraben ]; + platforms = platforms.all; + }; + + passthru = { + shellPath = "/bin/oksh"; + }; +} diff --git a/nixpkgs/pkgs/shells/pash/default.nix b/nixpkgs/pkgs/shells/pash/default.nix new file mode 100644 index 000000000000..431091bf8d1c --- /dev/null +++ b/nixpkgs/pkgs/shells/pash/default.nix @@ -0,0 +1,29 @@ +{ lib, fetchFromGitHub, buildDotnetPackage }: + +buildDotnetPackage { + pname = "pash"; + version = "git-2016-07-06"; + + src = fetchFromGitHub { + owner = "Pash-Project"; + repo = "Pash"; + rev = "8d6a48f5ed70d64f9b49e6849b3ee35b887dc254"; + sha256 = "0c4wa8qi1zs01p9ck171jkw0n1rsymsrhpsb42gl7warwhpmv59f"; + }; + + preConfigure = "rm -rvf $src/Source/PashConsole/bin/*"; + + outputFiles = [ "Source/PashConsole/bin/Release/*" ]; + + meta = with lib; { + description = "An open source implementation of Windows PowerShell"; + homepage = "https://github.com/Pash-Project/Pash"; + maintainers = [ maintainers.fornever maintainers.vrthra ]; + platforms = platforms.all; + license = with licenses; [ bsd3 gpl3 ]; + }; + + passthru = { + shellPath = "/bin/pash"; + }; +} diff --git a/nixpkgs/pkgs/shells/powershell/default.nix b/nixpkgs/pkgs/shells/powershell/default.nix new file mode 100644 index 000000000000..4efa2cd88a72 --- /dev/null +++ b/nixpkgs/pkgs/shells/powershell/default.nix @@ -0,0 +1,84 @@ +{ stdenv, lib, autoPatchelfHook, fetchzip, libunwind, libuuid, icu, curl +, darwin, makeWrapper, less, openssl_1_1, pam, lttng-ust }: + +let archString = if stdenv.isAarch64 then "arm64" + else if stdenv.isx86_64 then "x64" + else throw "unsupported platform"; + platformString = if stdenv.isDarwin then "osx" + else if stdenv.isLinux then "linux" + else throw "unsupported platform"; + platformSha = if (stdenv.isDarwin && stdenv.isx86_64) then "sha256-h5zjn8wtgHmsJFiGq1rja6kZTZj3Q72W2kH3AexRDQs=" + else if (stdenv.isDarwin && stdenv.isAarch64) then "sha256-NHM9ZUpBJb59Oq0Ke7DcvaN+bZ9MjSpXBRu5Ng9OVZ0=" + else if (stdenv.isLinux && stdenv.isx86_64) then "sha256-kidPtDMkEZ/1r4WIApPZ/BsdJkolpSZ3f72JyDv3798=" + else if (stdenv.isLinux && stdenv.isAarch64) then "sha256-bUacA4DwjDNlIG7yooXxUGL9AysAogNWuQDvcTqo1sE=" + else throw "unsupported platform"; + platformLdLibraryPath = if stdenv.isDarwin then "DYLD_FALLBACK_LIBRARY_PATH" + else if stdenv.isLinux then "LD_LIBRARY_PATH" + else throw "unsupported platform"; + libraries = [ libunwind libuuid icu curl openssl_1_1 ] ++ + (if stdenv.isLinux then [ pam lttng-ust ] else [ darwin.Libsystem ]); +in +stdenv.mkDerivation rec { + pname = "powershell"; + version = "7.2.1"; + + src = fetchzip { + url = "https://github.com/PowerShell/PowerShell/releases/download/v${version}/powershell-${version}-${platformString}-${archString}.tar.gz"; + sha256 = platformSha; + stripRoot = false; + }; + + buildInputs = [ less ] ++ libraries; + nativeBuildInputs = [ autoPatchelfHook makeWrapper ]; + + installPhase = + let + ext = stdenv.hostPlatform.extensions.sharedLibrary; + in '' + pslibs=$out/share/powershell + mkdir -p $pslibs + + cp -r * $pslibs + + rm -f $pslibs/libcrypto${ext}.1.0.0 + rm -f $pslibs/libssl${ext}.1.0.0 + + # At least the 7.1.4-osx package does not have the executable bit set. + chmod a+x $pslibs/pwsh + + ls $pslibs + '' + lib.optionalString (!stdenv.isDarwin && !stdenv.isAarch64) '' + patchelf --replace-needed libcrypto${ext}.1.0.0 libcrypto${ext}.1.1 $pslibs/libmi.so + patchelf --replace-needed libssl${ext}.1.0.0 libssl${ext}.1.1 $pslibs/libmi.so + '' + lib.optionalString (!stdenv.isDarwin) '' + patchelf --replace-needed liblttng-ust${ext}.0 liblttng-ust${ext}.1 $pslibs/libcoreclrtraceptprovider.so + '' + '' + + mkdir -p $out/bin + + makeWrapper $pslibs/pwsh $out/bin/pwsh \ + --prefix ${platformLdLibraryPath} : "${lib.makeLibraryPath libraries}" \ + --set TERM xterm --set POWERSHELL_TELEMETRY_OPTOUT 1 --set DOTNET_CLI_TELEMETRY_OPTOUT 1 + ''; + + dontStrip = true; + + doInstallCheck = true; + installCheckPhase = '' + # May need a writable home, seen on Darwin. + HOME=$TMP $out/bin/pwsh --help > /dev/null + ''; + + meta = with lib; { + description = "Powerful cross-platform (Windows, Linux, and macOS) shell and scripting language based on .NET"; + homepage = "https://github.com/PowerShell/PowerShell"; + maintainers = with maintainers; [ yrashk srgom p3psi ]; + platforms = [ "x86_64-darwin" "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; + license = with licenses; [ mit ]; + }; + + passthru = { + shellPath = "/bin/pwsh"; + }; + +} diff --git a/nixpkgs/pkgs/shells/rc/default.nix b/nixpkgs/pkgs/shells/rc/default.nix new file mode 100644 index 000000000000..af43c42dd4bd --- /dev/null +++ b/nixpkgs/pkgs/shells/rc/default.nix @@ -0,0 +1,42 @@ +{ lib, stdenv, fetchurl, autoreconfHook +, ncurses #acinclude.m4 wants headers for tgetent(). +, historySupport ? false +, readline ? null +}: + +stdenv.mkDerivation rec { + pname = "rc"; + version = "1.7.4"; + + src = fetchurl { + url = "http://static.tobold.org/rc/rc-${version}.tar.gz"; + sha256 = "1n5zz6d6z4z6s3fwa0pscqqawy561k4xfnmi91i626hcvls67ljy"; + }; + + nativeBuildInputs = [ autoreconfHook ]; + buildInputs = [ ncurses ] + ++ lib.optionals (readline != null) [ readline ]; + + configureFlags = [ + "--enable-def-interp=${stdenv.shell}" #183 + ] ++ lib.optionals historySupport [ "--with-history" ] + ++ lib.optionals (readline != null) [ "--with-edit=readline" ]; + + prePatch = '' + substituteInPlace configure.ac \ + --replace "date -I" "echo 2015-05-13" #reproducible-build + ''; + + passthru = { + shellPath = "/bin/rc"; + }; + + meta = with lib; { + description = "The Plan 9 shell"; + longDescription = "Byron Rakitzis' UNIX reimplementation of Tom Duff's Plan 9 shell."; + homepage = "http://tobold.org/article/rc"; + license = with licenses; zlib; + maintainers = with maintainers; [ ramkromberg ]; + platforms = with platforms; all; + }; +} diff --git a/nixpkgs/pkgs/shells/rush/default.nix b/nixpkgs/pkgs/shells/rush/default.nix new file mode 100644 index 000000000000..bdb8f7ce0952 --- /dev/null +++ b/nixpkgs/pkgs/shells/rush/default.nix @@ -0,0 +1,41 @@ +{ fetchurl, lib, stdenv }: + +stdenv.mkDerivation rec { + pname = "rush"; + version = "2.1"; + + src = fetchurl { + url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz"; + sha256 = "17i4mggr3rnfz0xbhqvd86jqva40c535fhlwkb2l4hjcbpg8blcf"; + }; + + doCheck = true; + + meta = { + description = "Restricted User Shell"; + + longDescription = + '' GNU Rush is a Restricted User Shell, designed for sites + providing limited remote access to their resources, such as + svn or git repositories, scp, or the like. Using a + sophisticated configuration file, Rush gives you complete + control over the command lines that users execute, as well as + over the usage of system resources, such as virtual memory, + CPU time, etc. + + In particular, it allows remote programs to be run in a chrooted + environment, which is important with such programs as + sftp-server or scp, that lack this ability. + ''; + + homepage = "https://www.gnu.org/software/rush/"; + license = lib.licenses.gpl3Plus; + + maintainers = [ lib.maintainers.bjg ]; + platforms = lib.platforms.all; + }; + + passthru = { + shellPath = "/bin/rush"; + }; +} diff --git a/nixpkgs/pkgs/shells/scponly/default.nix b/nixpkgs/pkgs/shells/scponly/default.nix new file mode 100644 index 000000000000..c0c39d8e3164 --- /dev/null +++ b/nixpkgs/pkgs/shells/scponly/default.nix @@ -0,0 +1,39 @@ +{ stdenv, lib, fetchFromGitHub, openssh, debugLevel ? 0 }: + +stdenv.mkDerivation { + pname = "scponly"; + version = "4.8"; + + src = fetchFromGitHub { + owner = "scponly"; + repo = "scponly"; + rev = "d8ca58257b9905186aa5706f35813d5f80ea07c1"; + sha256 = "U0K7lOp18ytNjh3KVFmc6vL+/tG4ETnwLEPQEhM4lXE="; + }; + + patches = [ ./scponly-fix-make.patch ]; + + buildInputs = [ openssh ]; + + # Add path to sftp-server so configure finds it + preConfigure = "export PATH=$PATH:${openssh}/libexec"; + + # chroot doesn't seem to work, so not enabling + # rsync could also be optionally enabled + configureFlags = [ "--enable-winscp-compat" ]; + + postInstall = lib.optionalString (debugLevel > 0) '' + mkdir -p $out/etc/scponly && echo ${ + toString debugLevel + } > $out/etc/scponly/debuglevel + ''; + + passthru.shellPath = "/bin/scponly"; + + meta = with lib; { + description = "A shell that only permits scp and sftp-server"; + homepage = "https://github.com/scponly/scponly"; + license = with licenses; [ bsd2 ]; + maintainers = with maintainers; [ wmertens ]; + }; +} diff --git a/nixpkgs/pkgs/shells/scponly/scponly-fix-make.patch b/nixpkgs/pkgs/shells/scponly/scponly-fix-make.patch new file mode 100644 index 000000000000..e8522ec8e6e3 --- /dev/null +++ b/nixpkgs/pkgs/shells/scponly/scponly-fix-make.patch @@ -0,0 +1,21 @@ +--- a/Makefile.in ++++ b/Makefile.in +@@ -41,14 +41,14 @@ + ${INSTALL} -d ${DESTDIR}${bindir} + ${INSTALL} -d ${DESTDIR}${mandir}/man8 + ${INSTALL} -d ${DESTDIR}${CONFDIR} +- ${INSTALL} -o 0 -g 0 scponly ${DESTDIR}${bindir}/scponly +- ${INSTALL} -o 0 -g 0 -m 0644 scponly.8 ${DESTDIR}${mandir}/man8/scponly.8 +- ${INSTALL} -o 0 -g 0 -m 0644 debuglevel ${DESTDIR}${DEBUGFILE} ++ ${INSTALL} scponly ${DESTDIR}${bindir}/scponly ++ ${INSTALL} -m 0644 scponly.8 ${DESTDIR}${mandir}/man8/scponly.8 ++ ${INSTALL} -m 0644 debuglevel ${DESTDIR}${DEBUGFILE} + if test "x${CHROOTED_NAME}" != "x"; then \ + ${INSTALL} -d ${DESTDIR}${sbindir}; \ + rm -f ${DESTDIR}${sbindir}/${CHROOTED_NAME}; \ + cp scponly ${CHROOTED_NAME}; \ +- ${INSTALL} -o 0 -g 0 -m 4755 ${CHROOTED_NAME} ${DESTDIR}${sbindir}/${CHROOTED_NAME}; \ ++ ${INSTALL} ${CHROOTED_NAME} ${DESTDIR}${sbindir}/${CHROOTED_NAME}; \ + fi + + debuglevel: diff --git a/nixpkgs/pkgs/shells/tcsh/default.nix b/nixpkgs/pkgs/shells/tcsh/default.nix new file mode 100644 index 000000000000..9a5bf59f18ea --- /dev/null +++ b/nixpkgs/pkgs/shells/tcsh/default.nix @@ -0,0 +1,58 @@ +{ lib +, stdenv +, fetchurl +, fetchpatch +, ncurses +}: + +stdenv.mkDerivation rec { + pname = "tcsh"; + version = "6.23.00"; + + src = fetchurl { + urls = [ + "https://astron.com/pub/tcsh/old/${pname}-${version}.tar.gz" + "https://astron.com/pub/tcsh/${pname}-${version}.tar.gz" + "http://ftp.funet.fi/pub/mirrors/ftp.astron.com/pub/tcsh/old/${pname}-${version}.tar.gz" + "http://ftp.funet.fi/pub/mirrors/ftp.astron.com/pub/tcsh/${pname}-${version}.tar.gz" + "ftp://ftp.funet.fi/pub/unix/shells/tcsh/old/${pname}-${version}.tar.gz" + "ftp://ftp.funet.fi/pub/unix/shells/tcsh/${pname}-${version}.tar.gz" + "ftp://ftp.astron.com/pub/tcsh/old/${pname}-${version}.tar.gz" + "ftp://ftp.astron.com/pub/tcsh/${pname}-${version}.tar.gz" + ]; + hash = "sha256-Tr6y8zYz0RXZU19VTGUahSMEDY2R5d4zP7LuBFuOAB4="; + }; + + buildInputs = [ + ncurses + ]; + + patches = lib.optional stdenv.hostPlatform.isMusl + (fetchpatch { + name = "sysmalloc.patch"; + url = "https://git.alpinelinux.org/aports/plain/community/tcsh/001-sysmalloc.patch?id=184585c046cdd56512f1a76e426dd799b368f8cf"; + sha256 = "1qc6ydxhdfizsbkaxhpn3wib8sfphrw10xnnsxx2prvzg9g2zp67"; + }); + + meta = with lib; { + homepage = "https://www.tcsh.org/"; + 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 + ''; + license = licenses.bsd2; + maintainers = with maintainers; [ AndersonTorres ]; + platforms = platforms.unix; + }; + + passthru.shellPath = "/bin/tcsh"; +} diff --git a/nixpkgs/pkgs/shells/xonsh/default.nix b/nixpkgs/pkgs/shells/xonsh/default.nix new file mode 100644 index 000000000000..4fa5d9b087be --- /dev/null +++ b/nixpkgs/pkgs/shells/xonsh/default.nix @@ -0,0 +1,87 @@ +{ lib +, fetchFromGitHub +, python3Packages +, glibcLocales +, coreutils +, git +}: + +python3Packages.buildPythonApplication rec { + pname = "xonsh"; + version = "0.11.0"; + + # fetch from github because the pypi package ships incomplete tests + src = fetchFromGitHub { + owner = "xonsh"; + repo = "xonsh"; + rev = version; + sha256 = "sha256-jfxQMEVABTOhx679V0iGVX9RisuY42lSdztYXMLwdcw="; + }; + + LC_ALL = "en_US.UTF-8"; + + postPatch = '' + sed -ie "s|/bin/ls|${coreutils}/bin/ls|" tests/test_execer.py + sed -ie "s|SHELL=xonsh|SHELL=$out/bin/xonsh|" tests/test_integrations.py + + sed -ie 's|/usr/bin/env|${coreutils}/bin/env|' tests/test_integrations.py + sed -ie 's|/usr/bin/env|${coreutils}/bin/env|' scripts/xon.sh + find scripts -name 'xonsh*' -exec sed -i -e "s|env -S|env|" {} \; + find -name "*.xsh" | xargs sed -ie 's|/usr/bin/env|${coreutils}/bin/env|' + patchShebangs . + + substituteInPlace scripts/xon.sh \ + --replace 'python' "${python3Packages.python}/bin/python" + + ''; + + makeWrapperArgs = [ + "--prefix PYTHONPATH : ${placeholder "out"}/lib/${python3Packages.python.libPrefix}/site-packages" + ]; + + postInstall = '' + wrapProgram $out/bin/xon.sh \ + $makeWrapperArgs + ''; + + disabledTests = [ + # fails on sandbox + "test_colorize_file" + "test_loading_correctly" + "test_no_command_path_completion" + # fails on non-interactive shells + "test_capture_always" + "test_casting" + "test_command_pipeline_capture" + "test_dirty_working_directory" + "test_man_completion" + "test_vc_get_branch" + ]; + + disabledTestPaths = [ + # fails on non-interactive shells + "tests/prompt/test_gitstatus.py" + "tests/completers/test_bash_completer.py" + ]; + + preCheck = '' + HOME=$TMPDIR + ''; + + checkInputs = [ glibcLocales git ] ++ + (with python3Packages; [ pyte pytestCheckHook pytest-mock pytest-subprocess ]); + + propagatedBuildInputs = with python3Packages; [ ply prompt-toolkit pygments ]; + + meta = with lib; { + description = "A Python-ish, BASHwards-compatible shell"; + homepage = "https://xon.sh/"; + changelog = "https://github.com/xonsh/xonsh/raw/${version}/CHANGELOG.rst"; + license = licenses.bsd3; + maintainers = with maintainers; [ spwhitt vrthra ]; + }; + + passthru = { + shellPath = "/bin/xonsh"; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/antibody/default.nix b/nixpkgs/pkgs/shells/zsh/antibody/default.nix new file mode 100644 index 000000000000..1db4321259df --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/antibody/default.nix @@ -0,0 +1,26 @@ +{ lib, buildGoModule, fetchFromGitHub }: + +buildGoModule rec { + pname = "antibody"; + version = "6.1.1"; + + src = fetchFromGitHub { + owner = "getantibody"; + repo = "antibody"; + rev = "v${version}"; + sha256 = "0icag53svzdm7yvzp855fp0f7q0g0jkfmjaa1sj6mmb01c1xgzi1"; + }; + + vendorSha256 = "0z8fma3v2dph8nv3q4lmv43s6p5sc338xb7kcmnpwcc0iw7b4vyj"; + + doCheck = false; + + ldflags = [ "-s" "-w" "-X main.version=${version}" ]; + + meta = with lib; { + description = "The fastest shell plugin manager"; + homepage = "https://github.com/getantibody/antibody"; + license = licenses.mit; + maintainers = with maintainers; [ Br1ght0ne ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/antigen/default.nix b/nixpkgs/pkgs/shells/zsh/antigen/default.nix new file mode 100644 index 000000000000..9a69f90dca34 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/antigen/default.nix @@ -0,0 +1,25 @@ +{ lib, stdenv, fetchurl }: + +stdenv.mkDerivation rec { + version = "2.2.3"; + pname = "antigen"; + + src = fetchurl { + url = "https://github.com/zsh-users/antigen/releases/download/v${version}/antigen.zsh"; + sha256 = "1bmp3qf14509swpxin4j9f98n05pdilzapjm0jdzbv0dy3hn20ix"; + }; + + dontUnpack = true; + + installPhase = '' + outdir=$out/share/antigen + mkdir -p $outdir + cp $src $outdir/antigen.zsh + ''; + + meta = { + description = "The plugin manager for zsh"; + homepage = "https://antigen.sharats.me/"; + license = lib.licenses.mit; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/default.nix b/nixpkgs/pkgs/shells/zsh/default.nix new file mode 100644 index 000000000000..e0fd68f13b60 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/default.nix @@ -0,0 +1,105 @@ +{ lib, stdenv, fetchurl, fetchpatch, ncurses, pcre, buildPackages }: + +let + version = "5.8"; + + documentation = fetchurl { + url = "mirror://sourceforge/zsh/zsh-${version}-doc.tar.xz"; + sha256 = "1i6wdzq6rfjx5yjrpzan1jf50hk2pfzy5qib9mb7cnnbjfar6klv"; + }; +in + +stdenv.mkDerivation { + pname = "zsh"; + inherit version; + + src = fetchurl { + url = "mirror://sourceforge/zsh/zsh-${version}.tar.xz"; + sha256 = "09yyaadq738zlrnlh1hd3ycj1mv3q5hh4xl1ank70mjnqm6bbi6w"; + }; + + patches = [ + # fix location of timezone data for TZ= completion + ./tz_completion.patch + # This commit will be released with the next version of zsh + (fetchpatch { + name = "fix-git-stash-drop-completions.patch"; + url = "https://github.com/zsh-users/zsh/commit/754658aff38e1bdf487c58bec6174cbecd019d11.patch"; + sha256 = "sha256-ud/rLD+SqvyTzT6vwOr+MWH+LY5o5KACrU1TpmL15Lo="; + excludes = [ "ChangeLog" ]; + }) + ]; + + buildInputs = [ ncurses pcre ]; + + configureFlags = [ + "--enable-maildir-support" + "--enable-multibyte" + "--with-tcsetpgrp" + "--enable-pcre" + "--enable-zprofile=${placeholder "out"}/etc/zprofile" + "--disable-site-fndir" + ]; + + # the zsh/zpty module is not available on hydra + # so skip groups Y Z + checkFlags = map (T: "TESTNUM=${T}") (lib.stringToCharacters "ABCDEVW"); + + # XXX: think/discuss about this, also with respect to nixos vs nix-on-X + postInstall = '' + mkdir -p $out/share/info + tar xf ${documentation} -C $out/share + ln -s $out/share/zsh-*/Doc/zsh.info* $out/share/info/ + + mkdir -p $out/etc/ + cat > $out/etc/zprofile <<EOF +if test -e /etc/NIXOS; then + if test -r /etc/zprofile; then + . /etc/zprofile + else + emulate bash + alias shopt=false + . /etc/profile + unalias shopt + emulate zsh + fi + if test -r /etc/zprofile.local; then + . /etc/zprofile.local + fi +else + # on non-nixos we just source the global /etc/zprofile as if we did + # not use the configure flag + if test -r /etc/zprofile; then + . /etc/zprofile + fi +fi +EOF + ${if stdenv.hostPlatform == stdenv.buildPlatform then '' + $out/bin/zsh -c "zcompile $out/etc/zprofile" + '' else '' + ${lib.getBin buildPackages.zsh}/bin/zsh -c "zcompile $out/etc/zprofile" + ''} + mv $out/etc/zprofile $out/etc/zprofile_zwc_is_used + ''; + # XXX: patch zsh to take zwc if newer _or equal_ + + meta = { + description = "The Z shell"; + longDescription = '' + Zsh is a UNIX command interpreter (shell) usable as an interactive login + shell and as a shell script command processor. Of the standard shells, + zsh most closely resembles ksh but includes many enhancements. Zsh has + command line editing, builtin spelling correction, programmable command + completion, shell functions (with autoloading), a history mechanism, and + a host of other features. + ''; + license = "MIT-like"; + homepage = "https://www.zsh.org/"; + maintainers = with lib.maintainers; [ pSub ]; + platforms = lib.platforms.unix; + }; + + passthru = { + shellPath = "/bin/zsh"; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/fzf-zsh/default.nix b/nixpkgs/pkgs/shells/zsh/fzf-zsh/default.nix new file mode 100644 index 000000000000..ac5cab94d4cb --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/fzf-zsh/default.nix @@ -0,0 +1,37 @@ +{ lib, stdenv, fetchFromGitHub, fzf }: + +stdenv.mkDerivation rec { + pname = "fzf-zsh-unstable"; + version = "2019-09-09"; + + src = fetchFromGitHub { + owner = "Wyntau"; + repo = "fzf-zsh"; + rev = "829d7e40cc437dce8a6e234e259bbd4065e87124"; + sha256 = "1irjmxhcg1fm4g8p3psjqk7sz5qhj5kw73pyhv91njvpdhn9l26z"; + }; + + postPatch = '' + substituteInPlace fzf-zsh.plugin.zsh \ + --replace \ + 'fzf_path="$( cd "$fzf_zsh_path/../fzf/" && pwd )"' \ + "fzf_path=${fzf}" \ + --replace \ + '$fzf_path/shell' \ + '${fzf}/share/fzf' + ''; + + dontBuild = true; + + installPhase = '' + install -Dm0644 fzf-zsh.plugin.zsh $out/share/zsh/plugins/fzf-zsh/fzf-zsh.plugin.zsh + ''; + + meta = with lib; { + homepage = "https://github.com/wyntau/fzf-zsh"; + description = "wrap fzf to use in oh-my-zsh"; + license = licenses.mit; + maintainers = with maintainers; [ ma27 ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/gradle-completion/default.nix b/nixpkgs/pkgs/shells/zsh/gradle-completion/default.nix new file mode 100644 index 000000000000..bf5969d1300a --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/gradle-completion/default.nix @@ -0,0 +1,35 @@ +{ lib, stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "gradle-completion"; + version = "1.4.1"; + + src = fetchFromGitHub { + owner = "gradle"; + repo = "gradle-completion"; + rev = "v${version}"; + sha256 = "15b0692i3h8h7b95465b2aw9qf5qjmjag5n62347l8yl7zbhv3l2"; + }; + + # we just move two files into $out, + # this shouldn't bother Hydra. + preferLocalBuild = true; + + dontBuild = true; + installPhase = '' + runHook preInstall + + mkdir -p $out + install -Dm0644 ./_gradle $out/share/zsh/site-functions/_gradle + install -Dm0644 ./gradle-completion.bash $out/share/bash-completion/completions/gradle + + runHook postInstall + ''; + + meta = with lib; { + description = "Gradle tab completion for bash and zsh"; + homepage = "https://github.com/gradle/gradle-completion"; + license = licenses.mit; + maintainers = with maintainers; [ ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/grml-zsh-config/default.nix b/nixpkgs/pkgs/shells/zsh/grml-zsh-config/default.nix new file mode 100644 index 000000000000..6196658723f6 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/grml-zsh-config/default.nix @@ -0,0 +1,37 @@ +{ stdenv, fetchFromGitHub, lib, txt2tags }: + +stdenv.mkDerivation rec { + pname = "grml-zsh-config"; + version = "0.19.0"; + + src = fetchFromGitHub { + owner = "grml"; + repo = "grml-etc-core"; + rev = "v${version}"; + sha256 = "sha256-Vn8NzpvJ1W/+UUuhr1plLqskVBUOFJHvy+hxKE3DmIs="; + }; + + nativeBuildInputs = [ txt2tags ]; + + buildPhase = '' + cd doc + make + cd .. + ''; + + installPhase = '' + install -D -m644 etc/zsh/keephack $out/etc/zsh/keephack + install -D -m644 etc/zsh/zshrc $out/etc/zsh/zshrc + + install -D -m644 doc/grmlzshrc.5 $out/share/man/man5/grmlzshrc.5 + ln -s grmlzshrc.5.gz $out/share/man/man5/grml-zsh-config.5.gz + ''; + + meta = with lib; { + description = "grml's zsh setup"; + homepage = "https://grml.org/zsh/"; + license = licenses.gpl2; + platforms = platforms.unix; + maintainers = with maintainers; [ msteen rvolosatovs ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/lambda-mod-zsh-theme/default.nix b/nixpkgs/pkgs/shells/zsh/lambda-mod-zsh-theme/default.nix new file mode 100644 index 000000000000..e8d00d73d1aa --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/lambda-mod-zsh-theme/default.nix @@ -0,0 +1,25 @@ +{ lib, stdenv, fetchFromGitHub }: + +stdenv.mkDerivation { + pname = "lambda-mod-zsh-theme-unstable"; + version = "2020-10-03"; + + src = fetchFromGitHub { + owner = "halfo"; + repo = "lambda-mod-zsh-theme"; + rev = "78347ea9709935f265e558b6345919d12323fbff"; + sha256 = "0fvxnvgbcvwii7ghvpj5l43frllq71wwjvfg7cqfmic727z001dh"; + }; + + installPhase = '' + install -Dm0644 lambda-mod.zsh-theme $out/share/zsh/themes/lambda-mod.zsh-theme + ''; + + meta = with lib; { + description = "A ZSH theme optimized for people who use Git & Unicode-compatible fonts and terminals"; + homepage = "https://github.com/halfo/lambda-mod-zsh-theme/"; + license = licenses.mit; + platforms = platforms.all; + maintainers = with maintainers; [ ma27 ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/nix-zsh-completions/default.nix b/nixpkgs/pkgs/shells/zsh/nix-zsh-completions/default.nix new file mode 100644 index 000000000000..472cc47459cf --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/nix-zsh-completions/default.nix @@ -0,0 +1,28 @@ +{ lib, stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "nix-zsh-completions"; + version = "0.4.4"; + + src = fetchFromGitHub { + owner = "spwhitt"; + repo = "nix-zsh-completions"; + rev = version; + sha256 = "1n9whlys95k4wc57cnz3n07p7zpkv796qkmn68a50ygkx6h3afqf"; + }; + + installPhase = '' + mkdir -p $out/share/zsh/{site-functions,plugins/nix} + cp _* $out/share/zsh/site-functions + cp *.zsh $out/share/zsh/plugins/nix + ''; + + meta = with lib; { + homepage = "https://github.com/spwhitt/nix-zsh-completions"; + description = "ZSH completions for Nix, NixOS, and NixOps"; + priority = 6; # prevent collisions with nix 2.4's built-in completions + license = licenses.bsd3; + platforms = platforms.all; + maintainers = with maintainers; [ spwhitt olejorgenb hedning ma27 ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix b/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix new file mode 100644 index 000000000000..d15bd0245731 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix @@ -0,0 +1,124 @@ +# This script was inspired by the ArchLinux User Repository package: +# +# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=oh-my-zsh-git +{ lib, stdenv, fetchFromGitHub, nixosTests, writeScript, common-updater-scripts +, git, nix, nixfmt, jq, coreutils, gnused, curl, cacert }: + +stdenv.mkDerivation rec { + version = "2021-12-18"; + pname = "oh-my-zsh"; + rev = "904f8685f75ff5dd3f544f8c6f2cabb8e5952e9a"; + + src = fetchFromGitHub { + inherit rev; + owner = "ohmyzsh"; + repo = "ohmyzsh"; + sha256 = "Pos7LaNQllZrzBUx8a7QXi1sAVcIABQJOLUjIwGIP/U="; + }; + + installPhase = '' + runHook preInstall + + outdir=$out/share/oh-my-zsh + template=templates/zshrc.zsh-template + + mkdir -p $outdir + cp -r * $outdir + cd $outdir + + rm LICENSE.txt + rm -rf .git* + + chmod -R +w templates + + # Change the path to oh-my-zsh dir and disable auto-updating. + sed -i -e "s#ZSH=\$HOME/.oh-my-zsh#ZSH=$outdir#" \ + -e 's/\# \(DISABLE_AUTO_UPDATE="true"\)/\1/' \ + $template + + chmod +w oh-my-zsh.sh + + # Both functions expect oh-my-zsh to be in ~/.oh-my-zsh and try to + # modify the directory. + cat >> oh-my-zsh.sh <<- EOF + + # Undefine functions that don't work on Nix. + unfunction uninstall_oh_my_zsh + unfunction upgrade_oh_my_zsh + EOF + + # Look for .zsh_variables, .zsh_aliases, and .zsh_funcs, and source + # them, if found. + cat >> $template <<- EOF + + # Load the variables. + if [ -f ~/.zsh_variables ]; then + . ~/.zsh_variables + fi + + # Load the functions. + if [ -f ~/.zsh_funcs ]; then + . ~/.zsh_funcs + fi + + # Load the aliases. + if [ -f ~/.zsh_aliases ]; then + . ~/.zsh_aliases + fi + EOF + + runHook postInstall + ''; + + passthru = { + tests = { inherit (nixosTests) oh-my-zsh; }; + + updateScript = writeScript "update.sh" '' + #!${stdenv.shell} + set -o errexit + PATH=${ + lib.makeBinPath [ + common-updater-scripts + curl + cacert + git + nixfmt + nix + jq + coreutils + gnused + ] + } + + oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion oh-my-zsh" | tr -d '"')" + latestSha="$(curl -L -s https://api.github.com/repos/ohmyzsh/ohmyzsh/commits\?sha\=master\&since\=$oldVersion | jq -r '.[0].sha')" + + if [ ! "null" = "$latestSha" ]; then + nixpkgs="$(git rev-parse --show-toplevel)" + default_nix="$nixpkgs/pkgs/shells/zsh/oh-my-zsh/default.nix" + latestDate="$(curl -L -s https://api.github.com/repos/ohmyzsh/ohmyzsh/commits/$latestSha | jq '.commit.committer.date' | sed 's|"\(.*\)T.*|\1|g')" + update-source-version oh-my-zsh "$latestSha" --version-key=rev + update-source-version oh-my-zsh "$latestDate" --ignore-same-hash + nixfmt "$default_nix" + else + echo "${pname} is already up-to-date" + fi + ''; + }; + + meta = with lib; { + description = "A framework for managing your zsh configuration"; + longDescription = '' + Oh My Zsh is a framework for managing your zsh configuration. + + To copy the Oh My Zsh configuration file to your home directory, run + the following command: + + $ cp -v $(nix-env -q --out-path oh-my-zsh | cut -d' ' -f3)/share/oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc + ''; + homepage = "https://ohmyz.sh/"; + license = licenses.mit; + platforms = platforms.all; + maintainers = with maintainers; [ nequissimus ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/pure-prompt/default.nix b/nixpkgs/pkgs/shells/zsh/pure-prompt/default.nix new file mode 100644 index 000000000000..d95ef343c17e --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/pure-prompt/default.nix @@ -0,0 +1,30 @@ +{ lib, stdenv, fetchFromGitHub }: + +with lib; + +stdenv.mkDerivation rec { + pname = "pure-prompt"; + version = "1.18.0"; + + src = fetchFromGitHub { + owner = "sindresorhus"; + repo = "pure"; + rev = "v${version}"; + sha256 = "1aa8aczfvclrnd0igiq48jyq4b8fdwvaaj84nzb6w6sjahzs5jcy"; + }; + + installPhase = '' + OUTDIR="$out/share/zsh/site-functions" + mkdir -p "$OUTDIR" + cp pure.zsh "$OUTDIR/prompt_pure_setup" + cp async.zsh "$OUTDIR/async" + ''; + + meta = { + description = "Pretty, minimal and fast ZSH prompt"; + homepage = "https://github.com/sindresorhus/pure"; + license = licenses.mit; + platforms = platforms.all; + maintainers = with maintainers; [ pacien pablovsky ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/spaceship-prompt/default.nix b/nixpkgs/pkgs/shells/zsh/spaceship-prompt/default.nix new file mode 100644 index 000000000000..4df472e4afd2 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/spaceship-prompt/default.nix @@ -0,0 +1,38 @@ +{ lib, stdenvNoCC, fetchFromGitHub }: + +stdenvNoCC.mkDerivation rec { + pname = "spaceship-prompt"; + version = "3.15.0"; + + src = fetchFromGitHub { + owner = "denysdovhan"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-/9c4o9tdXtDefZ1fA62Y9Sg2cv54YVZGlZ1n6EfQWC4="; + }; + + dontBuild = true; + + installPhase = '' + install -Dm644 LICENSE.md "$out/share/licenses/spaceship-prompt/LICENSE" + install -Dm644 README.md "$out/share/doc/spaceship-prompt/README.md" + find docs -type f -exec install -Dm644 {} "$out/share/doc/spaceship-prompt/{}" \; + find lib -type f -exec install -Dm644 {} "$out/lib/spaceship-prompt/{}" \; + find scripts -type f -exec install -Dm644 {} "$out/lib/spaceship-prompt/{}" \; + find sections -type f -exec install -Dm644 {} "$out/lib/spaceship-prompt/{}" \; + install -Dm644 spaceship.zsh "$out/lib/spaceship-prompt/spaceship.zsh" + install -d "$out/share/zsh/themes/" + ln -s "$out/lib/spaceship-prompt/spaceship.zsh" "$out/share/zsh/themes/spaceship.zsh-theme" + install -d "$out/share/zsh/site-functions/" + ln -s "$out/lib/spaceship-prompt/spaceship.zsh" "$out/share/zsh/site-functions/prompt_spaceship_setup" + ''; + + meta = with lib; { + description = "Zsh prompt for Astronauts"; + homepage = "https://github.com/denysdovhan/spaceship-prompt/"; + changelog = "https://github.com/spaceship-prompt/spaceship-prompt/releases/tag/v${version}"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = with maintainers; [ nyanloutre fortuneteller2k ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/tz_completion.patch b/nixpkgs/pkgs/shells/zsh/tz_completion.patch new file mode 100644 index 000000000000..01977828129d --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/tz_completion.patch @@ -0,0 +1,14 @@ +On NixOS, timezone data is located at /etc/zoneinfo +diff --git a/Completion/Unix/Type/_time_zone b/Completion/Unix/Type/_time_zone +index cd924bbc7..5d683291b 100644 +--- a/Completion/Unix/Type/_time_zone ++++ b/Completion/Unix/Type/_time_zone +@@ -3,7 +3,7 @@ + local expl + + if (( ! $+_zoneinfo_dirs )); then +- _zoneinfo_dirs=( /usr/{share,lib,share/lib}/{zoneinfo*,locale/TZ}(/) ) ++ _zoneinfo_dirs=( /etc/zoneinfo /usr/{share,lib,share/lib}/{zoneinfo*,locale/TZ}(/) ) + fi + + _wanted time-zones expl 'time zone' _files -W _zoneinfo_dirs "$@" - diff --git a/nixpkgs/pkgs/shells/zsh/zinit/default.nix b/nixpkgs/pkgs/shells/zsh/zinit/default.nix new file mode 100644 index 000000000000..9946d7d0c3a5 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zinit/default.nix @@ -0,0 +1,42 @@ +{ stdenvNoCC, lib, fetchFromGitHub, installShellFiles }: + +stdenvNoCC.mkDerivation rec { + pname = "zinit"; + version = "3.7"; + src = fetchFromGitHub { + owner = "zdharma-continuum"; + repo = pname; + rev = "v${version}"; + hash = "sha256-B+cTGz+U8MR22l6xXdRAAjDr+ulCk+CJ9GllFMK0axE="; + }; + # adapted from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=zsh-zplugin-git + dontBuild = true; + nativeBuildInputs = [ installShellFiles ]; + installPhase = '' + outdir="$out/share/$pname" + + cd "$src" + + # Zplugin's source files + install -dm0755 "$outdir" + # Installing also backward compatibility layer + install -m0644 z{plugin,init}{,-side,-install,-autoload}.zsh "$outdir" + install -m0755 git-process-output.zsh "$outdir" + + # Zplugin autocompletion + installShellCompletion --zsh _zinit + + #TODO:Zplugin-module files + # find zmodules/ -type d -exec install -dm 755 "{}" "$outdir/{}" \; + # find zmodules/ -type f -exec install -m 744 "{}" "$outdir/{}" \; + + ''; + #TODO:doc output + + meta = with lib; { + homepage = "https://github.com/zdharma-continuum/zinit"; + description = "Flexible zsh plugin manager"; + license = licenses.mit; + maintainers = with maintainers; [ pasqui23 sei40kr ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zplug/default.nix b/nixpkgs/pkgs/shells/zsh/zplug/default.nix new file mode 100644 index 000000000000..d35eb345dda9 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zplug/default.nix @@ -0,0 +1,30 @@ +{ stdenv, lib, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "zplug"; + version = "2.4.2"; + + src = fetchFromGitHub { + owner = "zplug"; + repo = pname; + rev = version; + sha256 = "0hci1pbs3k5icwfyfw5pzcgigbh9vavprxxvakg1xm19n8zb61b3"; + }; + + dontConfigure = true; + dontBuild = true; + dontPatch = true; + + installPhase = '' + mkdir -p $out + cp -r $src/* $out/ + ''; + + meta = with lib; { + description = "A next-generation plugin manager for zsh"; + homepage = "https://github.com/zplug/zplug"; + license = licenses.mit; + platforms = platforms.all; + maintainers = [ maintainers.s1341 ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-autocomplete/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-autocomplete/default.nix new file mode 100644 index 000000000000..a58a941189c9 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-autocomplete/default.nix @@ -0,0 +1,27 @@ +{ lib, stdenvNoCC, fetchFromGitHub }: + +stdenvNoCC.mkDerivation rec { + pname = "zsh-autocomplete"; + version = "21.09.22"; + + src = fetchFromGitHub { + owner = "marlonrichert"; + repo = "zsh-autocomplete"; + rev = version; + sha256 = "sha256-c4+5ta0ATuy9hIygSnqaquHf+YIStvHMaABwq3qyru8="; + }; + + installPhase = '' + install -D zsh-autocomplete.plugin.zsh $out/share/zsh-autocomplete/zsh-autocomplete.plugin.zsh + cp -R scripts $out/share/zsh-autocomplete/scripts + cp -R functions $out/share/zsh-autocomplete/functions + ''; + + meta = with lib; { + description = "Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion"; + homepage = "https://github.com/marlonrichert/zsh-autocomplete/"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = [ maintainers.em0lar ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-autopair/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-autopair/default.nix new file mode 100644 index 000000000000..0cc1535e53ae --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-autopair/default.nix @@ -0,0 +1,25 @@ +{ stdenv, lib, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "zsh-autopair"; + version = "1.0"; + + src = fetchFromGitHub { + owner = "hlissner"; + repo = "zsh-autopair"; + rev = "v${version}"; + sha256 = "1h0vm2dgrmb8i2pvsgis3lshc5b0ad846836m62y8h3rdb3zmpy1"; + }; + + installPhase = '' + install -D autopair.zsh $out/share/zsh/${pname}/autopair.zsh + ''; + + meta = with lib; { + homepage = "https://github.com/hlissner/zsh-autopair"; + description = "A plugin that auto-closes, deletes and skips over matching delimiters in zsh intelligently"; + license = licenses.mit; + maintainers = with maintainers; [ _0qq ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-autosuggestions/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-autosuggestions/default.nix new file mode 100644 index 000000000000..211fde7b0f15 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-autosuggestions/default.nix @@ -0,0 +1,30 @@ +{ lib, stdenv, fetchFromGitHub, zsh }: + +# To make use of this derivation, use the `programs.zsh.autosuggestions.enable` option + +stdenv.mkDerivation rec { + pname = "zsh-autosuggestions"; + version = "0.7.0"; + + src = fetchFromGitHub { + owner = "zsh-users"; + repo = "zsh-autosuggestions"; + rev = "v${version}"; + sha256 = "1g3pij5qn2j7v7jjac2a63lxd97mcsgw6xq6k5p7835q9fjiid98"; + }; + + nativeBuildInputs = [ zsh ]; + + installPhase = '' + install -D zsh-autosuggestions.zsh \ + $out/share/zsh-autosuggestions/zsh-autosuggestions.zsh + ''; + + meta = with lib; { + description = "Fish shell autosuggestions for Zsh"; + homepage = "https://github.com/zsh-users/zsh-autosuggestions"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = [ maintainers.loskutov ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-bd/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-bd/default.nix new file mode 100644 index 000000000000..f2c2dc90fb4e --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-bd/default.nix @@ -0,0 +1,31 @@ +{ lib, stdenv, fetchFromGitHub}: + +stdenv.mkDerivation rec { + pname = "zsh-bd"; + version = "2018-07-04"; + + src = fetchFromGitHub { + owner = "Tarrasch"; + repo = pname; + rev = "d4a55e661b4c9ef6ae4568c6abeff48bdf1b1af7"; + sha256 = "020f8nq86g96cps64hwrskppbh2dapfw2m9np1qbs5pgh16z4fcb"; + }; + + dontBuild = true; + + installPhase = '' + mkdir -p $out/share/zsh-bd + cp {.,$out/share/zsh-bd}/bd.zsh + cd $out/share/zsh-bd + ln -s bd{,.plugin}.zsh + ''; + + meta = { + description = "Jump back to a specific directory, without doing `cd ../../..` "; + homepage = "https://github.com/Tarrasch/zsh-bd"; + license = lib.licenses.free; + + platforms = lib.platforms.unix; + maintainers = [ lib.maintainers.olejorgenb ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-better-npm-completion/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-better-npm-completion/default.nix new file mode 100644 index 000000000000..372d49eaeb7e --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-better-npm-completion/default.nix @@ -0,0 +1,25 @@ +{ lib, stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "zsh-better-npm-completion"; + version = "unstable-2019-11-19"; + + src = fetchFromGitHub { + owner = "lukechilds"; + repo = "zsh-better-npm-completion"; + rev = "0a7cf042415324ec38a186fdcbc9af163f0d7e69"; + sha256 = "16z7k5n1rcl9i61lrm7i5dsqsmhvdp1y4y5ii6hv2xpp470addgy"; + }; + + installPhase = '' + install -Dm 0644 zsh-better-npm-completion.plugin.zsh $out/share/zsh-better-npm-completion + ''; + + meta = with lib; { + description = "Better completion for npm"; + homepage = "https://github.com/lukechilds/zsh-better-npm-completion"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = [ maintainers.gerschtli ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-clipboard/clipboard.plugin.zsh b/nixpkgs/pkgs/shells/zsh/zsh-clipboard/clipboard.plugin.zsh new file mode 100644 index 000000000000..f1f190ec70c3 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-clipboard/clipboard.plugin.zsh @@ -0,0 +1,40 @@ +_cb-yank() { + AA=$(clippaste 2>/dev/null) && CUTBUFFER="$AA" + zle yank +} +_cb-kill-line() { + zle kill-line + printf "%s" "$CUTBUFFER" | clipcopy 2>/dev/null +} +_cb-kill-whole-line() { + zle kill-whole-line + printf "%s" "$CUTBUFFER" | clipcopy 2>/dev/null +} +_cb-kill-word() { + zle kill-word + printf "%s" "$CUTBUFFER" | clipcopy 2>/dev/null +} +_cb-backward-kill-word() { + zle backward-kill-word + printf "%s" "$CUTBUFFER" | clipcopy 2>/dev/null +} +_cb-copy-region-as-kill() { + ## https://unix.stackexchange.com/questions/19947/ + zle copy-region-as-kill + zle set-mark-command -n -1 + printf "%s" "$CUTBUFFER" | clipcopy 2>/dev/null +} + +zle -N _cb-yank +zle -N _cb-kill-line +zle -N _cb-kill-whole-line +zle -N _cb-kill-word +zle -N _cb-backward-kill-word +zle -N _cb-copy-region-as-kill + +bindkey '^y' _cb-yank +bindkey '^k' _cb-kill-line +bindkey '^u' _cb-kill-whole-line +bindkey '\ed' _cb-kill-word +bindkey '\e^?' _cb-backward-kill-word +bindkey '\ew' _cb-copy-region-as-kill diff --git a/nixpkgs/pkgs/shells/zsh/zsh-clipboard/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-clipboard/default.nix new file mode 100644 index 000000000000..114e0bfd7dc5 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-clipboard/default.nix @@ -0,0 +1,27 @@ +{ stdenv, lib }: + +stdenv.mkDerivation rec { + pname = "zsh-clipboard"; + version = "1.0"; + + src = ./.; + + dontBuild = true; + + installPhase = '' + install -D -m0444 -t $out/share/zsh/plugins/clipboard ./clipboard.plugin.zsh + ''; + + meta = with lib; { + description = "Ohmyzsh plugin that integrates kill-ring with system clipboard"; + longDescription = '' + Ohmyzsh plugin that integrates kill-ring with system clipboard. + + Key bindings for C-y, C-k, C-u, M-d, M-backspace and M-w are rebound. + Behaviour of these keys should not be changed. + ''; + license = licenses.mit; + maintainers = with maintainers; [ bb2020 ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-command-time/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-command-time/default.nix new file mode 100644 index 000000000000..b92ced6be71c --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-command-time/default.nix @@ -0,0 +1,34 @@ +{ lib, stdenv, fetchFromGitHub }: + +# To make use of this plugin, need to add +# programs.zsh.interactiveShellInit = '' +# source ${pkgs.zsh-command-time}/share/zsh/plugins/command-time/command-time.plugin.zsh +# ZSH_COMMAND_TIME_COLOR="yellow" +# ZSH_COMMAND_TIME_MIN_SECONDS=3 +# ZSH_COMMAND_TIME_ECHO=1 +# ''; + +stdenv.mkDerivation { + version = "2018-04-30"; + pname = "zsh-command-time"; + + src = fetchFromGitHub { + owner = "popstas"; + repo = "zsh-command-time"; + rev = "afb4a4c9ae7ce64ca9d4f334a79a25e46daad0aa"; + sha256 = "1bvyjgz6bhgg1nwr56r50p6fblgah6yiql55pgm5abnn2h876fjq"; + }; + + dontUnpack = true; + + installPhase = '' + install -Dm0444 $src/command-time.plugin.zsh --target-directory=$out/share/zsh/plugins/command-time + ''; + + meta = with lib; { + description = "Plugin that output time: xx after long commands"; + homepage = "https://github.com/popstas/zsh-command-time"; + license = licenses.mit; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-completions/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-completions/default.nix new file mode 100644 index 000000000000..249826a2a25f --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-completions/default.nix @@ -0,0 +1,26 @@ +{ lib, stdenv, fetchFromGitHub}: + +stdenv.mkDerivation rec { + pname = "zsh-completions"; + version = "0.33.0"; + + src = fetchFromGitHub { + owner = "zsh-users"; + repo = pname; + rev = version; + sha256 = "0vs14n29wvkai84fvz3dz2kqznwsq2i5fzbwpv8nsfk1126ql13i"; + }; + + installPhase= '' + install -D --target-directory=$out/share/zsh/site-functions src/* + ''; + + meta = { + description = "Additional completion definitions for zsh"; + homepage = "https://github.com/zsh-users/zsh-completions"; + license = lib.licenses.free; + + platforms = lib.platforms.unix; + maintainers = [ lib.maintainers.olejorgenb ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-deer/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-deer/default.nix new file mode 100644 index 000000000000..ab544d7c3147 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-deer/default.nix @@ -0,0 +1,33 @@ +{ lib, stdenv, fetchFromGitHub, perl }: + +stdenv.mkDerivation rec { + pname = "deer"; + version = "1.4"; + + src = fetchFromGitHub { + owner = "Vifon"; + repo = "deer"; + rev = "v${version}"; + sha256 = "1xnbnbi0zk2xsyn8dqsmyxqlfnl36pb1wwibnlp0dxixw6sfymyl"; + }; + + prePatch = '' + substituteInPlace deer \ + --replace " perl " " ${perl}/bin/perl " + ''; + + patches = [ ./realpath.patch ]; + + installPhase = '' + mkdir -p $out/share/zsh/site-functions/ + cp deer $out/share/zsh/site-functions/ + ''; + + meta = with lib; { + description = "Ranger-like file navigation for zsh"; + homepage = "https://github.com/Vifon/deer"; + license = licenses.gpl3Plus; + maintainers = [ maintainers.vyp ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-deer/realpath.patch b/nixpkgs/pkgs/shells/zsh/zsh-deer/realpath.patch new file mode 100644 index 000000000000..03850d7e5c12 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-deer/realpath.patch @@ -0,0 +1,28 @@ +From ceadb2f11119143af4f590ea6b05a531483219b5 Mon Sep 17 00:00:00 2001 +From: xd1le <elisp.vim@gmail.com> +Date: Wed, 30 Aug 2017 17:27:20 +1000 +Subject: [PATCH] use realpath instead of python to calculate relative path + +--- + deer | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/deer b/deer +index 3d89dea..804a871 100644 +--- a/deer ++++ b/deer +@@ -259,10 +259,7 @@ deer-get-relative() + { + local TMP + TMP=${1:-${DEER_DIRNAME%/}/$DEER_BASENAME[$DEER_DIRNAME]} +- TMP="`python -c ' +-import sys, os +-print(os.path.relpath(sys.argv[1], sys.argv[2])) +-' $TMP ${DEER_STARTDIR:-$PWD}`" ++ TMP="`realpath --relative-to=${DEER_STARTDIR:-$PWD} $TMP`" + print -R $TMP:q + } + +-- +2.14.1 + diff --git a/nixpkgs/pkgs/shells/zsh/zsh-fast-syntax-highlighting/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-fast-syntax-highlighting/default.nix new file mode 100644 index 000000000000..5b77978c0221 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-fast-syntax-highlighting/default.nix @@ -0,0 +1,30 @@ +{ stdenvNoCC, lib, fetchFromGitHub }: + +stdenvNoCC.mkDerivation rec { + pname = "zsh-fast-syntax-highlighting"; + version = "1.55"; + + src = fetchFromGitHub { + owner = "zdharma-continuum"; + repo = "fast-syntax-highlighting"; + rev = "v${version}"; + sha256 = "0h7f27gz586xxw7cc0wyiv3bx0x3qih2wwh05ad85bh2h834ar8d"; + }; + + dontConfigure = true; + dontBuild = true; + + installPhase = '' + plugindir="$out/share/zsh/site-functions" + + mkdir -p "$plugindir" + cp -r -- {,_,-,.}fast-* *chroma themes "$plugindir"/ + ''; + + meta = with lib; { + description = "Syntax-highlighting for Zshell"; + homepage = "https://github.com/zdharma-continuum/fast-syntax-highlighting"; + license = licenses.bsd3; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-fzf-tab/darwin.patch b/nixpkgs/pkgs/shells/zsh/zsh-fzf-tab/darwin.patch new file mode 100644 index 000000000000..54b6ce26138a --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-fzf-tab/darwin.patch @@ -0,0 +1,11 @@ +diff --git a/modules/Src/aloxaf/fzftab.c b/modules/Src/aloxaf/fzftab.c +index 60b6330..91975d8 100644 +--- a/modules/Src/aloxaf/fzftab.c ++++ b/modules/Src/aloxaf/fzftab.c +@@ -1,6 +1,5 @@ + #include "fzftab.mdh" + #include "fzftab.pro" +-#include <malloc.h> + #include <stdarg.h> + #include <stdlib.h> + #include <sys/stat.h> diff --git a/nixpkgs/pkgs/shells/zsh/zsh-fzf-tab/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-fzf-tab/default.nix new file mode 100644 index 000000000000..4fc092330e37 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-fzf-tab/default.nix @@ -0,0 +1,47 @@ +{ stdenv, lib, fetchFromGitHub, ncurses }: + +let + INSTALL_PATH="${placeholder "out"}/share/fzf-tab"; +in stdenv.mkDerivation rec { + pname = "zsh-fzf-tab"; + version = "unstable-2021-11-12"; + + src = fetchFromGitHub { + owner = "Aloxaf"; + repo = "fzf-tab"; + rev = "190500bf1de6a89416e2a74470d3b5cceab102ba"; + sha256 = "1dipsy0s67fr47ig5559bcp1h5yn8rdjshhs8zsq7j8plvvh99qb"; + }; + + buildInputs = [ ncurses ]; + + patches = lib.optionals stdenv.isDarwin [ ./darwin.patch ]; + + postConfigure = '' + pushd modules + ./configure --disable-gdbm --without-tcsetpgrp + popd + ''; + + postBuild = '' + pushd modules + make -j$NIX_BUILD_CORES + popd + ''; + + installPhase = '' + mkdir -p ${INSTALL_PATH} + cp -r lib ${INSTALL_PATH}/lib + install -D fzf-tab.zsh ${INSTALL_PATH}/fzf-tab.zsh + install -D fzf-tab.plugin.zsh ${INSTALL_PATH}/fzf-tab.plugin.zsh + install -D modules/Src/aloxaf/fzftab.so ${INSTALL_PATH}/modules/Src/aloxaf/fzftab.so + ''; + + meta = with lib; { + homepage = "https://github.com/Aloxaf/fzf-tab"; + description = "Replace zsh's default completion selection menu with fzf!"; + license = licenses.mit; + maintainers = with maintainers; [ vonfry ]; + platforms = platforms.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 000000000000..7fb2d7861937 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-git-prompt/default.nix @@ -0,0 +1,70 @@ +# zsh-git-prompt -- Informative git prompt for zsh +# +# Usage: to enable this plugin for all users, you could +# add it to configuration.nix like this: +# +# programs.zsh.interactiveShellInit = '' +# source ${pkgs.zsh-git-prompt}/share/zsh-git-prompt/zshrc.sh +# ''; +# +# Or you can install it globally but only enable it in individual +# users' ~/.zshrc files: +# +# source /run/current-system/sw/share/zsh-git-prompt/zshrc.sh +# +# Or if installed locally: +# +# source ~/.nix-profile/share/zsh-git-prompt/zshrc.sh +# +# Either way, you then have to set a prompt that incorporates +# git_super_status, for example: +# +# PROMPT='%B%m%~%b$(git_super_status) %# ' +# +# More details are in share/doc/zsh-git-prompt/README.md, once +# installed. +# +{ fetchFromGitHub +, python +, git +, lib +, haskellPackages +}: + +haskellPackages.callPackage + ({ mkDerivation, base, HUnit, parsec, process, QuickCheck }: + mkDerivation rec { + pname = "zsh-git-prompt"; + version = "0.4z"; # While we await a real 0.5 release. + src = fetchFromGitHub { + owner = "starcraftman"; + repo = "zsh-git-prompt"; + rev = "11b83ba3b85d14c66cf2ab79faefab6d838da28e"; + sha256 = "04aylsjfb03ckw219plkzpyiq4j9g66bjxa5pa56h1p7df6pjssb"; + }; + prePatch = '' + substituteInPlace zshrc.sh \ + --replace ':-"python"' ':-"haskell"' \ + --replace 'python ' '${python.interpreter} ' \ + --replace 'git ' '${git}/bin/git ' + ''; + preCompileBuildDriver = "cd src"; + postInstall = '' + cd .. + gpshare=$out/share/${pname} + gpdoc=$out/share/doc/${pname} + mkdir -p $gpshare/src $gpdoc + cp README.md $gpdoc + cp zshrc.sh gitstatus.py $gpshare + mv $out/bin $gpshare/src/.bin + ''; + isLibrary = false; + isExecutable = true; + libraryHaskellDepends = [ base parsec process QuickCheck ]; + executableHaskellDepends = libraryHaskellDepends; + testHaskellDepends = [HUnit] ++ libraryHaskellDepends; + homepage = "https://github.com/olivierverdier/zsh-git-prompt#readme"; + description = "Informative git prompt for zsh"; + license = lib.licenses.mit; + maintainers = [lib.maintainers.league]; + }) {} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-history-substring-search/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-history-substring-search/default.nix new file mode 100644 index 000000000000..9890993eed64 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-history-substring-search/default.nix @@ -0,0 +1,26 @@ +{ stdenv, lib, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "zsh-history-substring-search"; + version = "1.0.2"; + + src = fetchFromGitHub { + owner = "zsh-users"; + repo = "zsh-history-substring-search"; + rev = "v${version}"; + sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y"; + }; + + installPhase = '' + install -D zsh-history-substring-search.zsh \ + "$out/share/zsh-history-substring-search/zsh-history-substring-search.zsh" + ''; + + meta = with lib; { + description = "Fish shell history-substring-search for Zsh"; + homepage = "https://github.com/zsh-users/zsh-history-substring-search"; + license = licenses.bsd3; + maintainers = with maintainers; [ qyliss ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-history/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-history/default.nix new file mode 100644 index 000000000000..333da40adbb0 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-history/default.nix @@ -0,0 +1,37 @@ +{ lib, fetchFromGitHub, buildGoModule, installShellFiles, nixosTests }: + +buildGoModule rec { + pname = "zsh-history"; + version = "2019-12-10"; + + src = fetchFromGitHub { + owner = "b4b4r07"; + repo = "history"; + rev = "8da016bd91b0c2eb53c9980f00eee6abdbb097e2"; + sha256 = "13n643ik1zjvpk8h9458yd9ffahhbdnigmbrbmpn7b7g23wqqsi3"; + }; + + nativeBuildInputs = [ installShellFiles ]; + + vendorSha256 = "13rc1afds5xg30faqz35haha4kxg73b5nvjirbrkc6kna0vhb54z"; + + doCheck = false; + + postInstall = '' + install -d $out/share + cp -r "$NIX_BUILD_TOP/source/misc/"* "$out/share" + installShellCompletion --zsh --name _history $out/share/zsh/completions/_history + ''; + + meta = with lib; { + description = "A CLI to provide enhanced history for your ZSH shell"; + license = licenses.mit; + homepage = "https://github.com/b4b4r07/history"; + platforms = platforms.unix; + maintainers = with maintainers; [ ]; + }; + + passthru.tests = { + zsh-history-shell-integration = nixosTests.zsh-history; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-nix-shell/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-nix-shell/default.nix new file mode 100644 index 000000000000..8b463eda573e --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-nix-shell/default.nix @@ -0,0 +1,29 @@ +{ lib, stdenv, fetchFromGitHub, pkgs }: + +# To make use of this derivation, use +# `programs.zsh.interactiveShellInit = "source ${pkgs.zsh-nix-shell}/share/zsh-nix-shell/nix-shell.plugin.zsh";` + +stdenv.mkDerivation rec { + pname = "zsh-nix-shell"; + version = "0.4.0"; + + src = fetchFromGitHub { + owner = "chisui"; + repo = "zsh-nix-shell"; + rev = "v${version}"; + sha256 = "sha256-719lVo6p55G1tt3+6nMhZ904nyvlq0Q5exb0il36/Aw="; + }; + + installPhase = '' + install -D nix-shell.plugin.zsh --target-directory=$out/share/zsh-nix-shell + install -D scripts/* --target-directory=$out/share/zsh-nix-shell/scripts + ''; + + meta = with lib; { + description = "zsh plugin that lets you use zsh in nix-shell shell"; + homepage = src.meta.homepage; + license = licenses.bsd3; + platforms = platforms.unix; + maintainers = with maintainers; [ aw ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-powerlevel10k/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-powerlevel10k/default.nix new file mode 100644 index 000000000000..419863044b5d --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-powerlevel10k/default.nix @@ -0,0 +1,53 @@ +{ lib, stdenv, fetchFromGitHub, substituteAll, pkgs }: + +# To make use of this derivation, use +# `programs.zsh.promptInit = "source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme";` + +let + # match gitstatus version with given `gitstatus_version`: + # https://github.com/romkatv/powerlevel10k/blob/master/gitstatus/build.info + gitstatus = pkgs.gitstatus.overrideAttrs (oldAtttrs: rec { + version = "1.5.1"; + + src = fetchFromGitHub { + owner = "romkatv"; + repo = "gitstatus"; + rev = "v${version}"; + sha256 = "1ffgh5826985phc8amvzl9iydvsnij5brh4gczfh201vfmw9d4hh"; + }; + }); +in +stdenv.mkDerivation rec { + pname = "powerlevel10k"; + version = "1.15.0"; + + src = fetchFromGitHub { + owner = "romkatv"; + repo = "powerlevel10k"; + rev = "v${version}"; + sha256 = "1b3j2riainx3zz4irww72z0pb8l8ymnh1903zpsy5wmjgb0wkcwq"; + }; + + patches = [ + (substituteAll { + src = ./gitstatusd.patch; + gitstatusdPath = "${gitstatus}/bin/gitstatusd"; + }) + ]; + + installPhase = '' + install -D powerlevel10k.zsh-theme --target-directory=$out/share/zsh-powerlevel10k + install -D config/* --target-directory=$out/share/zsh-powerlevel10k/config + install -D internal/* --target-directory=$out/share/zsh-powerlevel10k/internal + cp -R gitstatus $out/share/zsh-powerlevel10k/gitstatus + ''; + + meta = { + description = "A fast reimplementation of Powerlevel9k ZSH theme"; + homepage = "https://github.com/romkatv/powerlevel10k"; + license = lib.licenses.mit; + + platforms = lib.platforms.unix; + maintainers = [ lib.maintainers.hexa ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-powerlevel10k/gitstatusd.patch b/nixpkgs/pkgs/shells/zsh/zsh-powerlevel10k/gitstatusd.patch new file mode 100644 index 000000000000..3d1c1eaa36d4 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-powerlevel10k/gitstatusd.patch @@ -0,0 +1,13 @@ +diff --git a/gitstatus/gitstatus.plugin.zsh b/gitstatus/gitstatus.plugin.zsh +index b469072..eb1e3be 100644 +--- a/gitstatus/gitstatus.plugin.zsh ++++ b/gitstatus/gitstatus.plugin.zsh +@@ -44,6 +44,8 @@ + + [[ -o 'interactive' ]] || 'return' + ++GITSTATUS_DAEMON=@gitstatusdPath@ ++ + # Temporarily change options. + 'builtin' 'local' '-a' '_gitstatus_opts' + [[ ! -o 'aliases' ]] || _gitstatus_opts+=('aliases') diff --git a/nixpkgs/pkgs/shells/zsh/zsh-powerlevel9k/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-powerlevel9k/default.nix new file mode 100644 index 000000000000..b681dc2d3a3a --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-powerlevel9k/default.nix @@ -0,0 +1,29 @@ +{ lib, stdenv, fetchFromGitHub }: + +# To make use of this derivation, use +# `programs.zsh.promptInit = "source ${pkgs.zsh-powerlevel9k}/share/zsh-powerlevel9k/powerlevel9k.zsh-theme";` + +stdenv.mkDerivation { + pname = "powerlevel9k"; + version = "2017-11-10"; + src = fetchFromGitHub { + owner = "bhilburn"; + repo = "powerlevel9k"; + rev = "87acc51acab3ed4fd33cda2386abed6f98c80720"; + sha256 = "0v1dqg9hvycdkcvklg2njff97xwr8rah0nyldv4xm39r77f4yfvq"; + }; + + installPhase= '' + install -D powerlevel9k.zsh-theme --target-directory=$out/share/zsh-powerlevel9k + install -D functions/* --target-directory=$out/share/zsh-powerlevel9k/functions + ''; + + meta = { + description = "A beautiful theme for zsh"; + homepage = "https://github.com/bhilburn/powerlevel9k"; + license = lib.licenses.mit; + + platforms = lib.platforms.unix; + maintainers = [ lib.maintainers.pierrechevalier83 ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-prezto/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-prezto/default.nix new file mode 100644 index 000000000000..88451979cbb6 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-prezto/default.nix @@ -0,0 +1,39 @@ +{ lib, stdenv, fetchFromGitHub, unstableGitUpdater }: + +stdenv.mkDerivation rec { + pname = "zsh-prezto"; + version = "unstable-2021-06-02"; + + src = fetchFromGitHub { + owner = "sorin-ionescu"; + repo = "prezto"; + rev = "6833fcd2f2afbc7396ea7a5fa9eb3b49f4678242"; + sha256 = "1a8gndj1f8sjnq7clc742lm4qyhp1a2zid6g6lmfr1axhcbn38v6"; + fetchSubmodules = true; + }; + + postPatch = '' + # make zshrc aware of where zsh-prezto is installed + sed -i -e "s|\''${ZDOTDIR:\-\$HOME}/.zprezto/|$out/share/zsh-prezto/|g" runcoms/zshrc + ''; + + installPhase = '' + mkdir -p $out/share/zsh-prezto + cp -R ./ $out/share/zsh-prezto + ''; + + passthru.updateScript = unstableGitUpdater {}; + + meta = with lib; { + description = "The configuration framework for Zsh"; + longDescription = '' + Prezto is the configuration framework for Zsh; it enriches + the command line interface environment with sane defaults, + aliases, functions, auto completion, and prompt themes. + ''; + homepage = "https://github.com/sorin-ionescu/prezto"; + license = licenses.mit; + maintainers = with maintainers; [ holymonson ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-syntax-highlighting/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-syntax-highlighting/default.nix new file mode 100644 index 000000000000..4fc8d5d0dc38 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-syntax-highlighting/default.nix @@ -0,0 +1,27 @@ +{ lib, stdenv, fetchFromGitHub, zsh }: + +# To make use of this derivation, use the `programs.zsh.enableSyntaxHighlighting` option + +stdenv.mkDerivation rec { + version = "0.7.1"; + pname = "zsh-syntax-highlighting"; + + src = fetchFromGitHub { + owner = "zsh-users"; + repo = "zsh-syntax-highlighting"; + rev = version; + sha256 = "03r6hpb5fy4yaakqm3lbf4xcvd408r44jgpv4lnzl9asp4sb9qc0"; + }; + + nativeBuildInputs = [ zsh ]; + + installFlags = [ "PREFIX=$(out)" ]; + + meta = with lib; { + description = "Fish shell like syntax highlighting for Zsh"; + homepage = "https://github.com/zsh-users/zsh-syntax-highlighting"; + license = licenses.bsd3; + platforms = platforms.unix; + maintainers = [ maintainers.loskutov ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-system-clipboard/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-system-clipboard/default.nix new file mode 100644 index 000000000000..b4d407a70bc9 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-system-clipboard/default.nix @@ -0,0 +1,25 @@ +{ stdenv, lib, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "zsh-system-clipboard"; + version = "0.7.0"; + + src = fetchFromGitHub { + owner = "kutsan"; + repo = "zsh-system-clipboard"; + rev = "v${version}"; + sha256 = "09lqav1mz5zajklr3xa0iaivhpykv3azkjb7yj9wyp0hq3vymp8i"; + }; + + installPhase = '' + install -D zsh-system-clipboard.zsh $out/share/zsh/${pname}/zsh-system-clipboard.zsh + ''; + + meta = with lib; { + homepage = "https://github.com/kutsan/zsh-system-clipboard"; + description = "A plugin that adds key bindings support for ZLE (Zsh Line Editor) clipboard operations for vi emulation keymaps"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ _0qq ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-vi-mode/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-vi-mode/default.nix new file mode 100644 index 000000000000..32f1e9c024ac --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-vi-mode/default.nix @@ -0,0 +1,27 @@ +{ lib, stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "zsh-vi-mode"; + version = "0.8.5"; + + src = fetchFromGitHub { + owner = "jeffreytse"; + repo = pname; + rev = "v${version}"; + sha256 = "EOYqHh0rcgoi26eopm6FTl81ehak5kXMmzNcnJDH8/E="; + }; + + dontBuild = true; + + installPhase = '' + mkdir -p $out/share/${pname} + cp *.zsh $out/share/${pname}/ + ''; + + meta = with lib; { + homepage = "https://github.com/jeffreytse/zsh-vi-mode"; + license = licenses.mit; + description = "A better and friendly vi(vim) mode plugin for ZSH."; + maintainers = with maintainers; [ kyleondy ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-you-should-use/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-you-should-use/default.nix new file mode 100644 index 000000000000..8019e75a8594 --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-you-should-use/default.nix @@ -0,0 +1,26 @@ +{ lib, stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "zsh-you-should-use"; + version = "1.7.3"; + + src = fetchFromGitHub { + owner = "MichaelAquilina"; + repo = pname; + rev = version; + sha256 = "1dz48rd66priqhxx7byndqhbmlwxi1nfw8ik25k0z5k7k754brgy"; + }; + + dontBuild = true; + + installPhase = '' + install -D you-should-use.plugin.zsh $out/share/zsh/plugins/you-should-use/you-should-use.plugin.zsh + ''; + + meta = with lib; { + homepage = "https://github.com/MichaelAquilina/zsh-you-should-use"; + license = licenses.gpl3; + description = "ZSH plugin that reminds you to use existing aliases for commands you just typed"; + maintainers = with maintainers; [ ma27 ]; + }; +} diff --git a/nixpkgs/pkgs/shells/zsh/zsh-z/default.nix b/nixpkgs/pkgs/shells/zsh/zsh-z/default.nix new file mode 100644 index 000000000000..9623ff6648cd --- /dev/null +++ b/nixpkgs/pkgs/shells/zsh/zsh-z/default.nix @@ -0,0 +1,28 @@ +{ lib, stdenvNoCC, fetchFromGitHub }: + +stdenvNoCC.mkDerivation rec { + pname = "zsh-z"; + version = "unstable-2021-02-15"; + + src = fetchFromGitHub { + owner = "agkozak"; + repo = pname; + rev = "595c883abec4682929ffe05eb2d088dd18e97557"; + sha256 = "sha256-HnwUWqzwavh/Qox+siOe5lwTp7PBdiYx+9M0NMNFx00="; + }; + + dontBuild = true; + + installPhase = '' + mkdir -p $out/share/zsh-z + cp _zshz zsh-z.plugin.zsh $out/share/zsh-z + ''; + + meta = with lib; { + description = "Jump quickly to directories that you have visited frequently in the past, or recently"; + homepage = "https://github.com/agkozak/zsh-z"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = [ maintainers.evalexpr ]; + }; +} |