wiki/docs/nix/pkgs-tools-reference.md

4.4 KiB

title description published date tags editor dateCreated
Nixpkgs Tools An overview of the various functions unrelated to building source code available in Nixpkgs. true 2024-06-22T16:41:59.925Z nix, nixpkgs markdown 2024-06-22T16:41:59.925Z

Introduction to Nixpkgs' tools

This page is an overview of various functionality included in Nixpkgs, that is not directly related to building packages from source code.

Fetchers (pkgs.fetch*)

Fetchers such as pkgs.fetchurl allow to download content such as package sources, by specifying an expected hash of the content.

Resources:

Wrappers (pkgs.runCommand*, pkgs.write*)

Functions such as pkgs.runCommand or pkgs.writeShellScript are use-case specific wrappers around pkgs.stdenv with simple arguments. Not to be confused with pkgs.writers.

Resources:

Data Formats (pkgs.writers)

Data format or application focussed writers that transform Nix expressions into the respective format. Not to be confused with pkgs.write*.

Resource:

Config File Formats (pkgs.formats)

Produce various config file formats from nix expressions.

Resources:

Custom Build Environments (pkgs.mkShell)

Convenience wrapper around mkDerivation for usage with nix-shell / nix develop.

Resources:

Creating Hooks (pkgs.makeSetupHook)

Helper to produce hooks for the stdenv build phases. (For more info on hooks in general, see Language/Framework Specific Builders in Nixpkgs#Hooks).

Resources:

Test Utilities (pkgs.testers)

Derivation builders for testing various properties of other derivations.

Resources:

fakeNss

Including this derivation in, e.g. docker images or other environments without them, provides a simplistic set of user/group entries, to allow binaries expecting them to exist to work.

Resources:

Standard Filesystem Layout Wrapper (buildFHSEnv)

Wraps binaries that expect a FHS-compatible filesystem layout to run unpatched on NixOs.

Resources:

Run AppImages (pkgs.appimageTools)

A set of functions to run or extract AppImages.

Resources:

Docker Images (pkgs.dockerTools)

A set of functions to create, modify, import or export docker images.

Resources:

Build OCI Containers (pkgs.ociTools)

A set of function to create OCI containers.

Resources:

Build Portable Services (pkgs.portableService)

A function to create systemd's Portable Services.

Resources:

Build Disk Images (make-disk-image.nix)

This function creates disk images in various formats (e.g. raw, QCOW2 (QEMU), VDI (VirtualBox), etc.).

Resources:

Run Derivations inside a VM (pkgs.vmTools)

Various tools to run derivations inside a Qemu/KVM backed virtual machine.

Resources:

Incremental Builds (pkgs.checkpointBuildTools)

Resources:

Flat-file Binary Cache (pkgs.mkBinaryCache)

Create Nix flat-file binary caches.

Resources: