about summary refs log tree commit diff
path: root/pkgs/profpatsch/execline/write-execline.nix
blob: f83aa2ed7a855a14073e0bbb16864eece7b54e0c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{ pkgs }:
let
  escape = import ./escape.nix { inherit (pkgs) lib; };

  # Write a list of execline argv parameters to an execline script.
  # Everything is escaped correctly.
  # TODO upstream into nixpkgs
  writeExeclineCommon = writer: name: { readNArgs ? 0 }: argList: writer name ''
    #!${pkgs.execline}/bin/execlineb -Ws${toString readNArgs}
    ${escape.escapeExecline argList}
  '';
  writeExecline = writeExeclineCommon pkgs.writeScript;
  writeExeclineBin = writeExeclineCommon pkgs.writeScriptBin;

in {
  inherit writeExecline writeExeclineBin;
}