From c94db0535c4ddd32957fd80d0713797ec73cc70b Mon Sep 17 00:00:00 2001 From: Tom Bereknyei Date: Fri, 21 Jan 2022 11:43:11 -0500 Subject: Refactor bundler API Bundlers now expect to be located at bundlers.. and are a function from derivations to derivations. --- src/nix/bundle.md | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'src/nix/bundle.md') diff --git a/src/nix/bundle.md b/src/nix/bundle.md index 5e2298376..317b7000b 100644 --- a/src/nix/bundle.md +++ b/src/nix/bundle.md @@ -18,12 +18,20 @@ R""( nix (Nix) 2.4pre20201215_e3ddffb ``` +* 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! + ``` + # Description -`nix bundle` packs the closure of the [Nix app](./nix3-run.md) -*installable* into a single self-extracting executable. See the -[`nix-bundle` homepage](https://github.com/matthewbauer/nix-bundle) -for more details. +`nix bundle`, by default, packs the closure of the [Nix app](./nix3-run.md) +*installable* into a single self-extracting executable. See the [`nix-bundle` +homepage](https://github.com/matthewbauer/nix-bundle) for more details. > **Note** > @@ -31,6 +39,29 @@ for more details. # Bundler definitions -TODO +If no flake output attribute is given, `nix bundle` tries the following +flake output attributes: + +* `defaultBundler.` + +If an attribute *name* is given, `nix run` tries the following flake +output attributes: + +* `bundler..` + +# Bundlers + +An bundlers is specified by a flake output attribute named +`bundlers..` or `defaultBundler.`. It looks like this: + +```nix +bundlers.x86_64-linux.identity = drv: drv; + +bundlers.x86_64-linux.blender_2_79 = drv: self.packages.x86_64-linux.blender_2_79; + +defaultBundler.x86_64-linux = drv: drv; +``` + +A bundler must be a function that accepts a derivation and returns a derivation. )"" -- cgit v1.2.3