Improve README

Closes https://github.com/nix-community/naersk/issues/283.
This commit is contained in:
Patryk Wychowaniec 2023-06-11 19:47:46 +02:00
parent 88cd223801
commit 4d3bb30b8b
2 changed files with 64 additions and 0 deletions

View file

@ -4,11 +4,43 @@
Build Rust projects with ease!
* [Introduction](#introduction)
* [Setup](#setup)
* [Usage](#usage)
* [Examples](#examples)
* [Tips & Tricks](#tips--tricks)
## Introduction
Naersk is a [Nix](https://nixos.org/explore.html) library for building Rust
projects - basically, you write:
```
naersk.buildPackage {
src = ./.; # Wherever your Cargo.lock and the rest of your source code are
}
```
... and that turns your code into a Nix derivation which you can, for instance,
include in your system:
```
environment.systemPackages = [
(naersk.buildPackage {
src = ./my-cool-app;
})
];
# (see below for more complete examples)
```
Under the hood, `buildPackage` parses `Cargo.lock`, downloads all dependencies,
and compiles your application, fully utilizing Nix's sandboxing and caching
abilities; so, with a pinch of salt, Naersk is `cargo build`, but inside Nix!
If you're using Hydra, you can rely on Naersk as well because it doesn't use
IFD - all the parsing happens directly inside Nix code.
## Setup
### Using Flakes

View file

@ -4,11 +4,43 @@
Build Rust projects with ease!
* [Introduction](#introduction)
* [Setup](#setup)
* [Usage](#usage)
* [Examples](#examples)
* [Tips & Tricks](#tips--tricks)
## Introduction
Naersk is a [Nix](https://nixos.org/explore.html) library for building Rust
projects - basically, you write:
```
naersk.buildPackage {
src = ./.; # Wherever your Cargo.lock and the rest of your source code are
}
```
... and that turns your code into a Nix derivation which you can, for instance,
include in your system:
```
environment.systemPackages = [
(naersk.buildPackage {
src = ./my-cool-app;
})
];
# (see below for more complete examples)
```
Under the hood, `buildPackage` parses `Cargo.lock`, downloads all dependencies,
and compiles your application, fully utilizing Nix's sandboxing and caching
abilities; so, with a pinch of salt, Naersk is `cargo build`, but inside Nix!
If you're using Hydra, you can rely on Naersk as well because it doesn't use
IFD - all the parsing happens directly inside Nix code.
## Setup
### Using Flakes