about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2022-10-11 00:05:26 +0000
committerGitHub <noreply@github.com>2022-10-11 00:05:26 +0000
commit5d957f3dbadfebd9c86c1e996af2c6eee391f742 (patch)
treef9b5d8c4924207e79d1d19d50b6a60b04ab8a1cd /pkgs/build-support
parentf5fb6e575534508dbc3aff2c778956983e189d19 (diff)
parente3419ce322b50618ac728a62715168f3e5d37f9e (diff)
Merge staging-next into staging
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/writers/default.nix15
-rw-r--r--pkgs/build-support/writers/test.nix12
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..167df5635c919 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 --no-config";
+    check = "${pkgs.fish}/bin/fish --no-config --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