summary refs log tree commit diff
path: root/doc/builders/special
diff options
context:
space:
mode:
authorYueh-Shun Li <shamrocklee@posteo.net>2023-06-03 19:05:54 +0000
committerYueh-Shun Li <shamrocklee@posteo.net>2023-11-07 19:58:53 +0000
commit9963ad5c5fbbe55fb310e9477cab2fa685afaac2 (patch)
treedf313f78c6f9a130173f87df4603693686dbcb1e /doc/builders/special
parent70f21a213651a0f4149bea10721fea04485c8a80 (diff)
downloadnixpkgs-9963ad5c5fbbe55fb310e9477cab2fa685afaac2.tar
nixpkgs-9963ad5c5fbbe55fb310e9477cab2fa685afaac2.tar.gz
nixpkgs-9963ad5c5fbbe55fb310e9477cab2fa685afaac2.tar.bz2
nixpkgs-9963ad5c5fbbe55fb310e9477cab2fa685afaac2.tar.lz
nixpkgs-9963ad5c5fbbe55fb310e9477cab2fa685afaac2.tar.xz
nixpkgs-9963ad5c5fbbe55fb310e9477cab2fa685afaac2.tar.zst
nixpkgs-9963ad5c5fbbe55fb310e9477cab2fa685afaac2.zip
doc: builders -> build helpers to reduce ambigualty
Diffstat (limited to 'doc/builders/special')
-rw-r--r--doc/builders/special/fhs-environments.section.md56
-rw-r--r--doc/builders/special/makesetuphook.section.md37
-rw-r--r--doc/builders/special/mkshell.section.md37
-rw-r--r--doc/builders/special/vm-tools.section.md148
4 files changed, 0 insertions, 278 deletions
diff --git a/doc/builders/special/fhs-environments.section.md b/doc/builders/special/fhs-environments.section.md
deleted file mode 100644
index 8145fbd730f..00000000000
--- a/doc/builders/special/fhs-environments.section.md
+++ /dev/null
@@ -1,56 +0,0 @@
-# buildFHSEnv {#sec-fhs-environments}
-
-`buildFHSEnv` provides a way to build and run FHS-compatible lightweight sandboxes. It creates an isolated root filesystem with the host's `/nix/store`, so its footprint in terms of disk space is quite small. This allows you to run software which is hard or unfeasible to patch for NixOS; 3rd-party source trees with FHS assumptions, games distributed as tarballs, software with integrity checking and/or external self-updated binaries for instance.
-It uses Linux' namespaces feature to create temporary lightweight environments which are destroyed after all child processes exit, without requiring elevated privileges. It works similar to containerisation technology such as Docker or FlatPak but provides no security-relevant separation from the host system.
-
-Accepted arguments are:
-
-- `name`
-        The name of the environment and the wrapper executable.
-- `targetPkgs`
-        Packages to be installed for the main host's architecture (i.e. x86_64 on x86_64 installations). Along with libraries binaries are also installed.
-- `multiPkgs`
-        Packages to be installed for all architectures supported by a host (i.e. i686 and x86_64 on x86_64 installations). Only libraries are installed by default.
-- `multiArch`
-        Whether to install 32bit multiPkgs into the FHSEnv in 64bit environments
-- `extraBuildCommands`
-        Additional commands to be executed for finalizing the directory structure.
-- `extraBuildCommandsMulti`
-        Like `extraBuildCommands`, but executed only on multilib architectures.
-- `extraOutputsToInstall`
-        Additional derivation outputs to be linked for both target and multi-architecture packages.
-- `extraInstallCommands`
-        Additional commands to be executed for finalizing the derivation with runner script.
-- `runScript`
-        A shell command to be executed inside the sandbox. It defaults to `bash`. Command line arguments passed to the resulting wrapper are appended to this command by default.
-        This command must be escaped; i.e. `"foo app" --do-stuff --with "some file"`. See `lib.escapeShellArgs`.
-- `profile`
-        Optional script for `/etc/profile` within the sandbox.
-
-You can create a simple environment using a `shell.nix` like this:
-
-```nix
-{ pkgs ? import <nixpkgs> {} }:
-
-(pkgs.buildFHSEnv {
-  name = "simple-x11-env";
-  targetPkgs = pkgs: (with pkgs; [
-    udev
-    alsa-lib
-  ]) ++ (with pkgs.xorg; [
-    libX11
-    libXcursor
-    libXrandr
-  ]);
-  multiPkgs = pkgs: (with pkgs; [
-    udev
-    alsa-lib
-  ]);
-  runScript = "bash";
-}).env
-```
-
-Running `nix-shell` on it would drop you into a shell inside an FHS env where those libraries and binaries are available in FHS-compliant paths. Applications that expect an FHS structure (i.e. proprietary binaries) can run inside this environment without modification.
-You can build a wrapper by running your binary in `runScript`, e.g. `./bin/start.sh`. Relative paths work as expected.
-
-Additionally, the FHS builder links all relocated gsettings-schemas (the glib setup-hook moves them to `share/gsettings-schemas/${name}/glib-2.0/schemas`) to their standard FHS location. This means you don't need to wrap binaries with `wrapGAppsHook`.
diff --git a/doc/builders/special/makesetuphook.section.md b/doc/builders/special/makesetuphook.section.md
deleted file mode 100644
index eb042412137..00000000000
--- a/doc/builders/special/makesetuphook.section.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# pkgs.makeSetupHook {#sec-pkgs.makeSetupHook}
-
-`pkgs.makeSetupHook` is a builder that produces hooks that go in to `nativeBuildInputs`
-
-## Usage {#sec-pkgs.makeSetupHook-usage}
-
-```nix
-pkgs.makeSetupHook {
-  name = "something-hook";
-  propagatedBuildInputs = [ pkgs.commandsomething ];
-  depsTargetTargetPropagated = [ pkgs.libsomething ];
-} ./script.sh
-```
-
-### setup hook that depends on the hello package and runs hello and @shell@ is substituted with path to bash {#sec-pkgs.makeSetupHook-usage-example}
-
-```nix
-pkgs.makeSetupHook {
-    name = "run-hello-hook";
-    propagatedBuildInputs = [ pkgs.hello ];
-    substitutions = { shell = "${pkgs.bash}/bin/bash"; };
-    passthru.tests.greeting = callPackage ./test { };
-    meta.platforms = lib.platforms.linux;
-} (writeScript "run-hello-hook.sh" ''
-    #!@shell@
-    hello
-'')
-```
-
-## Attributes {#sec-pkgs.makeSetupHook-attributes}
-
-* `name` Set the name of the hook.
-* `propagatedBuildInputs` Runtime dependencies (such as binaries) of the hook.
-* `depsTargetTargetPropagated` Non-binary dependencies.
-* `meta`
-* `passthru`
-* `substitutions` Variables for `substituteAll`
diff --git a/doc/builders/special/mkshell.section.md b/doc/builders/special/mkshell.section.md
deleted file mode 100644
index 96d43535955..00000000000
--- a/doc/builders/special/mkshell.section.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# pkgs.mkShell {#sec-pkgs-mkShell}
-
-`pkgs.mkShell` is a specialized `stdenv.mkDerivation` that removes some
-repetition when using it with `nix-shell` (or `nix develop`).
-
-## Usage {#sec-pkgs-mkShell-usage}
-
-Here is a common usage example:
-
-```nix
-{ pkgs ? import <nixpkgs> {} }:
-pkgs.mkShell {
-  packages = [ pkgs.gnumake ];
-
-  inputsFrom = [ pkgs.hello pkgs.gnutar ];
-
-  shellHook = ''
-    export DEBUG=1
-  '';
-}
-```
-
-## Attributes {#sec-pkgs-mkShell-attributes}
-
-* `name` (default: `nix-shell`). Set the name of the derivation.
-* `packages` (default: `[]`). Add executable packages to the `nix-shell` environment.
-* `inputsFrom` (default: `[]`). Add build dependencies of the listed derivations to the `nix-shell` environment.
-* `shellHook` (default: `""`). Bash statements that are executed by `nix-shell`.
-
-... all the attributes of `stdenv.mkDerivation`.
-
-## Building the shell {#sec-pkgs-mkShell-building}
-
-This derivation output will contain a text file that contains a reference to
-all the build inputs. This is useful in CI where we want to make sure that
-every derivation, and its dependencies, build properly. Or when creating a GC
-root so that the build dependencies don't get garbage-collected.
diff --git a/doc/builders/special/vm-tools.section.md b/doc/builders/special/vm-tools.section.md
deleted file mode 100644
index 8feab04902d..00000000000
--- a/doc/builders/special/vm-tools.section.md
+++ /dev/null
@@ -1,148 +0,0 @@
-# vmTools {#sec-vm-tools}
-
-A set of VM related utilities, that help in building some packages in more advanced scenarios.
-
-## `vmTools.createEmptyImage` {#vm-tools-createEmptyImage}
-
-A bash script fragment that produces a disk image at `destination`.
-
-### Attributes {#vm-tools-createEmptyImage-attributes}
-
-* `size`. The disk size, in MiB.
-* `fullName`. Name that will be written to `${destination}/nix-support/full-name`.
-* `destination` (optional, default `$out`). Where to write the image files.
-
-## `vmTools.runInLinuxVM` {#vm-tools-runInLinuxVM}
-
-Run a derivation in a Linux virtual machine (using Qemu/KVM).
-By default, there is no disk image; the root filesystem is a `tmpfs`, and the Nix store is shared with the host (via the [9P protocol](https://wiki.qemu.org/Documentation/9p#9p_Protocol)).
-Thus, any pure Nix derivation should run unmodified.
-
-If the build fails and Nix is run with the `-K/--keep-failed` option, a script `run-vm` will be left behind in the temporary build directory that allows you to boot into the VM and debug it interactively.
-
-### Attributes {#vm-tools-runInLinuxVM-attributes}
-
-* `preVM` (optional). Shell command to be evaluated *before* the VM is started (i.e., on the host).
-* `memSize` (optional, default `512`). The memory size of the VM in MiB.
-* `diskImage` (optional). A file system image to be attached to `/dev/sda`.
-  Note that currently we expect the image to contain a filesystem, not a full disk image with a partition table etc.
-
-### Examples {#vm-tools-runInLinuxVM-examples}
-
-Build the derivation hello inside a VM:
-```nix
-{ pkgs }: with pkgs; with vmTools;
-runInLinuxVM hello
-```
-
-Build inside a VM with extra memory:
-```nix
-{ pkgs }: with pkgs; with vmTools;
-runInLinuxVM (hello.overrideAttrs (_: { memSize = 1024; }))
-```
-
-Use VM with a disk image (implicitly sets `diskImage`, see [`vmTools.createEmptyImage`](#vm-tools-createEmptyImage)):
-```nix
-{ pkgs }: with pkgs; with vmTools;
-runInLinuxVM (hello.overrideAttrs (_: {
-  preVM = createEmptyImage {
-    size = 1024;
-    fullName = "vm-image";
-  };
-}))
-```
-
-## `vmTools.extractFs` {#vm-tools-extractFs}
-
-Takes a file, such as an ISO, and extracts its contents into the store.
-
-### Attributes {#vm-tools-extractFs-attributes}
-
-* `file`. Path to the file to be extracted.
-  Note that currently we expect the image to contain a filesystem, not a full disk image with a partition table etc.
-* `fs` (optional). Filesystem of the contents of the file.
-
-### Examples {#vm-tools-extractFs-examples}
-
-Extract the contents of an ISO file:
-```nix
-{ pkgs }: with pkgs; with vmTools;
-extractFs { file = ./image.iso; }
-```
-
-## `vmTools.extractMTDfs` {#vm-tools-extractMTDfs}
-
-Like [](#vm-tools-extractFs), but it makes use of a [Memory Technology Device (MTD)](https://en.wikipedia.org/wiki/Memory_Technology_Device).
-
-## `vmTools.runInLinuxImage` {#vm-tools-runInLinuxImage}
-
-Like [](#vm-tools-runInLinuxVM), but instead of using `stdenv` from the Nix store, run the build using the tools provided by `/bin`, `/usr/bin`, etc. from the specified filesystem image, which typically is a filesystem containing a [FHS](https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard)-based Linux distribution.
-
-## `vmTools.makeImageTestScript` {#vm-tools-makeImageTestScript}
-
-Generate a script that can be used to run an interactive session in the given image.
-
-### Examples {#vm-tools-makeImageTestScript-examples}
-
-Create a script for running a Fedora 27 VM:
-```nix
-{ pkgs }: with pkgs; with vmTools;
-makeImageTestScript diskImages.fedora27x86_64
-```
-
-Create a script for running an Ubuntu 20.04 VM:
-```nix
-{ pkgs }: with pkgs; with vmTools;
-makeImageTestScript diskImages.ubuntu2004x86_64
-```
-
-## `vmTools.diskImageFuns` {#vm-tools-diskImageFuns}
-
-A set of functions that build a predefined set of minimal Linux distributions images.
-
-### Images {#vm-tools-diskImageFuns-images}
-
-* Fedora
-  * `fedora26x86_64`
-  * `fedora27x86_64`
-* CentOS
-  * `centos6i386`
-  * `centos6x86_64`
-  * `centos7x86_64`
-* Ubuntu
-  * `ubuntu1404i386`
-  * `ubuntu1404x86_64`
-  * `ubuntu1604i386`
-  * `ubuntu1604x86_64`
-  * `ubuntu1804i386`
-  * `ubuntu1804x86_64`
-  * `ubuntu2004i386`
-  * `ubuntu2004x86_64`
-  * `ubuntu2204i386`
-  * `ubuntu2204x86_64`
-* Debian
-  * `debian10i386`
-  * `debian10x86_64`
-  * `debian11i386`
-  * `debian11x86_64`
-
-### Attributes {#vm-tools-diskImageFuns-attributes}
-
-* `size` (optional, defaults to `4096`). The size of the image, in MiB.
-* `extraPackages` (optional). A list names of additional packages from the distribution that should be included in the image.
-
-### Examples {#vm-tools-diskImageFuns-examples}
-
-8GiB image containing Firefox in addition to the default packages:
-```nix
-{ pkgs }: with pkgs; with vmTools;
-diskImageFuns.ubuntu2004x86_64 { extraPackages = [ "firefox" ]; size = 8192; }
-```
-
-## `vmTools.diskImageExtraFuns` {#vm-tools-diskImageExtraFuns}
-
-Shorthand for `vmTools.diskImageFuns.<attr> { extraPackages = ... }`.
-
-## `vmTools.diskImages` {#vm-tools-diskImages}
-
-Shorthand for `vmTools.diskImageFuns.<attr> { }`.