at 18.09-beta 2.1 kB view raw
1{ stdenv, autoPatchelfHook, fetchzip, libunwind, libuuid, icu, curl, 2 makeWrapper, less, openssl, pam, lttng-ust }: 3 4let platformString = if stdenv.isDarwin then "osx" 5 else if stdenv.isLinux then "linux" 6 else throw "unsupported platform"; 7 platformSha = if stdenv.isDarwin then "01j92myljgphf68la9q753m5wgfmd0kwlsk441yic7qshcly5xkw" 8 else if stdenv.isLinux then "0al1mrlz3m5ksnq86mqm0axb8bjdxa05j2p5y9bmcykrgkdwi3vk" 9 else throw "unsupported platform"; 10 platformLdLibraryPath = if stdenv.isDarwin then "DYLD_FALLBACK_LIBRARY_PATH" 11 else if stdenv.isLinux then "LD_LIBRARY_PATH" 12 else throw "unsupported platform"; 13 libraries = [ libunwind libuuid icu curl openssl lttng-ust ] ++ (if stdenv.isLinux then [ pam ] else []); 14in 15stdenv.mkDerivation rec { 16 name = "powershell-${version}"; 17 version = "6.0.4"; 18 19 src = fetchzip { 20 url = "https://github.com/PowerShell/PowerShell/releases/download/v${version}/powershell-${version}-${platformString}-x64.tar.gz"; 21 sha256 = platformSha; 22 stripRoot = false; 23 }; 24 25 buildInputs = [ less ] ++ libraries; 26 nativeBuildInputs = [ autoPatchelfHook makeWrapper ]; 27 28 # TODO: remove PAGER after upgrading to v6.1.0-preview.1 or later as it has been addressed in 29 # https://github.com/PowerShell/PowerShell/pull/6144 30 installPhase = '' 31 mkdir -p $out/bin 32 mkdir -p $out/share/powershell 33 cp -r * $out/share/powershell 34 rm $out/share/powershell/DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY 35 makeWrapper $out/share/powershell/pwsh $out/bin/pwsh --prefix ${platformLdLibraryPath} : "${stdenv.lib.makeLibraryPath libraries}" \ 36 --set PAGER ${less}/bin/less --set TERM xterm 37 ''; 38 39 dontStrip = true; 40 41 meta = with stdenv.lib; { 42 description = "Cross-platform (Windows, Linux, and macOS) automation and configuration tool/framework"; 43 homepage = https://github.com/PowerShell/PowerShell; 44 maintainers = [ maintainers.yrashk ]; 45 platforms = platforms.unix; 46 license = with licenses; [ mit ]; 47 }; 48 49}