mirror of
https://github.com/NixOS/nix.git
synced 2024-11-25 08:12:29 +00:00
6d6c68c0d2
single quotes. Example (from NixOS): job = '' start on network-interfaces start script rm -f /var/run/opengl-driver ${if videoDriver == "nvidia" then "ln -sf ${nvidiaDrivers} /var/run/opengl-driver" else if cfg.driSupport then "ln -sf ${mesa} /var/run/opengl-driver" else "" } rm -f /var/log/slim.log end script ''; This style has two big advantages: - \, ' and " aren't special, only '' and ${. So you get a lot less escaping in shell scripts / configuration files in Nixpkgs/NixOS. The delimiter '' is rare in scripts (and can usually be written as ""). ${ is also fairly rare. Other delimiters such as <<...>>, {{...}} and <|...|> were also considered but this one appears to have the fewest drawbacks (thanks Martin). - Indentation is intelligently stripped so that multi-line strings can follow the nesting structure of the containing Nix expression. E.g. in the example above 6 spaces are stripped from the start of each line. This prevents unnecessary indentation in generated files (which sometimes even breaks things). See tests/lang/eval-okay-ind-string.nix for some examples. |
||
---|---|---|
.. | ||
lang | ||
add.sh | ||
build-hook.hook.sh | ||
build-hook.nix.in | ||
build-hook.sh | ||
check-refs.nix.in | ||
check-refs.sh | ||
common.sh.in | ||
dependencies.builder0.sh | ||
dependencies.builder1.sh | ||
dependencies.builder2.sh | ||
dependencies.nix.in | ||
dependencies.sh | ||
dummy | ||
fallback.sh | ||
filter-source.nix.in | ||
filter-source.sh | ||
fixed.builder1.sh | ||
fixed.builder2.sh | ||
fixed.nix.in | ||
fixed.sh | ||
gc-concurrent2.builder.sh | ||
gc-concurrent2.nix.in | ||
gc-concurrent.builder.sh | ||
gc-concurrent.nix.in | ||
gc-concurrent.sh | ||
gc-runtime.nix.in | ||
gc-runtime.sh | ||
gc.sh | ||
hash-check.nix | ||
hash.sh | ||
init.sh | ||
install-package.sh | ||
lang.sh | ||
locking.builder.sh | ||
locking.nix.in | ||
locking.sh | ||
logging.sh | ||
Makefile.am | ||
misc.sh | ||
nix-build.sh | ||
nix-pull.sh | ||
nix-push.sh | ||
parallel.builder.sh | ||
parallel.nix.in | ||
parallel.sh | ||
referrers.sh | ||
remote-store.sh | ||
simple.builder.sh | ||
simple.nix.in | ||
simple.sh | ||
substituter2.sh | ||
substituter.sh | ||
substitutes2.sh | ||
substitutes.sh | ||
user-envs.builder.sh | ||
user-envs.nix.in | ||
user-envs.sh | ||
verify.sh |