Shell scripts/zh: Difference between revisions
Created page with "除了使用 <code>stdenv.mkDerivation</code> 之外,还可以通过 <code>runCommand</code> 来调用外部的 Bash 脚本:" Tags: Mobile edit Mobile web edit |
Created page with "函数 <code>writeShellScript</code> 可用于向 Nix 表达式中添加 Shell 脚本。" Tags: Mobile edit Mobile web edit |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<languages/> | <languages/> | ||
函数 <code>writeShellScript</code> 可用于向 Nix 表达式中添加 Shell 脚本。 | |||
<syntaxHighlight lang="nix"> | <syntaxHighlight lang="nix"> | ||
| Line 20: | Line 18: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
< | <span id="External_builder.sh_script"></span> | ||
== | == 外部 builder.sh 脚本 == | ||
较长的 Bash 脚本通常会保存为外部脚本文件,并在 Nix 中调用: | |||
{{file|default.nix|nix|3= | {{file|default.nix|nix|3= | ||
| Line 49: | Line 44: | ||
}} | }} | ||
另见: | |||
* [https://github.com/NixOS/nixpkgs/issues/23099 创造一个无源 derivation] | |||
* [https://github.com/NixOS/nixpkgs/issues/23099 | * [https://nixos.org/guides/nix-pills/working-derivation.html Nix Pills: 第 7 章. 制作 Derivation] | ||
* [https://nixos.org/guides/nix-pills/working-derivation.html Nix Pills: | |||
=== runCommand + builder.sh === | === runCommand + builder.sh === | ||
除了使用 <code>stdenv.mkDerivation</code> 之外,还可以通过 <code>runCommand</code> 来调用外部的 Bash 脚本: | 除了使用 <code>stdenv.mkDerivation</code> 之外,还可以通过 <code>runCommand</code> 来调用外部的 Bash 脚本: | ||