diff options
author | pacien <pacien.trangirard@pacien.net> | 2022-10-10 15:58:42 +0200 |
---|---|---|
committer | pacien <pacien.trangirard@pacien.net> | 2022-10-10 15:59:23 +0200 |
commit | 6e4a14b54f3f62e078f999bf746ebfa2020890f8 (patch) | |
tree | 7e0a16e09bc67777c5556c5dc8b3f6e0b0f2232d /pkgs/build-support/writers | |
parent | abf0c51335f4444b544c9448371a00720c8e2ca7 (diff) |
writers: add writeFish and writeFishBin
This adds writers for Fish shell scripts, with syntax checking.
Diffstat (limited to 'pkgs/build-support/writers')
-rw-r--r-- | pkgs/build-support/writers/default.nix | 15 | ||||
-rw-r--r-- | pkgs/build-support/writers/test.nix | 12 |
2 files changed, 27 insertions, 0 deletions
diff --git a/pkgs/build-support/writers/default.nix b/pkgs/build-support/writers/default.nix index 9fbc571daab40..fd22c0c4b0306 100644 --- a/pkgs/build-support/writers/default.nix +++ b/pkgs/build-support/writers/default.nix @@ -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. # diff --git a/pkgs/build-support/writers/test.nix b/pkgs/build-support/writers/test.nix index d2e5cef83aad4..561c3e4ab0021 100644 --- a/pkgs/build-support/writers/test.nix +++ b/pkgs/build-support/writers/test.nix @@ -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 |