2018-07-21 02:44:44 +02:00
|
|
|
{ stdenv, autoPatchelfHook, fetchzip, libunwind, libuuid, icu, curl,
|
2018-06-13 03:00:30 +02:00
|
|
|
makeWrapper, less, openssl, pam, lttng-ust }:
|
2018-05-30 03:08:50 +02:00
|
|
|
|
|
|
|
let platformString = if stdenv.isDarwin then "osx"
|
|
|
|
else if stdenv.isLinux then "linux"
|
|
|
|
else throw "unsupported platform";
|
|
|
|
platformSha = if stdenv.isDarwin then "1ga4p8xmrxa54v2s6i0q1q7lx2idcmp1jwm0g4jxr54fyn5ay3lf"
|
2018-07-21 21:23:19 +02:00
|
|
|
else if stdenv.isLinux then "1bv1yjk3rm1czibqagmh719m4r1x8j8bmh3nw40x7izm2sx0qg7v"
|
2018-05-30 03:08:50 +02:00
|
|
|
else throw "unsupported platform";
|
|
|
|
platformLdLibraryPath = if stdenv.isDarwin then "DYLD_FALLBACK_LIBRARY_PATH"
|
|
|
|
else if stdenv.isLinux then "LD_LIBRARY_PATH"
|
|
|
|
else throw "unsupported platform";
|
2018-06-13 03:00:30 +02:00
|
|
|
libraries = [ libunwind libuuid icu curl openssl lttng-ust ] ++ (if stdenv.isLinux then [ pam ] else []);
|
2018-05-30 03:08:50 +02:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "powershell-${version}";
|
2018-07-21 21:23:19 +02:00
|
|
|
version = "6.0.3";
|
2018-05-30 03:08:50 +02:00
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://github.com/PowerShell/PowerShell/releases/download/v${version}/powershell-${version}-${platformString}-x64.tar.gz";
|
|
|
|
sha256 = platformSha;
|
|
|
|
stripRoot = false;
|
|
|
|
};
|
|
|
|
|
2018-06-14 00:08:46 +02:00
|
|
|
buildInputs = [ less ] ++ libraries;
|
|
|
|
nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
|
2018-05-30 03:08:50 +02:00
|
|
|
|
|
|
|
# TODO: remove PAGER after upgrading to v6.1.0-preview.1 or later as it has been addressed in
|
|
|
|
# https://github.com/PowerShell/PowerShell/pull/6144
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
mkdir -p $out/share/powershell
|
|
|
|
cp -r * $out/share/powershell
|
|
|
|
rm $out/share/powershell/DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY
|
2018-06-13 03:00:30 +02:00
|
|
|
makeWrapper $out/share/powershell/pwsh $out/bin/pwsh --prefix ${platformLdLibraryPath} : "${stdenv.lib.makeLibraryPath libraries}" \
|
2018-05-30 03:08:50 +02:00
|
|
|
--set PAGER ${less}/bin/less --set TERM xterm
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Cross-platform (Windows, Linux, and macOS) automation and configuration tool/framework";
|
|
|
|
homepage = https://github.com/PowerShell/PowerShell;
|
|
|
|
maintainers = [ maintainers.yrashk ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
license = with licenses; [ mit ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|