From a6a6e5518c49dcd106993ba022f75a1ff5aa13f4 Mon Sep 17 00:00:00 2001 From: HigherOrderLogic <73709188+HigherOrderLogic@users.noreply.github.com> Date: Tue, 30 Jun 2026 00:26:32 +0000 Subject: [PATCH 1/5] buildFishPlugin: allow `finalAttrs` pattern --- .../shells/fish/plugins/build-fish-plugin.nix | 123 ++++++++---------- 1 file changed, 56 insertions(+), 67 deletions(-) diff --git a/pkgs/shells/fish/plugins/build-fish-plugin.nix b/pkgs/shells/fish/plugins/build-fish-plugin.nix index ce8b99cca1af..70597c2441ee 100644 --- a/pkgs/shells/fish/plugins/build-fish-plugin.nix +++ b/pkgs/shells/fish/plugins/build-fish-plugin.nix @@ -4,83 +4,72 @@ writeScript, wrapFish, }: - -attrs@{ - pname, - version, - src, - - name ? "fishplugin-${pname}-${version}", - unpackPhase ? "", - configurePhase ? ":", - buildPhase ? ":", - preInstall ? "", - postInstall ? "", - - nativeCheckInputs ? [ ], - # 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 = removeAttrs attrs [ +lib.extendMkDerivation { + constructDrv = stdenv.mkDerivation; + excludeDrvArgNames = [ "checkPlugins" "checkFunctionDirs" ]; -in + extendDrvArgs = + finalAttrs: + { + name ? "fishplugin-${finalAttrs.pname}-${finalAttrs.version}", + unpackPhase ? "", + configurePhase ? ":", + buildPhase ? ":", -stdenv.mkDerivation ( - drvAttrs - // { - inherit name; - inherit unpackPhase configurePhase buildPhase; + nativeCheckInputs ? [ ], + # 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 != "", - inherit preInstall postInstall; - installPhase = '' - runHook preInstall + ... + }: + { + inherit name; + inherit unpackPhase configurePhase buildPhase; - ( - install_vendor_files() { - source="$1" - target="$out/share/fish/vendor_$2.d" + installPhase = '' + runHook preInstall - # Check if any .fish file exists in $source - [ -n "$(shopt -s nullglob; echo $source/*.fish)" ] || return 0 + ( + install_vendor_files() { + source="$1" + target="$out/share/fish/vendor_$2.d" - mkdir -p $target - cp $source/*.fish "$target/" - } + # Check if any .fish file exists in $source + [ -n "$(shopt -s nullglob; echo $source/*.fish)" ] || return 0 - install_vendor_files completions completions - install_vendor_files functions functions - install_vendor_files conf conf - install_vendor_files conf.d conf - ) + mkdir -p $target + cp $source/*.fish "$target/" + } - runHook postInstall - ''; + install_vendor_files completions completions + install_vendor_files functions functions + install_vendor_files conf conf + install_vendor_files conf.d conf + ) - inherit doCheck; + runHook postInstall + ''; - nativeCheckInputs = [ - (wrapFish { - pluginPkgs = checkPlugins; - functionDirs = checkFunctionDirs; - }) - ] - ++ nativeCheckInputs; + inherit doCheck; - checkPhase = '' - export HOME=$(mktemp -d) # fish wants a writable home - fish "${writeScript "${name}-test" checkPhase}" - ''; - } -) + nativeCheckInputs = [ + (wrapFish { + pluginPkgs = checkPlugins; + functionDirs = checkFunctionDirs; + }) + ] + ++ nativeCheckInputs; + + checkPhase = '' + export HOME=$(mktemp -d) # fish wants a writable home + fish "${writeScript "${finalAttrs.name}-test" checkPhase}" + ''; + }; +} From f9ca6dfff1da505cba762266861a64818d67f9fb Mon Sep 17 00:00:00 2001 From: HigherOrderLogic <73709188+HigherOrderLogic@users.noreply.github.com> Date: Tue, 30 Jun 2026 00:28:42 +0000 Subject: [PATCH 2/5] buildFishPlugin: use writable tmp dir home hook --- pkgs/shells/fish/plugins/build-fish-plugin.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/shells/fish/plugins/build-fish-plugin.nix b/pkgs/shells/fish/plugins/build-fish-plugin.nix index 70597c2441ee..350f7f41cd17 100644 --- a/pkgs/shells/fish/plugins/build-fish-plugin.nix +++ b/pkgs/shells/fish/plugins/build-fish-plugin.nix @@ -3,6 +3,7 @@ lib, writeScript, wrapFish, + writableTmpDirAsHomeHook, }: lib.extendMkDerivation { constructDrv = stdenv.mkDerivation; @@ -60,6 +61,7 @@ lib.extendMkDerivation { inherit doCheck; nativeCheckInputs = [ + writableTmpDirAsHomeHook (wrapFish { pluginPkgs = checkPlugins; functionDirs = checkFunctionDirs; @@ -68,7 +70,6 @@ lib.extendMkDerivation { ++ nativeCheckInputs; checkPhase = '' - export HOME=$(mktemp -d) # fish wants a writable home fish "${writeScript "${finalAttrs.name}-test" checkPhase}" ''; }; From 55705eabb0a8f05ed92e58ff0ac07c3ddb9a2114 Mon Sep 17 00:00:00 2001 From: HigherOrderLogic <73709188+HigherOrderLogic@users.noreply.github.com> Date: Mon, 29 Jun 2026 10:13:15 +0000 Subject: [PATCH 3/5] fishPlugins.pisces: convert to `finalAttrs` pattern --- pkgs/shells/fish/plugins/pisces.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/shells/fish/plugins/pisces.nix b/pkgs/shells/fish/plugins/pisces.nix index cd768233ae3b..f94e7922daf2 100644 --- a/pkgs/shells/fish/plugins/pisces.nix +++ b/pkgs/shells/fish/plugins/pisces.nix @@ -3,15 +3,14 @@ buildFishPlugin, fetchFromGitHub, }: - -buildFishPlugin rec { +buildFishPlugin (finalAttrs: { pname = "pisces"; version = "0.7.0"; src = fetchFromGitHub { owner = "laughedelic"; repo = "pisces"; - tag = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-Oou2IeNNAqR00ZT3bss/DbhrJjGeMsn9dBBYhgdafBw="; }; @@ -21,4 +20,4 @@ buildFishPlugin rec { license = lib.licenses.lgpl3; maintainers = with lib.maintainers; [ vanilla ]; }; -} +}) From 3c9b70a64f74cca930239b0e773e9c3e76b7bf05 Mon Sep 17 00:00:00 2001 From: HigherOrderLogic <73709188+HigherOrderLogic@users.noreply.github.com> Date: Mon, 29 Jun 2026 10:13:31 +0000 Subject: [PATCH 4/5] fishPlugins.done: convert to `finalAttrs` pattern --- pkgs/shells/fish/plugins/done.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/shells/fish/plugins/done.nix b/pkgs/shells/fish/plugins/done.nix index bc580f35e396..1d5eb0d00a25 100644 --- a/pkgs/shells/fish/plugins/done.nix +++ b/pkgs/shells/fish/plugins/done.nix @@ -5,15 +5,14 @@ fishtape, jq, }: - -buildFishPlugin rec { +buildFishPlugin (finalAttrs: { pname = "done"; version = "1.21.1"; src = fetchFromGitHub { owner = "franciscolourenco"; repo = "done"; - rev = version; + rev = finalAttrs.version; hash = "sha256-GZ1ZpcaEfbcex6XvxOFJDJqoD9C5out0W4bkkn768r0="; }; @@ -37,4 +36,4 @@ buildFishPlugin rec { rexies ]; }; -} +}) From 247f9416e2bf7cb0ca23133e8a982b6bcb416b0d Mon Sep 17 00:00:00 2001 From: HigherOrderLogic <73709188+HigherOrderLogic@users.noreply.github.com> Date: Mon, 29 Jun 2026 10:16:11 +0000 Subject: [PATCH 5/5] fishPlugins.pure: convert to `finalAttrs` pattern --- pkgs/shells/fish/plugins/pure.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/shells/fish/plugins/pure.nix b/pkgs/shells/fish/plugins/pure.nix index 438f30145a0a..a5cfeda94c30 100644 --- a/pkgs/shells/fish/plugins/pure.nix +++ b/pkgs/shells/fish/plugins/pure.nix @@ -5,15 +5,14 @@ git, fishtape_3, }: - -buildFishPlugin rec { +buildFishPlugin (finalAttrs: { pname = "pure"; version = "4.15.0"; src = fetchFromGitHub { owner = "pure-fish"; repo = "pure"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-fqcIfst9YnkOi50pIUMoJJQ7s1w1Vr6hRdEFo+FWIZY="; }; @@ -32,4 +31,4 @@ buildFishPlugin rec { license = lib.licenses.mit; maintainers = with lib.maintainers; [ euxane ]; }; -} +})