Nix/src/nix/bundle.md
Valentin Gagarin 2af9fd20c6 clarify definition of "installable"
the term was hard to discover, as its definition and explanation were in
a very long document lacking an overview section.
search did not help because it occurs so often.

- clarify wording in the definition
- add an overview of installable types
- add "installable" to glossary
- link to definition from occurrences of the term
- be more precise about where store derivation outputs are processed
- installable Nix expressions must evaluate to a derivation

Co-authored-by: Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com>
2023-03-05 01:46:17 +01:00

1.5 KiB

R""(

Examples

  • Bundle Hello:

    # nix bundle nixpkgs#hello
    # ./hello
    Hello, world!
    
  • Bundle a specific version of Nix:

    # nix bundle github:NixOS/nix/e3ddffb27e5fc37a209cfd843c6f7f6a9460a8ec
    # ./nix --version
    nix (Nix) 2.4pre20201215_e3ddffb
    
  • Bundle a Hello using a specific bundler:

    # nix bundle --bundler github:NixOS/bundlers#toDockerImage nixpkgs#hello
    # docker load < hello-2.10.tar.gz
    # docker run hello-2.10:latest hello
    Hello, world!
    

Description

nix bundle, by default, packs the closure of the installable into a single self-extracting executable. See the bundlers homepage for more details.

Note

This command only works on Linux.

Flake output attributes

If no flake output attribute is given, nix bundle tries the following flake output attributes:

  • bundlers.<system>.default

If an attribute name is given, nix bundle tries the following flake output attributes:

  • bundlers.<system>.<name>

Bundlers

A bundler is specified by a flake output attribute named bundlers.<system>.<name>. It looks like this:

bundlers.x86_64-linux = rec {
  identity = drv: drv;

  blender_2_79 = drv: self.packages.x86_64-linux.blender_2_79;

  default = identity;
};

A bundler must be a function that accepts an arbitrary value (typically a derivation or app definition) and returns a derivation.

)""