diff --git a/packages/pwsh/7.1.4/build.sh b/packages/pwsh/7.1.4/build.sh deleted file mode 100755 index 3f4b070..0000000 --- a/packages/pwsh/7.1.4/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.1.4/powershell-7.1.4-linux-x64.tar.gz -o powershell.tar.gz -tar zxf powershell.tar.gz -rm powershell.tar.gz - -chmod +x pwsh diff --git a/packages/pwsh/7.1.4/environment b/packages/pwsh/7.1.4/environment deleted file mode 100644 index 42644cd..0000000 --- a/packages/pwsh/7.1.4/environment +++ /dev/null @@ -1 +0,0 @@ -export PATH=$PWD:$PATH diff --git a/packages/pwsh/7.1.4/metadata.json b/packages/pwsh/7.1.4/metadata.json deleted file mode 100644 index da90f76..0000000 --- a/packages/pwsh/7.1.4/metadata.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "language": "pwsh", - "version": "7.1.4", - "provides": [ - { - "language": "powershell", - "aliases": ["ps", "pwsh", "ps1"] - } - ] -} diff --git a/packages/pwsh/7.1.4/run b/packages/pwsh/7.1.4/run deleted file mode 100644 index 02a0be7..0000000 --- a/packages/pwsh/7.1.4/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -pwsh "$@" diff --git a/packages/pwsh/7.1.4/test.ps1 b/packages/pwsh/7.1.4/test.ps1 deleted file mode 100644 index f0a4be3..0000000 --- a/packages/pwsh/7.1.4/test.ps1 +++ /dev/null @@ -1 +0,0 @@ -echo "OK" diff --git a/runtimes/default.nix b/runtimes/default.nix index cbefe12..a36c3fc 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -23,4 +23,5 @@ args: { "rscript" = import ./rscript.nix args; "raku" = import ./raku.nix args; "racket" = import ./racket.nix args; + "powershell" = import ./powershell.nix args; } diff --git a/runtimes/powershell.nix b/runtimes/powershell.nix new file mode 100644 index 0000000..4e72687 --- /dev/null +++ b/runtimes/powershell.nix @@ -0,0 +1,58 @@ +{pkgs, piston, ...}: +let + pkg = pkgs.powershell; +in piston.mkRuntime { + language = "powershell"; + version = pkg.version; + + aliases = [ + "pwsh" + "ps" + "ps1" + ]; + + run = '' + ${pkg}/bin/pwsh "$@" + ''; + + tests = [ + # test different file extension + (piston.mkTest { + files = { + "test.code" = '' + echo "OK" + ''; + }; + args = []; + stdin = ""; + packages = []; + main = "test.code"; + }) + # test argv + (piston.mkTest { + files = { + "test.pwsh" = '' + foreach ($s in $args) { + Write-Host $s + } + ''; + }; + args = ["OK"]; + stdin = ""; + packages = []; + main = "test.pwsh"; + }) + # test stdin + (piston.mkTest { + files = { + "test.pwsh" = '' + $s = Read-Host + ''; + }; + args = []; + stdin = "OK"; + packages = []; + main = "test.pwsh"; + }) + ]; +} \ No newline at end of file