summaryrefslogtreecommitdiff
path: root/pkgs/echoargs/default.nix
blob: a74b716794f0d89195e25b1b104560dbae6b94f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
  writeTextFile,
  python3,
  lib,
}:
writeTextFile {
  name = "echoargs";

  text = ''
    #!${python3.interpreter}

    import sys
    import json

    for i, arg in enumerate(sys.argv):
        print(f"argv[%d] = %s" % (i, json.dumps(arg)))
  '';
  executable = true;
  destination = "/bin/echoargs";

  meta = with lib; {
    description = "Prints command-line arguments for debugging";
    mainProgram = "echoargs";
  };
}