diff --git a/pkgs/shells/nushell/default.nix b/pkgs/shells/nushell/default.nix index 066f31b6e76a..a391ac6999eb 100644 --- a/pkgs/shells/nushell/default.nix +++ b/pkgs/shells/nushell/default.nix @@ -21,7 +21,7 @@ }: let - version = "0.96.1"; + version = "0.97.1"; in rustPlatform.buildRustPackage { @@ -32,10 +32,10 @@ rustPlatform.buildRustPackage { owner = "nushell"; repo = "nushell"; rev = version; - hash = "sha256-I9cCvm2qTCwnRonfE86ippBV4V1r8U5HFr9OA96wVqI="; + hash = "sha256-hrcPWJ5OXFozfNux6iR/nEw/1z64N5BV4DD/JWhlH2U="; }; - cargoHash = "sha256-XlsK7zu3Pyc5p5SPVCsBqxIyKedaAPF58Ki7keOZRYM="; + cargoHash = "sha256-iGmAgrj1oy0t8SsSuCNiUoqWXDFA2CdsPnYYYOpXofs="; nativeBuildInputs = [ pkg-config ] ++ lib.optionals (withDefaultFeatures && stdenv.isLinux) [ python3 ] diff --git a/pkgs/shells/nushell/plugins/formats.nix b/pkgs/shells/nushell/plugins/formats.nix index c7cc59112645..f713957f27d2 100644 --- a/pkgs/shells/nushell/plugins/formats.nix +++ b/pkgs/shells/nushell/plugins/formats.nix @@ -1,21 +1,24 @@ -{ stdenv -, lib -, rustPlatform -, nushell -, pkg-config -, IOKit -, Foundation -, nix-update-script +{ + stdenv, + lib, + rustPlatform, + nushell, + pkg-config, + IOKit, + Foundation, + nix-update-script, }: rustPlatform.buildRustPackage rec { pname = "nushell_plugin_formats"; inherit (nushell) version src; - cargoHash = "sha256-R4a+lD0KkdKrh2l7Fuyf/g/SvluDLjgAkolAF2h3Bl4="; + cargoHash = "sha256-pWtQYraMJ8nXJiTQPXxu/kEg4ftQy8YAjhUj9WPEYS8="; - nativeBuildInputs = [ pkg-config ] - ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; - buildInputs = lib.optionals stdenv.isDarwin [ IOKit Foundation ]; + nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; + buildInputs = lib.optionals stdenv.isDarwin [ + IOKit + Foundation + ]; cargoBuildFlags = [ "--package nu_plugin_formats" ]; checkPhase = '' @@ -32,7 +35,10 @@ rustPlatform.buildRustPackage rec { mainProgram = "nu_plugin_formats"; homepage = "https://github.com/nushell/nushell/tree/${version}/crates/nu_plugin_formats"; license = licenses.mit; - maintainers = with maintainers; [ viraptor aidalgol ]; + maintainers = with maintainers; [ + viraptor + aidalgol + ]; platforms = with platforms; all; }; } diff --git a/pkgs/shells/nushell/plugins/gstat.nix b/pkgs/shells/nushell/plugins/gstat.nix index 971d88660455..c2b12073b727 100644 --- a/pkgs/shells/nushell/plugins/gstat.nix +++ b/pkgs/shells/nushell/plugins/gstat.nix @@ -1,20 +1,20 @@ -{ stdenv -, lib -, rustPlatform -, openssl -, nushell -, pkg-config -, Security -, nix-update-script +{ + stdenv, + lib, + rustPlatform, + openssl, + nushell, + pkg-config, + Security, + nix-update-script, }: rustPlatform.buildRustPackage rec { pname = "nushell_plugin_gstat"; inherit (nushell) version src; - cargoHash = "sha256-lVuCLp18jqeMdpEpIesN5vUgceLTg+un8n7SkGf8xZU="; + cargoHash = "sha256-f7gH5Kxz8vsYQluvIl/VNklFh80kFKCZEyJvH5eD9Qk="; - nativeBuildInputs = [ pkg-config ] - ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; + nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security ]; cargoBuildFlags = [ "--package nu_plugin_gstat" ]; @@ -32,7 +32,10 @@ rustPlatform.buildRustPackage rec { mainProgram = "nu_plugin_gstat"; homepage = "https://github.com/nushell/nushell/tree/${version}/crates/nu_plugin_gstat"; license = licenses.mit; - maintainers = with maintainers; [ mrkkrp aidalgol ]; + maintainers = with maintainers; [ + mrkkrp + aidalgol + ]; platforms = with platforms; all; }; } diff --git a/pkgs/shells/nushell/plugins/polars.nix b/pkgs/shells/nushell/plugins/polars.nix index d24fb5e88c8c..88c29e0ccbda 100644 --- a/pkgs/shells/nushell/plugins/polars.nix +++ b/pkgs/shells/nushell/plugins/polars.nix @@ -14,7 +14,7 @@ rustPlatform.buildRustPackage rec { pname = "nushell_plugin_polars"; inherit (nushell) version src; - cargoHash = "sha256-Ym/ypm3bUPZkKXYVrym9LEDL0RenJCcruN3urpN2cEQ="; + cargoHash = "sha256-agUuDPv8LJixj3cBrvhW8UdPLQHNVYpSlPGvioxZoDU="; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; buildInputs = diff --git a/pkgs/shells/nushell/plugins/query.nix b/pkgs/shells/nushell/plugins/query.nix index 34bf253a5590..c3440a7295de 100644 --- a/pkgs/shells/nushell/plugins/query.nix +++ b/pkgs/shells/nushell/plugins/query.nix @@ -1,24 +1,31 @@ -{ stdenv -, lib -, rustPlatform -, nushell -, IOKit -, CoreFoundation -, nix-update-script -, pkg-config -, openssl -, curl +{ + stdenv, + lib, + rustPlatform, + nushell, + IOKit, + CoreFoundation, + nix-update-script, + pkg-config, + openssl, + curl, }: rustPlatform.buildRustPackage { pname = "nushell_plugin_query"; inherit (nushell) version src; - cargoHash = "sha256-m5DYMvvNWfd86e7P7JI7KLlp7AjqtKO+n9jjORaW9ss="; + cargoHash = "sha256-ygzHnrQ3zO1+lxzRUFO1+0XocGBemJKoDa4oiCjCe+0="; - nativeBuildInputs = [ pkg-config ] - ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; - buildInputs = [ openssl curl ] - ++ lib.optionals stdenv.isDarwin [ IOKit CoreFoundation ]; + nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.cc.isClang [ rustPlatform.bindgenHook ]; + buildInputs = + [ + openssl + curl + ] + ++ lib.optionals stdenv.isDarwin [ + IOKit + CoreFoundation + ]; cargoBuildFlags = [ "--package nu_plugin_query" ]; checkPhase = '' @@ -35,7 +42,10 @@ rustPlatform.buildRustPackage { mainProgram = "nu_plugin_query"; homepage = "https://github.com/nushell/nushell/tree/${version}/crates/nu_plugin_query"; license = licenses.mit; - maintainers = with maintainers; [ happysalada aidalgol ]; + maintainers = with maintainers; [ + happysalada + aidalgol + ]; platforms = with platforms; all; }; } diff --git a/pkgs/shells/nushell/update.sh b/pkgs/shells/nushell/update.sh new file mode 100644 index 000000000000..9a8015e74600 --- /dev/null +++ b/pkgs/shells/nushell/update.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash +#!nix-shell -p git nix-update nixpkgs-review nixfmt-rfc-style + +set -euxo pipefail + +basedir="$(git rev-parse --show-toplevel)" +cd "$basedir" + +branch="update-nushell" +nuPath="pkgs/shells/nushell" + +function staged() { + if git status --porcelain | grep -q -E "^[AM].? +$1"; then + return 0 + else + return 1 + fi +} + +function version() { + grep '\s*version = ' "$nuPath/default.nix" | cut -d'"' -f 2 | head --lines 1 +} + +git checkout -B "$branch" + +version_old=$(version) +if ! staged "$nuPath/default.nix"; then + nix-update nushell + git add "$nuPath/default.nix" +fi +version_new=$(version) + +declare -a plugins=(formats query polars gstat) +for plugin in "${plugins[@]}"; do + attr="nushellPlugins.$plugin" + pluginPath="$nuPath/plugins/$plugin.nix" + + if staged "$pluginPath"; then + echo "Skipping '$plugin' because it's alredy staged" + continue + fi + + echo "Attempting to build $attr" + + set +e + newHash=$(nix build ".#$attr" 2> \ + >(grep got | + awk -F' ' '{ print $2 }')) + set -e + + # New hash ? + if [ -n "$newHash" ]; then + # Add the new hash + sed -i "s!cargoHash = ".*";!cargoHash = \"$newHash\";!" "$pluginPath" + nixfmt "$pluginPath" + + echo "Building $plugin again with new hash $newHash" + nix build ".#$attr" + git add "$pluginPath" + echo "Plugin $plugin built sucessfully" + else + echo "No new hash for '$plugin'" + fi +done + +git commit -m "nushell: $version_old -> $version_new" + +echo "Starting nixpkgs-review" +nixpkgs-review rev "$branch"