diff --git a/pkgs/build-support/writers/default.nix b/pkgs/build-support/writers/default.nix index 9fbc571daab4..fd22c0c4b030 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 d2e5cef83aad..561c3e4ab002 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