diff --git a/README.md b/README.md index c19a788..3396791 100644 --- a/README.md +++ b/README.md @@ -268,6 +268,23 @@ See: [./examples](./examples). ## Tips & Tricks +### Building a particular example + +If you want to build only a particular example, use: + +``` nix +naersk.buildPackage { + pname = "your-example-name"; + src = ./.; + + overrideMain = old: { + preConfigure = '' + cargo_build_options="$cargo_build_options --example your-example-name" + ''; + }; +} +``` + ### Using OpenSSL If your application uses OpenSSL (making the build process fail), try: diff --git a/README.tpl.md b/README.tpl.md index d132e1b..fb232c8 100644 --- a/README.tpl.md +++ b/README.tpl.md @@ -232,6 +232,23 @@ See: [./examples](./examples). ## Tips & Tricks +### Building a particular example + +If you want to build only a particular example, use: + +``` nix +naersk.buildPackage { + pname = "your-example-name"; + src = ./.; + + overrideMain = old: { + preConfigure = '' + cargo_build_options="$cargo_build_options --example your-example-name" + ''; + }; +} +``` + ### Using OpenSSL If your application uses OpenSSL (making the build process fail), try: