Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-19.03 47 lines 2.0 kB view raw
1{ stdenv, autoPatchelfHook, fetchzip, libunwind, libuuid, icu, curl 2, darwin, 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 "1zm5q25ny2x6wvdqfrc380467zq0nbrzh2rzldwdkdpkb6wbvpj8" 8 else if stdenv.isLinux then "021ag632jcn7f1vpddann04xifgsq3wrx93hzbvq7cngg8y16r3y" 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 ] ++ 14 (if stdenv.isLinux then [ pam lttng-ust ] else [ darwin.Libsystem ]); 15in 16stdenv.mkDerivation rec { 17 name = "powershell-${version}"; 18 version = "6.1.2"; 19 20 src = fetchzip { 21 url = "https://github.com/PowerShell/PowerShell/releases/download/v${version}/powershell-${version}-${platformString}-x64.tar.gz"; 22 sha256 = platformSha; 23 stripRoot = false; 24 }; 25 26 buildInputs = [ less ] ++ libraries; 27 nativeBuildInputs = [ autoPatchelfHook makeWrapper ]; 28 29 installPhase = '' 30 mkdir -p $out/bin 31 mkdir -p $out/share/powershell 32 cp -r * $out/share/powershell 33 makeWrapper $out/share/powershell/pwsh $out/bin/pwsh --prefix ${platformLdLibraryPath} : "${stdenv.lib.makeLibraryPath libraries}" \ 34 --set TERM xterm --set POWERSHELL_TELEMETRY_OPTOUT 1 35 ''; 36 37 dontStrip = true; 38 39 meta = with stdenv.lib; { 40 description = "Cross-platform (Windows, Linux, and macOS) automation and configuration tool/framework"; 41 homepage = https://github.com/PowerShell/PowerShell; 42 maintainers = [ maintainers.yrashk ]; 43 platforms = platforms.unix; 44 license = with licenses; [ mit ]; 45 }; 46 47}