writers: add writeFish and writeFishBin

This adds writers for Fish shell scripts, with syntax checking.
This commit is contained in:
pacien 2022-10-10 15:58:42 +02:00
parent abf0c51335
commit 6e4a14b54f
2 changed files with 27 additions and 0 deletions

View File

@ -119,6 +119,21 @@ let
writeDashBin = name:
writeDash "/bin/${name}";
# Like writeScript but the first line is a shebang to fish
#
# Example:
# writeFish "example" ''
# echo hello world
# ''
writeFish = makeScriptWriter {
interpreter = "${pkgs.fish}/bin/fish";
check = "${pkgs.fish}/bin/fish --no-execute"; # syntax check only
};
# Like writeScriptBin but the first line is a shebang to fish
writeFishBin = name:
writeFish "/bin/${name}";
# writeHaskell takes a name, an attrset with libraries and haskell version (both optional)
# and some haskell source code and returns an executable.
#

View File

@ -22,6 +22,12 @@ let
test '~' = '~' && echo 'success'
'';
fish = writeFishBin "test-writers-fish-bin" ''
if test "test" = "test"
echo "success"
end
'';
rust = writeRustBin "test-writers-rust-bin" {} ''
fn main(){
println!("success")
@ -94,6 +100,12 @@ let
test '~' = '~' && echo 'success'
'';
fish = writeFish "test-writers-fish" ''
if test "test" = "test"
echo "success"
end
'';
haskell = writeHaskell "test-writers-haskell" { libraries = [ haskellPackages.acme-default ]; } ''
import Data.Default