2020-12-17 12:45:59 +02:00
|
|
|
R""(
|
|
|
|
|
|
|
|
# Examples
|
|
|
|
|
|
|
|
* Bundle Hello:
|
|
|
|
|
|
|
|
```console
|
|
|
|
# nix bundle nixpkgs#hello
|
|
|
|
# ./hello
|
|
|
|
Hello, world!
|
|
|
|
```
|
|
|
|
|
|
|
|
* Bundle a specific version of Nix:
|
|
|
|
|
|
|
|
```console
|
|
|
|
# nix bundle github:NixOS/nix/e3ddffb27e5fc37a209cfd843c6f7f6a9460a8ec
|
|
|
|
# ./nix --version
|
|
|
|
nix (Nix) 2.4pre20201215_e3ddffb
|
|
|
|
```
|
|
|
|
|
2022-01-21 18:43:11 +02:00
|
|
|
* Bundle a Hello using a specific bundler:
|
|
|
|
|
|
|
|
```console
|
|
|
|
# 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!
|
|
|
|
```
|
|
|
|
|
2020-12-17 12:45:59 +02:00
|
|
|
# Description
|
|
|
|
|
2022-01-25 10:48:44 +02:00
|
|
|
`nix bundle`, by default, packs the closure of the *installable* into a single
|
|
|
|
self-extracting executable. See the [`bundlers`
|
|
|
|
homepage](https://github.com/NixOS/bundlers) for more details.
|
2020-12-17 12:45:59 +02:00
|
|
|
|
|
|
|
> **Note**
|
|
|
|
>
|
|
|
|
> This command only works on Linux.
|
|
|
|
|
2022-01-28 17:23:57 +02:00
|
|
|
# Flake output attributes
|
2020-12-23 17:41:07 +02:00
|
|
|
|
2022-01-21 18:43:11 +02:00
|
|
|
If no flake output attribute is given, `nix bundle` tries the following
|
|
|
|
flake output attributes:
|
|
|
|
|
2022-02-22 15:32:56 +02:00
|
|
|
* `bundlers.<system>.default`
|
2022-01-21 18:43:11 +02:00
|
|
|
|
2022-08-11 02:49:29 +03:00
|
|
|
If an attribute *name* is given, `nix bundle` tries the following flake
|
2022-01-21 18:43:11 +02:00
|
|
|
output attributes:
|
|
|
|
|
2022-02-22 15:32:56 +02:00
|
|
|
* `bundlers.<system>.<name>`
|
2022-01-21 18:43:11 +02:00
|
|
|
|
|
|
|
# Bundlers
|
|
|
|
|
2022-01-28 17:23:57 +02:00
|
|
|
A bundler is specified by a flake output attribute named
|
2022-02-22 15:32:56 +02:00
|
|
|
`bundlers.<system>.<name>`. It looks like this:
|
2022-01-21 18:43:11 +02:00
|
|
|
|
|
|
|
```nix
|
2022-02-22 15:32:56 +02:00
|
|
|
bundlers.x86_64-linux = rec {
|
|
|
|
identity = drv: drv;
|
2022-01-21 18:43:11 +02:00
|
|
|
|
2022-02-22 15:32:56 +02:00
|
|
|
blender_2_79 = drv: self.packages.x86_64-linux.blender_2_79;
|
2022-01-21 18:43:11 +02:00
|
|
|
|
2022-02-22 15:32:56 +02:00
|
|
|
default = identity;
|
|
|
|
};
|
2022-01-21 18:43:11 +02:00
|
|
|
```
|
|
|
|
|
2022-01-28 17:23:57 +02:00
|
|
|
A bundler must be a function that accepts an arbitrary value (typically a
|
|
|
|
derivation or app definition) and returns a derivation.
|
2020-12-23 17:41:07 +02:00
|
|
|
|
2020-12-17 12:45:59 +02:00
|
|
|
)""
|