diff --git a/pkgs/shells/powershell/default.nix b/pkgs/shells/powershell/default.nix index ec0e36738329..2f7bc15c1b3c 100644 --- a/pkgs/shells/powershell/default.nix +++ b/pkgs/shells/powershell/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, autoPatchelfHook, fetchzip, libunwind, libuuid, icu, curl +{ stdenv, lib, autoPatchelfHook, fetchurl, libunwind, libuuid, icu, curl , darwin, makeWrapper, less, openssl, pam, lttng-ust }: let archString = if stdenv.isAarch64 then "arm64" @@ -7,11 +7,12 @@ let archString = if stdenv.isAarch64 then "arm64" 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-JKB7Oy+3KWtVo1Aqmc7vZiO88FrF9+8N/tdGlvIQolM=" - else if (stdenv.isDarwin && stdenv.isAarch64) then "sha256-9UwB1tT2VaW+favw/KWPziFMSRWcw7AqeeZvbaGOBqc=" - else if (stdenv.isLinux && stdenv.isx86_64) then "sha256-kAcT9av4PFZfYqpS0XwKC0IiquUcVtN30Mq649PUnSM=" - else if (stdenv.isLinux && stdenv.isAarch64) then "sha256-3Lm9WYVcfkEVfji/h52VqFy1Jo1AiSQ22JhEGiCPzzM=" - else throw "unsupported platform"; + platformHash = { + x86_64-darwin = "sha256-FX3OyVzwU+Ms2tgjpZ4dPdjeJx2H5541dQZAjhI3n1U="; + aarch64-darwin = "sha256-Dg7FRF5inRnzP6tjDhIgHTJ1J2EQXnegqimZPK574WQ="; + x86_64-linux = "sha256-6F1VROE6kk+LLEpdwtQ6vkbkZjP4no0TjTnAqurLmXY="; + aarch64-linux = "sha256-NO4E2TOUIYyUFJmi3zKJzOyP0/rTPTZgJZcebVNkSfk="; + }.${stdenv.hostPlatform.system} or (throw "unsupported platform"); platformLdLibraryPath = if stdenv.isDarwin then "DYLD_FALLBACK_LIBRARY_PATH" else if stdenv.isLinux then "LD_LIBRARY_PATH" else throw "unsupported platform"; @@ -20,14 +21,15 @@ let archString = if stdenv.isAarch64 then "arm64" in stdenv.mkDerivation rec { pname = "powershell"; - version = "7.3.2"; + version = "7.3.4"; - src = fetchzip { + src = fetchurl { url = "https://github.com/PowerShell/PowerShell/releases/download/v${version}/powershell-${version}-${platformString}-${archString}.tar.gz"; - sha256 = platformSha; - stripRoot = false; + hash = platformHash; }; + sourceRoot = "."; + strictDeps = true; buildInputs = [ less ] ++ libraries; nativeBuildInputs = [ makeWrapper ] diff --git a/pkgs/shells/powershell/getHashes.sh b/pkgs/shells/powershell/getHashes.sh index 727eabb3de89..785ab264ebcc 100755 --- a/pkgs/shells/powershell/getHashes.sh +++ b/pkgs/shells/powershell/getHashes.sh @@ -1,5 +1,5 @@ #!/usr/bin/env nix-shell -#!nix-shell -i bash -p bash wget coreutils gnutar nix +#!nix-shell -i bash -p bash wget coreutils nix version=$1 if [[ -z $version ]] @@ -11,9 +11,8 @@ fi allOutput="" dlDest=$(mktemp) -exDest=$(mktemp -d) -trap 'rm $dlDest; rm -r $exDest' EXIT +trap 'rm $dlDest' EXIT for plat in osx linux; do for arch in x64 arm64; do @@ -21,18 +20,13 @@ for plat in osx linux; do URL="https://github.com/PowerShell/PowerShell/releases/download/v$version/powershell-$version-$plat-$arch.tar.gz" wget $URL -O $dlDest >&2 - tar -xzf $dlDest -C $exDest >&2 - - hash=$(nix hash path $exDest) + hash=$(nix hash file $dlDest) allOutput+=" variant: $plat $arch hash: $hash " - rm -r $exDest - mkdir $exDest - done done