diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-01-26 18:06:19 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-01-26 18:21:18 +0000 |
commit | 7ac6743433dd45ceaead2ca96f6356dc0d064ce6 (patch) | |
tree | b68ec89d7d2a8d2b6e6b1ff94ba26d6af4096350 /nixpkgs/pkgs/shells/fish | |
parent | c5c7451dbef37b51f52792d6395a670ef5183d27 (diff) | |
parent | 891f607d5301d6730cb1f9dcf3618bcb1ab7f10e (diff) | |
download | nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar.gz nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar.bz2 nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar.lz nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar.xz nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar.zst nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.zip |
Merge commit '891f607d5301d6730cb1f9dcf3618bcb1ab7f10e'
Diffstat (limited to 'nixpkgs/pkgs/shells/fish')
-rw-r--r-- | nixpkgs/pkgs/shells/fish/babelfish.nix | 21 | ||||
-rw-r--r-- | nixpkgs/pkgs/shells/fish/default.nix | 2 | ||||
-rw-r--r-- | nixpkgs/pkgs/shells/fish/plugins/build-fish-plugin.nix | 67 | ||||
-rw-r--r-- | nixpkgs/pkgs/shells/fish/plugins/default.nix | 13 | ||||
-rw-r--r-- | nixpkgs/pkgs/shells/fish/plugins/fishtape.nix | 32 | ||||
-rw-r--r-- | nixpkgs/pkgs/shells/fish/plugins/foreign-env/default.nix (renamed from nixpkgs/pkgs/shells/fish/fish-foreign-env/default.nix) | 18 | ||||
-rw-r--r-- | nixpkgs/pkgs/shells/fish/plugins/foreign-env/suppress-harmless-warnings.patch (renamed from nixpkgs/pkgs/shells/fish/fish-foreign-env/suppress-harmless-warnings.patch) | 0 | ||||
-rw-r--r-- | nixpkgs/pkgs/shells/fish/plugins/pure.nix | 29 | ||||
-rw-r--r-- | nixpkgs/pkgs/shells/fish/wrapper.nix | 25 |
9 files changed, 195 insertions, 12 deletions
diff --git a/nixpkgs/pkgs/shells/fish/babelfish.nix b/nixpkgs/pkgs/shells/fish/babelfish.nix new file mode 100644 index 000000000000..c23e0b1ca923 --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/babelfish.nix @@ -0,0 +1,21 @@ +{ lib, stdenv, buildGoModule, fetchFromGitHub }: +buildGoModule rec { + pname = "babelfish"; + version = "1.0.1"; + + src = fetchFromGitHub { + owner = "bouk"; + repo = "babelfish"; + rev = "v${version}"; + sha256 = "1sr6y79igyfc9ia33nyrjjm4my1jrpcw27iks37kygh93npsb3r1"; + }; + + vendorSha256 = "0xjy50wciw329kq1nkd7hhaipcp4fy28hhk6cdq21qwid6g21gag"; + + 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 index 0811d43eb6ab..a39a2fc740bd 100644 --- a/nixpkgs/pkgs/shells/fish/default.nix +++ b/nixpkgs/pkgs/shells/fish/default.nix @@ -196,8 +196,6 @@ let tee -a $out/share/fish/__fish_build_paths.fish < ${fishPreInitHooks} ''; - enableParallelBuilding = true; - meta = with lib; { description = "Smart and user-friendly command line shell"; homepage = "http://fishshell.com/"; 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..a52c57464929 --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/plugins/build-fish-plugin.nix @@ -0,0 +1,67 @@ +{ stdenv, lib, writeScript, wrapFish }: + +attrs@{ + pname, + version, + src, + + name ? "fishplugin-${pname}-${version}", + unpackPhase ? "", + configurePhase ? ":", + buildPhase ? ":", + preInstall ? "", + postInstall ? "", + # name of the subdirectory in which to store the plugin + installPath ? lib.getName pname, + + 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 != "", + + ... +}: + +stdenv.mkDerivation (attrs // { + 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/default.nix b/nixpkgs/pkgs/shells/fish/plugins/default.nix new file mode 100644 index 000000000000..e543d49516a8 --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/plugins/default.nix @@ -0,0 +1,13 @@ +{ lib, newScope }: + +lib.makeScope newScope (self: with self; { + + buildFishPlugin = callPackage ./build-fish-plugin.nix { }; + + fishtape = callPackage ./fishtape.nix { }; + + foreign-env = callPackage ./foreign-env { }; + + pure = callPackage ./pure.nix { }; + +}) 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/fish-foreign-env/default.nix b/nixpkgs/pkgs/shells/fish/plugins/foreign-env/default.nix index ef157f323923..03435340d179 100644 --- a/nixpkgs/pkgs/shells/fish/fish-foreign-env/default.nix +++ b/nixpkgs/pkgs/shells/fish/plugins/foreign-env/default.nix @@ -1,7 +1,7 @@ -{ stdenv, fetchFromGitHub, gnused, bash, coreutils }: +{ lib, buildFishPlugin, fetchFromGitHub, gnused, bash, coreutils }: -stdenv.mkDerivation { - pname = "fish-foreign-env"; +buildFishPlugin { + pname = "foreign-env"; version = "git-20200209"; src = fetchFromGitHub { @@ -11,18 +11,16 @@ stdenv.mkDerivation { sha256 = "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs"; }; - installPhase = '' - mkdir -p $out/share/fish-foreign-env/functions/ - cp functions/* $out/share/fish-foreign-env/functions/ + 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 $out/share/fish-foreign-env/functions/* + -i functions/* ''; - patches = [ ./suppress-harmless-warnings.patch ]; - - meta = with stdenv.lib; { + meta = with lib; { description = "A foreign environment interface for Fish shell"; license = licenses.mit; maintainers = with maintainers; [ jgillich ]; diff --git a/nixpkgs/pkgs/shells/fish/fish-foreign-env/suppress-harmless-warnings.patch b/nixpkgs/pkgs/shells/fish/plugins/foreign-env/suppress-harmless-warnings.patch index 6eed35152120..6eed35152120 100644 --- a/nixpkgs/pkgs/shells/fish/fish-foreign-env/suppress-harmless-warnings.patch +++ b/nixpkgs/pkgs/shells/fish/plugins/foreign-env/suppress-harmless-warnings.patch diff --git a/nixpkgs/pkgs/shells/fish/plugins/pure.nix b/nixpkgs/pkgs/shells/fish/plugins/pure.nix new file mode 100644 index 000000000000..3221f6b97ca7 --- /dev/null +++ b/nixpkgs/pkgs/shells/fish/plugins/pure.nix @@ -0,0 +1,29 @@ +{ lib, buildFishPlugin, fetchFromGitHub, git, fishtape }: + +buildFishPlugin rec { + pname = "pure"; + version = "3.4.2"; + + src = fetchFromGitHub { + owner = "rafaelrinaldi"; + repo = "pure"; + rev = "v${version}"; + sha256 = "134sz3f98gb6z2vgd5kkm6dd8pka5gijk843c32s616w35y07sga"; + }; + + 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..053568bc6b9b --- /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; + safeConfPath = map escapeShellArg confPath; + +in writeShellScriptBin "fish" '' + ${fish}/bin/fish --init-command " + set --prepend fish_complete_path ${escapeShellArgs complPath} + set --prepend fish_function_path ${escapeShellArgs funcPath} + for c in {${concatStringsSep "," safeConfPath}}/*; source $c; end + " "$@" +'') |