summary refs log tree commit diff
path: root/pkgs/shells/powershell
diff options
context:
space:
mode:
authorYurii Rashkovskii <yrashk@gmail.com>2018-05-29 18:08:50 -0700
committerYurii Rashkovskii <yrashk@gmail.com>2018-06-04 15:12:11 -0700
commit7e6d315a89f20d73a2cf151f248e34b3b8adcc5b (patch)
tree50474f0aae62b2f3be0167ac0cfa7dfa32d3d73a /pkgs/shells/powershell
parent41bb69fa88c0c9bb86b34f17f36284c92348ca23 (diff)
downloadnixpkgs-7e6d315a89f20d73a2cf151f248e34b3b8adcc5b.tar
nixpkgs-7e6d315a89f20d73a2cf151f248e34b3b8adcc5b.tar.gz
nixpkgs-7e6d315a89f20d73a2cf151f248e34b3b8adcc5b.tar.bz2
nixpkgs-7e6d315a89f20d73a2cf151f248e34b3b8adcc5b.tar.lz
nixpkgs-7e6d315a89f20d73a2cf151f248e34b3b8adcc5b.tar.xz
nixpkgs-7e6d315a89f20d73a2cf151f248e34b3b8adcc5b.tar.zst
nixpkgs-7e6d315a89f20d73a2cf151f248e34b3b8adcc5b.zip
PowerShell: init at 6.0.2
Diffstat (limited to 'pkgs/shells/powershell')
-rw-r--r--pkgs/shells/powershell/default.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/pkgs/shells/powershell/default.nix b/pkgs/shells/powershell/default.nix
new file mode 100644
index 00000000000..93749491611
--- /dev/null
+++ b/pkgs/shells/powershell/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchgit, autoPatchelfHook, fetchzip, libunwind, libuuid, icu, curl, cacert,
+  makeWrapper, less, openssl }:
+
+let platformString = if stdenv.isDarwin then "osx"
+                     else if stdenv.isLinux then "linux"
+                     else throw "unsupported platform";
+    platformSha = if stdenv.isDarwin then "1ga4p8xmrxa54v2s6i0q1q7lx2idcmp1jwm0g4jxr54fyn5ay3lf"
+                     else if stdenv.isLinux then "000mmv5iblnmwydfdvg5izli3vpb6l14xy4qy3smcikpf0h87fhl"
+                     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";
+in
+stdenv.mkDerivation rec {
+  name = "powershell-${version}";
+  version = "6.0.2";
+
+  src = fetchzip {
+    url = "https://github.com/PowerShell/PowerShell/releases/download/v${version}/powershell-${version}-${platformString}-x64.tar.gz";
+    sha256 = platformSha;
+    stripRoot = false;
+  };
+
+  buildInputs = [ autoPatchelfHook makeWrapper ];
+  propagatedBuildInputs = [ libunwind libuuid icu curl cacert less openssl ];
+
+  # 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
+    makeWrapper $out/share/powershell/pwsh $out/bin/pwsh --prefix ${platformLdLibraryPath} : "${stdenv.lib.makeLibraryPath [ libunwind libuuid icu openssl curl ]}" \
+                                           --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 ];
+  };
+
+}