From 7c48977c0c139bd16121cb882861f31ebc73180d Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 00:18:02 +0200 Subject: [PATCH 01/18] nushellPlugins.net: refactor --- pkgs/shells/nushell/plugins/net.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkgs/shells/nushell/plugins/net.nix b/pkgs/shells/nushell/plugins/net.nix index 986dd9101f207..a030b958a1fa1 100644 --- a/pkgs/shells/nushell/plugins/net.nix +++ b/pkgs/shells/nushell/plugins/net.nix @@ -1,33 +1,33 @@ { + stdenv, lib, rustPlatform, fetchFromGitHub, nix-update-script, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "nushell_plugin_net"; version = "1.10.0"; src = fetchFromGitHub { owner = "fennewald"; repo = "nu_plugin_net"; - rev = "refs/tags/${version}"; + tag = "${finalAttrs.version}"; hash = "sha256-HiNydU40FprxVmRRZtnXom2kFYI04mbeuGTq8+BMh7o="; }; - useFetchCargoVendor = true; cargoHash = "sha256-tq0XqY2B7tC2ep8vH6T3nkAqxqhniqzYnhbkfB3SbHU="; - nativeBuildInputs = [ rustPlatform.bindgenHook ]; + nativeBuildInputs = lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; passthru.updateScript = nix-update-script { }; - meta = with lib; { + meta = { description = "Nushell plugin to list system network interfaces"; homepage = "https://github.com/fennewald/nu_plugin_net"; - license = licenses.mit; - maintainers = with maintainers; [ happysalada ]; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ happysalada ]; mainProgram = "nu_plugin_net"; }; -} +}) From a76d03be7dc17b00a967fe811e1ee3a8c96bb7ce Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 00:23:41 +0200 Subject: [PATCH 02/18] nushellPlugins.dbus: refactor --- pkgs/shells/nushell/plugins/dbus.nix | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/pkgs/shells/nushell/plugins/dbus.nix b/pkgs/shells/nushell/plugins/dbus.nix index 91d63bb9f3163..8e7e33ca47f01 100644 --- a/pkgs/shells/nushell/plugins/dbus.nix +++ b/pkgs/shells/nushell/plugins/dbus.nix @@ -11,18 +11,17 @@ nushell_plugin_dbus, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "nu_plugin_dbus"; version = "0.14.0"; src = fetchFromGitHub { owner = "devyn"; - repo = pname; - rev = version; + repo = "nu_plugin_dbus"; + tag = finalAttrs.version; hash = "sha256-Ga+1zFwS/v+3iKVEz7TFmJjyBW/gq6leHeyH2vjawto="; }; - useFetchCargoVendor = true; cargoHash = "sha256-7pD5LA1ytO7VqFnHwgf7vW9eS3olnZBgdsj+rmcHkbU="; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; @@ -35,19 +34,19 @@ rustPlatform.buildRustPackage rec { nu = lib.getExe nushell; plugin = lib.getExe nushell_plugin_dbus; in - runCommand "${pname}-test" { } '' + runCommand "${finalAttrs.pname}-test" { } '' touch $out ${nu} -n -c "plugin add --plugin-config $out ${plugin}" ${nu} -n -c "plugin use --plugin-config $out dbus" ''; }; - meta = with lib; { + meta = { description = "Nushell plugin for communicating with D-Bus"; mainProgram = "nu_plugin_dbus"; homepage = "https://github.com/devyn/nu_plugin_dbus"; - license = licenses.mit; - maintainers = with maintainers; [ aftix ]; - platforms = with platforms; linux; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ aftix ]; + platforms = lib.platforms.linux; }; -} +}) From d22a7867e0843d56db7b58f1adc46256ab15244e Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 00:28:21 +0200 Subject: [PATCH 03/18] nushellPlugins.skim: refactor --- pkgs/shells/nushell/plugins/skim.nix | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/pkgs/shells/nushell/plugins/skim.nix b/pkgs/shells/nushell/plugins/skim.nix index 5b2282b1cd2c1..45d02960bf727 100644 --- a/pkgs/shells/nushell/plugins/skim.nix +++ b/pkgs/shells/nushell/plugins/skim.nix @@ -9,21 +9,20 @@ skim, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "nu_plugin_skim"; version = "0.15.0"; src = fetchFromGitHub { owner = "idanarye"; - repo = pname; - tag = "v${version}"; + repo = "nu_plugin_skim"; + tag = "v${finalAttrs.version}"; hash = "sha256-8gO6pT40zBlFxPRapIO9qpMI9whutttqYgOPr91B9Ec="; }; - useFetchCargoVendor = true; cargoHash = "sha256-2poE7Nnwe5rRoU8WknEgzX68z+y9ZplX53v8FURzxmE="; - nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ rustPlatform.bindgenHook ]; + nativeBuildInputs = lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; passthru = { updateScript = nix-update-script { }; @@ -32,19 +31,18 @@ rustPlatform.buildRustPackage rec { nu = lib.getExe nushell; plugin = lib.getExe skim; in - runCommand "${pname}-test" { } '' + runCommand "${finalAttrs.pname}-test" { } '' touch $out ${nu} -n -c "plugin add --plugin-config $out ${plugin}" ${nu} -n -c "plugin use --plugin-config $out skim" ''; }; - meta = with lib; { + meta = { description = "A nushell plugin that adds integrates the skim fuzzy finder"; mainProgram = "nu_plugin_skim"; homepage = "https://github.com/idanarye/nu_plugin_skim"; - license = licenses.mit; - maintainers = with maintainers; [ aftix ]; - platforms = platforms.all; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ aftix ]; }; -} +}) From 7095018016f35d90c1bc65c2829bb36d0aec76c6 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 00:36:35 +0200 Subject: [PATCH 04/18] nushellPlugins.formats: refactor --- pkgs/shells/nushell/plugins/formats.nix | 19 +++++++------------ pkgs/shells/nushell/plugins/hcl.nix | 2 +- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/pkgs/shells/nushell/plugins/formats.nix b/pkgs/shells/nushell/plugins/formats.nix index 5a9b2cc03e0d3..82a056b960732 100644 --- a/pkgs/shells/nushell/plugins/formats.nix +++ b/pkgs/shells/nushell/plugins/formats.nix @@ -7,32 +7,27 @@ nix-update-script, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "nushell_plugin_formats"; inherit (nushell) version src cargoHash; - useFetchCargoVendor = true; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; - cargoBuildFlags = [ "--package nu_plugin_formats" ]; - checkPhase = '' - cargo test --manifest-path crates/nu_plugin_formats/Cargo.toml - ''; + buildAndTestSubdir = "crates/nu_plugin_formats"; passthru.updateScript = nix-update-script { # Skip the version check and only check the hash because we inherit version from nushell. extraArgs = [ "--version=skip" ]; }; - meta = with lib; { + meta = { description = "Formats plugin for Nushell"; mainProgram = "nu_plugin_formats"; - homepage = "https://github.com/nushell/nushell/tree/${version}/crates/nu_plugin_formats"; - license = licenses.mit; - maintainers = with maintainers; [ + homepage = "https://github.com/nushell/nushell/tree/${finalAttrs.version}/crates/nu_plugin_formats"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ viraptor aidalgol ]; - platforms = with platforms; all; }; -} +}) diff --git a/pkgs/shells/nushell/plugins/hcl.nix b/pkgs/shells/nushell/plugins/hcl.nix index dd06dc6a786f4..995185f8063aa 100644 --- a/pkgs/shells/nushell/plugins/hcl.nix +++ b/pkgs/shells/nushell/plugins/hcl.nix @@ -17,7 +17,7 @@ rustPlatform.buildRustPackage rec { tag = version; hash = "sha256-V1RKZ0Tqq0LTGbHS2lLMyf6M4AgAgWSzkDeFUighO4k="; }; - useFetchCargoVendor = true; + cargoHash = "sha256-UbqKfQxut+76yB9F1gT8FEapbX/kHvaShltHpWUdhgc="; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; From e7bb58f0c2428e76b4342b7600a1364569d4fb96 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 00:43:47 +0200 Subject: [PATCH 05/18] nushellPlugins.hcl: refactor --- pkgs/shells/nushell/plugins/hcl.nix | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pkgs/shells/nushell/plugins/hcl.nix b/pkgs/shells/nushell/plugins/hcl.nix index 995185f8063aa..cc439ed4a395a 100644 --- a/pkgs/shells/nushell/plugins/hcl.nix +++ b/pkgs/shells/nushell/plugins/hcl.nix @@ -7,30 +7,28 @@ fetchFromGitHub, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "nushell_plugin_hcl"; version = "0.105.1"; src = fetchFromGitHub { - repo = "nu_plugin_hcl"; owner = "Yethal"; - tag = version; + repo = "nu_plugin_hcl"; + tag = finalAttrs.version; hash = "sha256-V1RKZ0Tqq0LTGbHS2lLMyf6M4AgAgWSzkDeFUighO4k="; }; cargoHash = "sha256-UbqKfQxut+76yB9F1gT8FEapbX/kHvaShltHpWUdhgc="; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; - cargoBuildFlags = [ "--package nu_plugin_hcl" ]; passthru.updateScript = nix-update-script { }; - meta = with lib; { + meta = { description = "Nushell plugin for parsing Hashicorp Configuration Language files"; mainProgram = "nu_plugin_hcl"; homepage = "https://github.com/Yethal/nu_plugin_hcl"; - license = licenses.mit; - maintainers = with maintainers; [ yethal ]; - platforms = with platforms; all; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ yethal ]; }; -} +}) From 17144a68f2e126598883c1aa0346be7e2805e3a9 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 00:50:39 +0200 Subject: [PATCH 06/18] nushellPlugins.highlight: refactor --- pkgs/shells/nushell/plugins/highlight.nix | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/pkgs/shells/nushell/plugins/highlight.nix b/pkgs/shells/nushell/plugins/highlight.nix index 290a5e976ac16..c6a79db9915e7 100644 --- a/pkgs/shells/nushell/plugins/highlight.nix +++ b/pkgs/shells/nushell/plugins/highlight.nix @@ -7,36 +7,29 @@ fetchFromGitHub, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "nushell_plugin_highlight"; version = "1.4.7+0.105.1"; src = fetchFromGitHub { - repo = "nu-plugin-highlight"; owner = "cptpiepmatz"; - rev = "refs/tags/v${version}"; + repo = "nu-plugin-highlight"; + tag = "v${finalAttrs.version}"; hash = "sha256-0jU0c2v3q3RXX/zZlwTBwAdO8HEaROFNV/F4GBFaMt0="; fetchSubmodules = true; }; - useFetchCargoVendor = true; cargoHash = "sha256-UD1IzegajAG13iAOERymDa10JbuhvORVZ8gHy9d6buE="; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; - cargoBuildFlags = [ "--package nu_plugin_highlight" ]; - - checkPhase = '' - cargo test - ''; passthru.updateScript = nix-update-script { }; - meta = with lib; { + meta = { description = "A nushell plugin for syntax highlighting."; mainProgram = "nu_plugin_highlight"; homepage = "https://github.com/cptpiepmatz/nu-plugin-highlight"; - license = licenses.mit; - maintainers = with maintainers; [ mgttlinger ]; - platforms = with platforms; all; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ mgttlinger ]; }; -} +}) From 4627382fe2363d99f5e8fbb77eae0fd80a089fe3 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 01:02:29 +0200 Subject: [PATCH 07/18] nushellPlugins.polars: refactor --- pkgs/shells/nushell/plugins/polars.nix | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/pkgs/shells/nushell/plugins/polars.nix b/pkgs/shells/nushell/plugins/polars.nix index 1811f3520fe5e..e51a89ddcf587 100644 --- a/pkgs/shells/nushell/plugins/polars.nix +++ b/pkgs/shells/nushell/plugins/polars.nix @@ -8,33 +8,29 @@ nix-update-script, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "nushell_plugin_polars"; inherit (nushell) version src cargoHash; - useFetchCargoVendor = true; - nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; buildInputs = [ openssl ]; - cargoBuildFlags = [ "--package nu_plugin_polars" ]; - checkPhase = '' - # test failed without enough columns - cargo test --manifest-path crates/nu_plugin_polars/Cargo.toml -- \ - --skip=dataframe::command::core::to_repr::test::test_examples - ''; + buildAndTestSubdir = "crates/nu_plugin_polars"; + + checkFlags = [ + "--skip=dataframe::command::core::to_repr::test::test_examples" + ]; passthru.updateScript = nix-update-script { # Skip the version check and only check the hash because we inherit version from nushell. extraArgs = [ "--version=skip" ]; }; - meta = with lib; { + meta = { description = "Nushell dataframe plugin commands based on polars"; mainProgram = "nu_plugin_polars"; - homepage = "https://github.com/nushell/nushell/tree/${version}/crates/nu_plugin_polars"; - license = licenses.mit; - maintainers = with maintainers; [ joaquintrinanes ]; - platforms = with platforms; all; + homepage = "https://github.com/nushell/nushell/tree/${finalAttrs.version}/crates/nu_plugin_polars"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ joaquintrinanes ]; }; -} +}) From 2e5baee20b53d4bc6901e7a08b9bd070f255ae2c Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 01:10:10 +0200 Subject: [PATCH 08/18] nushellPlugins.query: refactor --- pkgs/shells/nushell/plugins/query.nix | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/pkgs/shells/nushell/plugins/query.nix b/pkgs/shells/nushell/plugins/query.nix index a247183771167..b99bf1ad8d3e4 100644 --- a/pkgs/shells/nushell/plugins/query.nix +++ b/pkgs/shells/nushell/plugins/query.nix @@ -9,21 +9,17 @@ curl, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "nushell_plugin_query"; inherit (nushell) version src cargoHash; - useFetchCargoVendor = true; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; buildInputs = [ openssl curl ]; - cargoBuildFlags = [ "--package nu_plugin_query" ]; - checkPhase = '' - cargo test --manifest-path crates/nu_plugin_query/Cargo.toml - ''; + buildAndTestSubdir = "crates/nu_plugin_query"; passthru.updateScript = nix-update-script { # Skip the version check and only check the hash because we inherit version from nushell. @@ -33,12 +29,11 @@ rustPlatform.buildRustPackage rec { meta = { description = "Nushell plugin to query JSON, XML, and various web data"; mainProgram = "nu_plugin_query"; - homepage = "https://github.com/nushell/nushell/tree/${version}/crates/nu_plugin_query"; + homepage = "https://github.com/nushell/nushell/tree/${finalAttrs.version}/crates/nu_plugin_query"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ happysalada aidalgol ]; - platforms = lib.platforms.all; }; -} +}) From aa9629d886bb7784a3193660420a66ff0844b9b3 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 01:18:44 +0200 Subject: [PATCH 09/18] nushellPlugins.gstat: refactor --- pkgs/shells/nushell/plugins/gstat.nix | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/pkgs/shells/nushell/plugins/gstat.nix b/pkgs/shells/nushell/plugins/gstat.nix index 885828e53cb0c..dbcac7d064b73 100644 --- a/pkgs/shells/nushell/plugins/gstat.nix +++ b/pkgs/shells/nushell/plugins/gstat.nix @@ -8,33 +8,28 @@ nix-update-script, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "nushell_plugin_gstat"; inherit (nushell) version src cargoHash; - useFetchCargoVendor = true; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; buildInputs = [ openssl ]; - cargoBuildFlags = [ "--package nu_plugin_gstat" ]; - checkPhase = '' - cargo test --manifest-path crates/nu_plugin_gstat/Cargo.toml - ''; + buildAndTestSubdir = "crates/nu_plugin_gstat"; passthru.updateScript = nix-update-script { # Skip the version check and only check the hash because we inherit version from nushell. extraArgs = [ "--version=skip" ]; }; - meta = with lib; { + meta = { description = "Git status plugin for Nushell"; mainProgram = "nu_plugin_gstat"; - homepage = "https://github.com/nushell/nushell/tree/${version}/crates/nu_plugin_gstat"; - license = licenses.mit; - maintainers = with maintainers; [ + homepage = "https://github.com/nushell/nushell/tree/${finalAttrs.version}/crates/nu_plugin_gstat"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ mrkkrp aidalgol ]; - platforms = with platforms; all; }; -} +}) From f79eb5cfc954377e4f15288754bb135ce824b3c7 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 01:21:54 +0200 Subject: [PATCH 10/18] nushellPlugins.units: refactor --- pkgs/shells/nushell/plugins/units.nix | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/pkgs/shells/nushell/plugins/units.nix b/pkgs/shells/nushell/plugins/units.nix index 0ec44bbab3faf..2c575a1233b57 100644 --- a/pkgs/shells/nushell/plugins/units.nix +++ b/pkgs/shells/nushell/plugins/units.nix @@ -7,30 +7,28 @@ fetchFromGitHub, }: -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "nushell_plugin_units"; version = "0.1.6"; src = fetchFromGitHub { - repo = "nu_plugin_units"; owner = "JosephTLyons"; - rev = "v${version}"; + repo = "nu_plugin_units"; + tag = "v${finalAttrs.version}"; hash = "sha256-1KyuUaWN+OiGpo8Ohc/8B+nisdb8uT+T3qBu+JbaVYo="; }; - useFetchCargoVendor = true; + cargoHash = "sha256-LYVwFM8znN96LwOwRnauehrucSqHnKNPoMzl2HRczww="; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; - cargoBuildFlags = [ "--package nu_plugin_units" ]; passthru.updateScript = nix-update-script { }; - meta = with lib; { - description = "A nushell plugin for easily converting between common units."; + meta = { + description = "Nushell plugin for easily converting between common units"; mainProgram = "nu_plugin_units"; homepage = "https://github.com/JosephTLyons/nu_plugin_units"; - license = licenses.mit; - maintainers = with maintainers; [ mgttlinger ]; - platforms = with platforms; all; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ mgttlinger ]; }; -} +}) From bd065b68884efe1bed308af1bc43c6db06bfe420 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 01:46:19 +0200 Subject: [PATCH 11/18] nushellPlugins.*: set pnames correctly Because otherwise: - The names are inconsistent with the other nushell plugins - `versionCheckHook` cannot find the binaries without setting a special variable --- pkgs/shells/nushell/plugins/formats.nix | 2 +- pkgs/shells/nushell/plugins/gstat.nix | 2 +- pkgs/shells/nushell/plugins/hcl.nix | 2 +- pkgs/shells/nushell/plugins/highlight.nix | 2 +- pkgs/shells/nushell/plugins/net.nix | 2 +- pkgs/shells/nushell/plugins/polars.nix | 2 +- pkgs/shells/nushell/plugins/query.nix | 2 +- pkgs/shells/nushell/plugins/units.nix | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkgs/shells/nushell/plugins/formats.nix b/pkgs/shells/nushell/plugins/formats.nix index 82a056b960732..77debd7f71076 100644 --- a/pkgs/shells/nushell/plugins/formats.nix +++ b/pkgs/shells/nushell/plugins/formats.nix @@ -8,7 +8,7 @@ }: rustPlatform.buildRustPackage (finalAttrs: { - pname = "nushell_plugin_formats"; + pname = "nu_plugin_formats"; inherit (nushell) version src cargoHash; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; diff --git a/pkgs/shells/nushell/plugins/gstat.nix b/pkgs/shells/nushell/plugins/gstat.nix index dbcac7d064b73..c39993e6c9d42 100644 --- a/pkgs/shells/nushell/plugins/gstat.nix +++ b/pkgs/shells/nushell/plugins/gstat.nix @@ -9,7 +9,7 @@ }: rustPlatform.buildRustPackage (finalAttrs: { - pname = "nushell_plugin_gstat"; + pname = "nu_plugin_gstat"; inherit (nushell) version src cargoHash; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; diff --git a/pkgs/shells/nushell/plugins/hcl.nix b/pkgs/shells/nushell/plugins/hcl.nix index cc439ed4a395a..d9228b3f0ae78 100644 --- a/pkgs/shells/nushell/plugins/hcl.nix +++ b/pkgs/shells/nushell/plugins/hcl.nix @@ -8,7 +8,7 @@ }: rustPlatform.buildRustPackage (finalAttrs: { - pname = "nushell_plugin_hcl"; + pname = "nu_plugin_hcl"; version = "0.105.1"; src = fetchFromGitHub { diff --git a/pkgs/shells/nushell/plugins/highlight.nix b/pkgs/shells/nushell/plugins/highlight.nix index c6a79db9915e7..26f88c163ce75 100644 --- a/pkgs/shells/nushell/plugins/highlight.nix +++ b/pkgs/shells/nushell/plugins/highlight.nix @@ -8,7 +8,7 @@ }: rustPlatform.buildRustPackage (finalAttrs: { - pname = "nushell_plugin_highlight"; + pname = "nu_plugin_highlight"; version = "1.4.7+0.105.1"; src = fetchFromGitHub { diff --git a/pkgs/shells/nushell/plugins/net.nix b/pkgs/shells/nushell/plugins/net.nix index a030b958a1fa1..6c486965dcf8f 100644 --- a/pkgs/shells/nushell/plugins/net.nix +++ b/pkgs/shells/nushell/plugins/net.nix @@ -7,7 +7,7 @@ }: rustPlatform.buildRustPackage (finalAttrs: { - pname = "nushell_plugin_net"; + pname = "nu_plugin_net"; version = "1.10.0"; src = fetchFromGitHub { diff --git a/pkgs/shells/nushell/plugins/polars.nix b/pkgs/shells/nushell/plugins/polars.nix index e51a89ddcf587..bfd1aeba1821a 100644 --- a/pkgs/shells/nushell/plugins/polars.nix +++ b/pkgs/shells/nushell/plugins/polars.nix @@ -9,7 +9,7 @@ }: rustPlatform.buildRustPackage (finalAttrs: { - pname = "nushell_plugin_polars"; + pname = "nu_plugin_polars"; inherit (nushell) version src cargoHash; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; diff --git a/pkgs/shells/nushell/plugins/query.nix b/pkgs/shells/nushell/plugins/query.nix index b99bf1ad8d3e4..b840959fc93d9 100644 --- a/pkgs/shells/nushell/plugins/query.nix +++ b/pkgs/shells/nushell/plugins/query.nix @@ -10,7 +10,7 @@ }: rustPlatform.buildRustPackage (finalAttrs: { - pname = "nushell_plugin_query"; + pname = "nu_plugin_query"; inherit (nushell) version src cargoHash; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; diff --git a/pkgs/shells/nushell/plugins/units.nix b/pkgs/shells/nushell/plugins/units.nix index 2c575a1233b57..fdcd47ab5fdd3 100644 --- a/pkgs/shells/nushell/plugins/units.nix +++ b/pkgs/shells/nushell/plugins/units.nix @@ -8,7 +8,7 @@ }: rustPlatform.buildRustPackage (finalAttrs: { - pname = "nushell_plugin_units"; + pname = "nu_plugin_units"; version = "0.1.6"; src = fetchFromGitHub { From 8541ae6c6a08b21b2882452ccaaea490e8ac30b5 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 01:31:24 +0200 Subject: [PATCH 12/18] nushellPlugins.*: add `versionCheckHook` Why for each all at the same time? Because all nushell plugins should respond in the same way with either no arguments passed or with `--help`, which contains their version. Also because when new plugins get added or plugins get updated, problems can be easily spotted because the errors are really loud. --- pkgs/shells/nushell/plugins/default.nix | 52 +++++++++++++++---------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/pkgs/shells/nushell/plugins/default.nix b/pkgs/shells/nushell/plugins/default.nix index d689e49b43e12..065c7786d976e 100644 --- a/pkgs/shells/nushell/plugins/default.nix +++ b/pkgs/shells/nushell/plugins/default.nix @@ -3,28 +3,40 @@ config, newScope, dbus, + versionCheckHook, }: lib.makeScope newScope ( self: - with self; - { - gstat = callPackage ./gstat.nix { }; - formats = callPackage ./formats.nix { }; - polars = callPackage ./polars.nix { }; - query = callPackage ./query.nix { }; - net = callPackage ./net.nix { }; - units = callPackage ./units.nix { }; - highlight = callPackage ./highlight.nix { }; - dbus = callPackage ./dbus.nix { - inherit dbus; - nushell_plugin_dbus = self.dbus; - }; - skim = callPackage ./skim.nix { }; - semver = callPackage ./semver.nix { }; - hcl = callPackage ./hcl.nix { }; - } - // lib.optionalAttrs config.allowAliases { - regex = throw "`nu_plugin_regex` is no longer compatible with the current Nushell release."; - } + + lib.mapAttrs + ( + _n: p: + p.overrideAttrs { + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + } + ) + ( + with self; + { + gstat = callPackage ./gstat.nix { }; + formats = callPackage ./formats.nix { }; + polars = callPackage ./polars.nix { }; + query = callPackage ./query.nix { }; + net = callPackage ./net.nix { }; + units = callPackage ./units.nix { }; + highlight = callPackage ./highlight.nix { }; + dbus = callPackage ./dbus.nix { + inherit dbus; + nushell_plugin_dbus = self.dbus; + }; + skim = callPackage ./skim.nix { }; + semver = callPackage ./semver.nix { }; + hcl = callPackage ./hcl.nix { }; + } + // lib.optionalAttrs config.allowAliases { + regex = throw "`nu_plugin_regex` is no longer compatible with the current Nushell release."; + } + ) ) From 94b1ae52c486c1e45a41123c48929f02a4156d8a Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 03:04:36 +0200 Subject: [PATCH 13/18] nushellPlugins.*: `doCheck = false;` where applicable --- pkgs/shells/nushell/plugins/hcl.nix | 3 +++ pkgs/shells/nushell/plugins/highlight.nix | 3 +++ pkgs/shells/nushell/plugins/net.nix | 3 +++ 3 files changed, 9 insertions(+) diff --git a/pkgs/shells/nushell/plugins/hcl.nix b/pkgs/shells/nushell/plugins/hcl.nix index d9228b3f0ae78..de5522b049bce 100644 --- a/pkgs/shells/nushell/plugins/hcl.nix +++ b/pkgs/shells/nushell/plugins/hcl.nix @@ -22,6 +22,9 @@ rustPlatform.buildRustPackage (finalAttrs: { nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; + # there are no tests + doCheck = false; + passthru.updateScript = nix-update-script { }; meta = { diff --git a/pkgs/shells/nushell/plugins/highlight.nix b/pkgs/shells/nushell/plugins/highlight.nix index 26f88c163ce75..e295c33e6890c 100644 --- a/pkgs/shells/nushell/plugins/highlight.nix +++ b/pkgs/shells/nushell/plugins/highlight.nix @@ -23,6 +23,9 @@ rustPlatform.buildRustPackage (finalAttrs: { nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; + # there are no tests + doCheck = false; + passthru.updateScript = nix-update-script { }; meta = { diff --git a/pkgs/shells/nushell/plugins/net.nix b/pkgs/shells/nushell/plugins/net.nix index 6c486965dcf8f..900b53e7a0df4 100644 --- a/pkgs/shells/nushell/plugins/net.nix +++ b/pkgs/shells/nushell/plugins/net.nix @@ -21,6 +21,9 @@ rustPlatform.buildRustPackage (finalAttrs: { nativeBuildInputs = lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; + # there are no tests + doCheck = false; + passthru.updateScript = nix-update-script { }; meta = { From 4e681f2a04ae1c99dc71a7122d1790bb4c9f0cab Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 14:54:39 +0200 Subject: [PATCH 14/18] nushellPlugins.*: add load check to all --- pkgs/shells/nushell/plugins/dbus.nix | 17 +------------ pkgs/shells/nushell/plugins/default.nix | 34 +++++++++++++++++++++---- pkgs/shells/nushell/plugins/skim.nix | 17 +------------ 3 files changed, 31 insertions(+), 37 deletions(-) diff --git a/pkgs/shells/nushell/plugins/dbus.nix b/pkgs/shells/nushell/plugins/dbus.nix index 8e7e33ca47f01..8b37fad33a8e1 100644 --- a/pkgs/shells/nushell/plugins/dbus.nix +++ b/pkgs/shells/nushell/plugins/dbus.nix @@ -1,14 +1,11 @@ { stdenv, - runCommand, lib, rustPlatform, pkg-config, nix-update-script, fetchFromGitHub, dbus, - nushell, - nushell_plugin_dbus, }: rustPlatform.buildRustPackage (finalAttrs: { @@ -27,19 +24,7 @@ rustPlatform.buildRustPackage (finalAttrs: { nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; buildInputs = [ dbus ]; - passthru = { - updateScript = nix-update-script { }; - tests.check = - let - nu = lib.getExe nushell; - plugin = lib.getExe nushell_plugin_dbus; - in - runCommand "${finalAttrs.pname}-test" { } '' - touch $out - ${nu} -n -c "plugin add --plugin-config $out ${plugin}" - ${nu} -n -c "plugin use --plugin-config $out dbus" - ''; - }; + passthru.updateScript = nix-update-script { }; meta = { description = "Nushell plugin for communicating with D-Bus"; diff --git a/pkgs/shells/nushell/plugins/default.nix b/pkgs/shells/nushell/plugins/default.nix index 065c7786d976e..df15b6aadd151 100644 --- a/pkgs/shells/nushell/plugins/default.nix +++ b/pkgs/shells/nushell/plugins/default.nix @@ -4,6 +4,8 @@ newScope, dbus, versionCheckHook, + nushell, + runCommand, }: lib.makeScope newScope ( @@ -12,10 +14,33 @@ lib.makeScope newScope ( lib.mapAttrs ( _n: p: - p.overrideAttrs { - doInstallCheck = true; - nativeInstallCheckInputs = [ versionCheckHook ]; - } + let + # add two checks: + # - `versionCheckhook`, checks wether it's a binary that is able to + # display its own version + # - A check which loads the plugin into the current version of nushell, + # to detect incompatibilities (plugins are compiled for very specific + # versions of nushell). If this fails, either update the plugin or mark + # as broken. + withChecks = p.overrideAttrs ( + final: _prev: { + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + + passthru.tests.loadCheck = + let + nu = lib.getExe nushell; + plugin = lib.getExe withChecks; + in + runCommand "test-load-${final.pname}" { } '' + touch $out + ${nu} -n -c "plugin add --plugin-config $out ${plugin}" + ${nu} -n -c "plugin use --plugin-config $out ${plugin}" + ''; + } + ); + in + withChecks ) ( with self; @@ -29,7 +54,6 @@ lib.makeScope newScope ( highlight = callPackage ./highlight.nix { }; dbus = callPackage ./dbus.nix { inherit dbus; - nushell_plugin_dbus = self.dbus; }; skim = callPackage ./skim.nix { }; semver = callPackage ./semver.nix { }; diff --git a/pkgs/shells/nushell/plugins/skim.nix b/pkgs/shells/nushell/plugins/skim.nix index 45d02960bf727..0cf990aa66c95 100644 --- a/pkgs/shells/nushell/plugins/skim.nix +++ b/pkgs/shells/nushell/plugins/skim.nix @@ -1,12 +1,9 @@ { stdenv, - runCommand, lib, rustPlatform, nix-update-script, fetchFromGitHub, - nushell, - skim, }: rustPlatform.buildRustPackage (finalAttrs: { @@ -24,19 +21,7 @@ rustPlatform.buildRustPackage (finalAttrs: { nativeBuildInputs = lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; - passthru = { - updateScript = nix-update-script { }; - tests.check = - let - nu = lib.getExe nushell; - plugin = lib.getExe skim; - in - runCommand "${finalAttrs.pname}-test" { } '' - touch $out - ${nu} -n -c "plugin add --plugin-config $out ${plugin}" - ${nu} -n -c "plugin use --plugin-config $out skim" - ''; - }; + passthru.updateScript = nix-update-script { }; meta = { description = "A nushell plugin that adds integrates the skim fuzzy finder"; From fdcb0246dbfd60ddb86bb97f14c582a066f623d4 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 16:37:48 +0200 Subject: [PATCH 15/18] nushellPlugins.units: mark as broken --- pkgs/shells/nushell/plugins/units.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/shells/nushell/plugins/units.nix b/pkgs/shells/nushell/plugins/units.nix index fdcd47ab5fdd3..f968cf359d613 100644 --- a/pkgs/shells/nushell/plugins/units.nix +++ b/pkgs/shells/nushell/plugins/units.nix @@ -30,5 +30,8 @@ rustPlatform.buildRustPackage (finalAttrs: { homepage = "https://github.com/JosephTLyons/nu_plugin_units"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ mgttlinger ]; + # "Plugin `units` is compiled for nushell version 0.104.0, which is not + # compatible with version 0.105.1" + broken = true; }; }) From 8f7a6eca02c63f7e5e0693f464857b0a8a2a83ad Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 16:39:11 +0200 Subject: [PATCH 16/18] nushellPlugins.dbus: mark as broken --- pkgs/shells/nushell/plugins/dbus.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/shells/nushell/plugins/dbus.nix b/pkgs/shells/nushell/plugins/dbus.nix index 8b37fad33a8e1..d989b61def66e 100644 --- a/pkgs/shells/nushell/plugins/dbus.nix +++ b/pkgs/shells/nushell/plugins/dbus.nix @@ -33,5 +33,8 @@ rustPlatform.buildRustPackage (finalAttrs: { license = lib.licenses.mit; maintainers = with lib.maintainers; [ aftix ]; platforms = lib.platforms.linux; + # "Plugin `dbus` is compiled for nushell version 0.101.0, which is not + # compatible with version 0.105.1" + broken = true; }; }) From fad92653b7540113899c72cc6cd86ec39996a646 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 16:42:53 +0200 Subject: [PATCH 17/18] nushellPlugins.net: mark as broken --- pkgs/shells/nushell/plugins/net.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/shells/nushell/plugins/net.nix b/pkgs/shells/nushell/plugins/net.nix index 900b53e7a0df4..93d5daf4c8c9e 100644 --- a/pkgs/shells/nushell/plugins/net.nix +++ b/pkgs/shells/nushell/plugins/net.nix @@ -32,5 +32,8 @@ rustPlatform.buildRustPackage (finalAttrs: { license = lib.licenses.mit; maintainers = with lib.maintainers; [ happysalada ]; mainProgram = "nu_plugin_net"; + # "Plugin `net` is compiled for nushell version 0.104.0, which is not + # compatible with version 0.105.1" + broken = true; }; }) From 37467643f3a6dd3ae2c8e5786285b411df96c4a0 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 28 Jun 2025 23:19:01 +0200 Subject: [PATCH 18/18] nushell: comment on plugin compatibility --- pkgs/shells/nushell/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/shells/nushell/default.nix b/pkgs/shells/nushell/default.nix index 5576dfd98c2a8..3f92cc4224fb2 100644 --- a/pkgs/shells/nushell/default.nix +++ b/pkgs/shells/nushell/default.nix @@ -20,6 +20,9 @@ }: let + # NOTE: when updating this to a new non-patch version, please also try to + # update the plugins. Plugins only work if they are compiled for the same + # major/minor version. version = "0.105.1"; in rustPlatform.buildRustPackage {