lix/doc/manual
regnat 7c5596734f
Add a post-build-hook
Passing `--post-build-hook /foo/bar` to a nix-* command will cause
`/foo/bar` to be executed after each build with the following
environment variables set:

    DRV_PATH=/nix/store/drv-that-has-been-built.drv
    OUT_PATHS=/nix/store/...build /nix/store/...build-bin /nix/store/...build-dev

This can be useful in particular to upload all the builded artifacts to
the cache (including the ones that don't appear in the runtime closure
of the final derivation or are built because of IFD).

This new feature prints the stderr/stdout output to the `nix-build`
and `nix build` client, and the output is printed in a Nix 2
compatible format:

    [nix]$ ./inst/bin/nix-build ./test.nix
    these derivations will be built:
      /nix/store/ishzj9ni17xq4hgrjvlyjkfvm00b0ch9-my-example-derivation.drv
    building '/nix/store/ishzj9ni17xq4hgrjvlyjkfvm00b0ch9-my-example-derivation.drv'...
    hello!
    bye!
    running post-build-hook '/home/grahamc/projects/github.com/NixOS/nix/post-hook.sh'...
    post-build-hook: + sleep 1
    post-build-hook: + echo 'Signing paths' /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation
    post-build-hook: Signing paths /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation
    post-build-hook: + sleep 1
    post-build-hook: + echo 'Uploading paths' /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation
    post-build-hook: Uploading paths /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation
    post-build-hook: + sleep 1
    post-build-hook: + printf 'very important stuff'
    /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation

    [nix-shell:~/projects/github.com/NixOS/nix]$ ./inst/bin/nix build -L -f ./test.nix
    my-example-derivation> hello!
    my-example-derivation> bye!
    my-example-derivation (post)> + sleep 1
    my-example-derivation (post)> + echo 'Signing paths' /nix/store/c263gzj2kb2609mz8wrbmh53l14wzmfs-my-example-derivation
    my-example-derivation (post)> Signing paths /nix/store/c263gzj2kb2609mz8wrbmh53l14wzmfs-my-example-derivation
    my-example-derivation (post)> + sleep 1
    my-example-derivation (post)> + echo 'Uploading paths' /nix/store/c263gzj2kb2609mz8wrbmh53l14wzmfs-my-example-derivation
    my-example-derivation (post)> Uploading paths /nix/store/c263gzj2kb2609mz8wrbmh53l14wzmfs-my-example-derivation
    my-example-derivation (post)> + sleep 1
    my-example-derivation (post)> + printf 'very important stuff'
    [1 built, 0.0 MiB DL]

Co-authored-by: Graham Christensen <graham@grahamc.com>
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2019-08-02 10:48:15 -04:00
..
advanced-topics Add a post-build-hook 2019-08-02 10:48:15 -04:00
command-ref Add a post-build-hook 2019-08-02 10:48:15 -04:00
expressions Merge pull request #2882 from grahamc/docs/1115-tarball-ttl 2019-07-06 00:15:27 +02:00
figures Fix corrupt PNG 2013-08-21 12:53:51 +02:00
glossary docs: Add IDs to important sections 2018-08-31 10:06:33 -04:00
images/callouts Add docbook icons to the distribution 2014-04-09 14:52:43 +02:00
installation autoconf: Fix C++17 detection not working on Ubuntu 16.04. 2019-07-03 04:32:25 +02:00
introduction editline: wip 2018-10-29 08:44:58 -05:00
packages Nix uses the CPP SDK, not Java 2019-06-20 14:47:45 +02:00
release-notes Merge pull request #2582 from LnL7/fetchgit-refs 2019-07-02 15:44:31 +02:00
hacking.xml Docs: Fix install prefix 2018-08-21 21:46:43 +02:00
local.mk Add a new option to disable documentation generation at configure time 2016-09-20 14:34:43 +00:00
manual.xml Create upgrade notes 2018-09-01 15:35:46 -04:00
nix-lang-ref.xml * Various updates. 2009-11-05 09:07:43 +00:00
quote-literals.xsl Generate release notes again 2014-03-12 14:24:29 +01:00
schemas.xml * Document setuid Nix installs. 2004-10-31 17:08:48 +00:00
style.css Update release notes 2018-02-19 20:38:53 +01:00