migrate powershell to nix
This commit is contained in:
parent
f16eb5fa42
commit
f35d3f910f
|
@ -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
|
|
@ -1 +0,0 @@
|
|||
export PATH=$PWD:$PATH
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"language": "pwsh",
|
||||
"version": "7.1.4",
|
||||
"provides": [
|
||||
{
|
||||
"language": "powershell",
|
||||
"aliases": ["ps", "pwsh", "ps1"]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
pwsh "$@"
|
|
@ -1 +0,0 @@
|
|||
echo "OK"
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
})
|
||||
];
|
||||
}
|
Loading…
Reference in New Issue