1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 21:01:16 +02:00

nix: Reserve shebang line syntax and only parse double backtick quotes

Being restrictive about syntax leaves opportunity to improve the
syntax and functionality later.
This commit is contained in:
Robert Hensing 2023-05-12 19:46:37 +02:00 committed by tomberek
parent cc68ed8ff7
commit 20ff61ab25
6 changed files with 177 additions and 58 deletions

View file

@ -2,10 +2,13 @@
- The experimental nix command is now a `#!-interpreter` by appending the
contents of any `#! nix` lines and the script's location to a single call.
Verbatim strings may be passed in double backtick (```` `` ````) quotes.
Some examples:
```
#!/usr/bin/env nix
#! nix shell --file "<nixpkgs>" hello --command bash
#! nix shell --file ``<nixpkgs>`` hello --command bash
hello | cowsay
```
@ -19,8 +22,10 @@
or
```bash
#! /usr/bin/env nix
#! nix shell --impure --expr
#! nix "with (import (builtins.getFlake ''nixpkgs'') {}); terraform.withPlugins (plugins: [ plugins.openstack ])"
#! nix shell --impure --expr ``
#! nix with (import (builtins.getFlake "nixpkgs") {});
#! nix terraform.withPlugins (plugins: [ plugins.openstack ])
#! nix ``
#! nix --command bash
terraform "$@"