Skip to content

Commit

Permalink
shebang scripts: clarify explanation of parameters using formatting
Browse files Browse the repository at this point in the history
Prompted by #1096

It may not be immediately obvious that the paragraphs following the code sample explain the invocation parameters. Making them a list should let that part stand out enough to slow down reading a bit.
  • Loading branch information
fricklerhandwerk authored Jan 17, 2025
1 parent 882ee18 commit 2740637
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions source/tutorials/first-steps/reproducible-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,24 @@ curl https://github.com/NixOS/nixpkgs/releases.atom | xml2json | jq .
```

The first line is a standard shebang.
The additional shebang lines are a Nix-specific construct.
The additional shebang lines are a Nix-specific construct:

We specify `bash` as the interpreter for the rest of the file with the `-i` option.
- With the `-i` option, `bash` is specified as the interpreter for the rest of the file.

We enable the `--pure` option to prevent the script from implicitly using programs that may already exist on the system that will run the script.
- In this case, the `--pure` option is enabled to prevent the script from implicitly using programs that may already exist on the system on which the script is run.

With the `-p` option we specify the packages required for the script to run.
The command `xml2json` is provided by the package `python3Packages.xmljson`, while `bash`, `jq`, and `curl` are provided by packages of the same name.
- The `-p` option lists the packages required for the script to run.

The command `xml2json` is provided by the package `python3Packages.xmljson`, while `bash`, `jq`, and `curl` are provided by packages of the same name.
`cacert` must be present for SSL authentication to work.

:::{tip}
Use [search.nixos.org](https://search.nixos.org/packages) to find packages providing the program you need.
:::
:::{tip}
Use [search.nixos.org](https://search.nixos.org/packages) to find packages providing the program you need.
:::

- The parameter of `-I` refers to a specific Git commit of the Nixpkgs repository.

The parameter of `-I` refers to a specific Git commit of the Nixpkgs repository.
This ensures that the script will always run with the exact same packages versions, everywhere.
This ensures that the script will always run with the exact same packages versions, everywhere.

Make the script executable:

Expand Down

0 comments on commit 2740637

Please sign in to comment.