diff options
author | Valentin Gagarin <valentin.gagarin@tweag.io> | 2024-01-15 22:34:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-15 22:34:40 +0100 |
commit | 2392daed231374d0d1c857cd7a75edd89e084513 (patch) | |
tree | db33fb8ed48299678d2ef66537a0aef82d95c1d7 /pkgs/build-support | |
parent | 0eed8836c5a68fa5e9dd048830580e825661fdda (diff) | |
parent | b22ec91243c1d0bd645990d4f25869ecd1c0ca6c (diff) | |
download | nixlib-2392daed231374d0d1c857cd7a75edd89e084513.tar nixlib-2392daed231374d0d1c857cd7a75edd89e084513.tar.gz nixlib-2392daed231374d0d1c857cd7a75edd89e084513.tar.bz2 nixlib-2392daed231374d0d1c857cd7a75edd89e084513.tar.lz nixlib-2392daed231374d0d1c857cd7a75edd89e084513.tar.xz nixlib-2392daed231374d0d1c857cd7a75edd89e084513.tar.zst nixlib-2392daed231374d0d1c857cd7a75edd89e084513.zip |
Merge pull request #277534 from mcdonc/doc-trivial-builders-writetext
* doc: improve documentation for trivial text writing functions Co-authored-by: Brian Merchant <bzm3r@proton.me> Co-authored-by: Robert Hensing <robert@roberthensing.nl> Co-authored-by: Alexander Groleau <alex@proof.construction> Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/trivial-builders/default.nix | 107 |
1 files changed, 12 insertions, 95 deletions
diff --git a/pkgs/build-support/trivial-builders/default.nix b/pkgs/build-support/trivial-builders/default.nix index 07447b6461bc..a2bd29fecaf9 100644 --- a/pkgs/build-support/trivial-builders/default.nix +++ b/pkgs/build-support/trivial-builders/default.nix @@ -182,101 +182,32 @@ rec { eval "$checkPhase" ''; - /* - Writes a text file to nix store with no optional parameters available. - - Example: - - - # Writes contents of file to /nix/store/<store path> - writeText "my-file" - '' - Contents of File - ''; - - - */ + # See doc/build-helpers/trivial-build-helpers.chapter.md + # or https://nixos.org/manual/nixpkgs/unstable/#trivial-builder-text-writing writeText = name: text: writeTextFile { inherit name text; }; - /* - Writes a text file to nix store in a specific directory with no - optional parameters available. - - Example: - - - # Writes contents of file to /nix/store/<store path>/share/my-file - writeTextDir "share/my-file" - '' - Contents of File - ''; - - - */ + # See doc/build-helpers/trivial-build-helpers.chapter.md + # or https://nixos.org/manual/nixpkgs/unstable/#trivial-builder-text-writing writeTextDir = path: text: writeTextFile { inherit text; name = builtins.baseNameOf path; destination = "/${path}"; }; - /* - Writes a text file to /nix/store/<store path> and marks the file as - executable. - - If passed as a build input, will be used as a setup hook. This makes setup - hooks more efficient to create: you don't need a derivation that copies - them to $out/nix-support/setup-hook, instead you can use the file as is. - - Example: - - - # Writes my-file to /nix/store/<store path> and makes executable - writeScript "my-file" - '' - Contents of File - ''; - - - */ + # See doc/build-helpers/trivial-build-helpers.chapter.md + # or https://nixos.org/manual/nixpkgs/unstable/#trivial-builder-text-writing writeScript = name: text: writeTextFile { inherit name text; executable = true; }; - /* - Writes a text file to /nix/store/<store path>/bin/<name> and - marks the file as executable. - - Example: - - - - # Writes my-file to /nix/store/<store path>/bin/my-file and makes executable. - writeScriptBin "my-file" - '' - Contents of File - ''; - - - */ + # See doc/build-helpers/trivial-build-helpers.chapter.md + # or https://nixos.org/manual/nixpkgs/unstable/#trivial-builder-text-writing writeScriptBin = name: text: writeTextFile { inherit name text; executable = true; destination = "/bin/${name}"; }; - /* - Similar to writeScript. Writes a Shell script and checks its syntax. - Automatically includes interpreter above the contents passed. - - Example: - - - # Writes my-file to /nix/store/<store path> and makes executable. - writeShellScript "my-file" - '' - Contents of File - ''; - - - */ + # See doc/build-helpers/trivial-build-helpers.chapter.md + # or https://nixos.org/manual/nixpkgs/unstable/#trivial-builder-text-writing writeShellScript = name: text: writeTextFile { inherit name; @@ -290,22 +221,8 @@ rec { ''; }; - /* - Similar to writeShellScript and writeScriptBin. - Writes an executable Shell script to /nix/store/<store path>/bin/<name> and checks its syntax. - Automatically includes interpreter above the contents passed. - - Example: - - - # Writes my-file to /nix/store/<store path>/bin/my-file and makes executable. - writeShellScriptBin "my-file" - '' - Contents of File - ''; - - - */ + # See doc/build-helpers/trivial-build-helpers.chapter.md + # or https://nixos.org/manual/nixpkgs/unstable/#trivial-builder-text-writing writeShellScriptBin = name: text: writeTextFile { inherit name; |