carnix: 0.6.0 -> 0.6.5
This commit is contained in:
parent
88c16a63c6
commit
8f20e7ce3a
@ -79,19 +79,24 @@ an example for a minimal `hello` crate:
|
|||||||
Now, the file produced by the call to `carnix`, called `hello.nix`, looks like:
|
Now, the file produced by the call to `carnix`, called `hello.nix`, looks like:
|
||||||
|
|
||||||
```
|
```
|
||||||
with import <nixpkgs> {};
|
# Generated by carnix 0.6.5: carnix -o hello.nix --src ./. Cargo.lock --standalone
|
||||||
|
{ lib, buildPlatform, buildRustCrate, fetchgit }:
|
||||||
let kernel = buildPlatform.parsed.kernel.name;
|
let kernel = buildPlatform.parsed.kernel.name;
|
||||||
# ... (content skipped)
|
# ... (content skipped)
|
||||||
hello_0_1_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
|
|
||||||
crateName = "hello";
|
|
||||||
version = "0.1.0";
|
|
||||||
authors = [ "Authorname <user@example.com>" ];
|
|
||||||
src = ./.;
|
|
||||||
inherit dependencies buildDependencies features;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
hello_0_1_0 = hello_0_1_0_ rec {};
|
hello = f: hello_0_1_0 { features = hello_0_1_0_features { hello_0_1_0 = f; }; };
|
||||||
|
hello_0_1_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
|
||||||
|
crateName = "hello";
|
||||||
|
version = "0.1.0";
|
||||||
|
authors = [ "pe@pijul.org <pe@pijul.org>" ];
|
||||||
|
src = ./.;
|
||||||
|
inherit dependencies buildDependencies features;
|
||||||
|
};
|
||||||
|
hello_0_1_0 = { features?(hello_0_1_0_features {}) }: hello_0_1_0_ {};
|
||||||
|
hello_0_1_0_features = f: updateFeatures f (rec {
|
||||||
|
hello_0_1_0.default = (f.hello_0_1_0.default or true);
|
||||||
|
}) [ ];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -103,33 +108,44 @@ dependencies, for instance by adding a single line `libc="*"` to our
|
|||||||
following nix file:
|
following nix file:
|
||||||
|
|
||||||
```
|
```
|
||||||
with import <nixpkgs> {};
|
# Generated by carnix 0.6.5: carnix -o hello.nix --src ./. Cargo.lock --standalone
|
||||||
|
{ lib, buildPlatform, buildRustCrate, fetchgit }:
|
||||||
let kernel = buildPlatform.parsed.kernel.name;
|
let kernel = buildPlatform.parsed.kernel.name;
|
||||||
# ... (content skipped)
|
# ... (content skipped)
|
||||||
hello_0_1_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
|
|
||||||
crateName = "hello";
|
|
||||||
version = "0.1.0";
|
|
||||||
authors = [ "Jörg Thalheim <joerg@thalheim.io>" ];
|
|
||||||
src = ./.;
|
|
||||||
inherit dependencies buildDependencies features;
|
|
||||||
};
|
|
||||||
libc_0_2_34_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
|
|
||||||
crateName = "libc";
|
|
||||||
version = "0.2.34";
|
|
||||||
authors = [ "The Rust Project Developers" ];
|
|
||||||
sha256 = "11jmqdxmv0ka10ay0l8nzx0nl7s2lc3dbrnh1mgbr2grzwdyxi2s";
|
|
||||||
inherit dependencies buildDependencies features;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
hello_0_1_0 = hello_0_1_0_ rec {
|
hello = f: hello_0_1_0 { features = hello_0_1_0_features { hello_0_1_0 = f; }; };
|
||||||
dependencies = [ libc_0_2_34 ];
|
hello_0_1_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
|
||||||
|
crateName = "hello";
|
||||||
|
version = "0.1.0";
|
||||||
|
authors = [ "pe@pijul.org <pe@pijul.org>" ];
|
||||||
|
src = ./.;
|
||||||
|
inherit dependencies buildDependencies features;
|
||||||
};
|
};
|
||||||
libc_0_2_34_features."default".from_hello_0_1_0__default = true;
|
libc_0_2_36_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
|
||||||
libc_0_2_34 = libc_0_2_34_ rec {
|
crateName = "libc";
|
||||||
features = mkFeatures libc_0_2_34_features;
|
version = "0.2.36";
|
||||||
|
authors = [ "The Rust Project Developers" ];
|
||||||
|
sha256 = "01633h4yfqm0s302fm0dlba469bx8y6cs4nqc8bqrmjqxfxn515l";
|
||||||
|
inherit dependencies buildDependencies features;
|
||||||
};
|
};
|
||||||
libc_0_2_34_features."use_std".self_default = hasDefault libc_0_2_34_features;
|
hello_0_1_0 = { features?(hello_0_1_0_features {}) }: hello_0_1_0_ {
|
||||||
|
dependencies = mapFeatures features ([ libc_0_2_36 ]);
|
||||||
|
};
|
||||||
|
hello_0_1_0_features = f: updateFeatures f (rec {
|
||||||
|
hello_0_1_0.default = (f.hello_0_1_0.default or true);
|
||||||
|
libc_0_2_36.default = true;
|
||||||
|
}) [ libc_0_2_36_features ];
|
||||||
|
libc_0_2_36 = { features?(libc_0_2_36_features {}) }: libc_0_2_36_ {
|
||||||
|
features = mkFeatures (features.libc_0_2_36 or {});
|
||||||
|
};
|
||||||
|
libc_0_2_36_features = f: updateFeatures f (rec {
|
||||||
|
libc_0_2_36.default = (f.libc_0_2_36.default or true);
|
||||||
|
libc_0_2_36.use_std =
|
||||||
|
(f.libc_0_2_36.use_std or false) ||
|
||||||
|
(f.libc_0_2_36.default or false) ||
|
||||||
|
(libc_0_2_36.default or false);
|
||||||
|
}) [];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -146,7 +162,7 @@ or build inputs by overriding the hello crate in a seperate file.
|
|||||||
|
|
||||||
```
|
```
|
||||||
with import <nixpkgs> {};
|
with import <nixpkgs> {};
|
||||||
(import ./hello.nix).hello_0_1_0.override {
|
((import ./hello.nix).hello {}).override {
|
||||||
crateOverrides = defaultCrateOverrides // {
|
crateOverrides = defaultCrateOverrides // {
|
||||||
hello = attrs: { buildInputs = [ openssl ]; };
|
hello = attrs: { buildInputs = [ openssl ]; };
|
||||||
};
|
};
|
||||||
@ -166,7 +182,7 @@ patches the derivation:
|
|||||||
|
|
||||||
```
|
```
|
||||||
with import <nixpkgs> {};
|
with import <nixpkgs> {};
|
||||||
(import ./hello.nix).hello_0_1_0.override {
|
((import ./hello.nix).hello {}).override {
|
||||||
crateOverrides = defaultCrateOverrides // {
|
crateOverrides = defaultCrateOverrides // {
|
||||||
hello = attrs: lib.optionalAttrs (lib.versionAtLeast attrs.version "1.0") {
|
hello = attrs: lib.optionalAttrs (lib.versionAtLeast attrs.version "1.0") {
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
@ -187,7 +203,7 @@ crate, we could do:
|
|||||||
|
|
||||||
```
|
```
|
||||||
with import <nixpkgs> {};
|
with import <nixpkgs> {};
|
||||||
(import hello.nix).hello_0_1_0.override {
|
((import hello.nix).hello {}).override {
|
||||||
crateOverrides = defaultCrateOverrides // {
|
crateOverrides = defaultCrateOverrides // {
|
||||||
libc = attrs: { buildInputs = []; };
|
libc = attrs: { buildInputs = []; };
|
||||||
};
|
};
|
||||||
@ -199,23 +215,35 @@ Three more parameters can be overridden:
|
|||||||
- The version of rustc used to compile the crate:
|
- The version of rustc used to compile the crate:
|
||||||
|
|
||||||
```
|
```
|
||||||
hello_0_1_0.override { rust = pkgs.rust; };
|
(hello {}).override { rust = pkgs.rust; };
|
||||||
```
|
```
|
||||||
|
|
||||||
- Whether to build in release mode or debug mode (release mode by
|
- Whether to build in release mode or debug mode (release mode by
|
||||||
default):
|
default):
|
||||||
|
|
||||||
```
|
```
|
||||||
hello_0_1_0.override { release = false; };
|
(hello {}).override { release = false; };
|
||||||
```
|
```
|
||||||
|
|
||||||
- Whether to print the commands sent to rustc when building
|
- Whether to print the commands sent to rustc when building
|
||||||
(equivalent to `--verbose` in cargo:
|
(equivalent to `--verbose` in cargo:
|
||||||
|
|
||||||
```
|
```
|
||||||
hello_0_1_0.override { verbose = false; };
|
(hello {}).override { verbose = false; };
|
||||||
```
|
```
|
||||||
|
|
||||||
|
One can also supply features switches. For example, if we want to
|
||||||
|
compile `diesel_cli` only with the `postgres` feature, and no default
|
||||||
|
features, we would write:
|
||||||
|
|
||||||
|
```
|
||||||
|
(callPackage ./diesel.nix {}).diesel {
|
||||||
|
default = false;
|
||||||
|
postgres = true;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Using the Rust nightlies overlay
|
## Using the Rust nightlies overlay
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -6488,11 +6488,7 @@ with pkgs;
|
|||||||
|
|
||||||
buildRustCrate = callPackage ../build-support/rust/build-rust-crate.nix { };
|
buildRustCrate = callPackage ../build-support/rust/build-rust-crate.nix { };
|
||||||
|
|
||||||
carnix =
|
carnix = (callPackage ../build-support/rust/carnix.nix { }).carnix { };
|
||||||
let carnix = callPackage ../build-support/rust/carnix.nix { };
|
|
||||||
carnixFeatures = carnix.carnix_0_6_0_features {};
|
|
||||||
in
|
|
||||||
carnix.carnix_0_6_0 carnixFeatures;
|
|
||||||
|
|
||||||
defaultCrateOverrides = callPackage ../build-support/rust/default-crate-overrides.nix { };
|
defaultCrateOverrides = callPackage ../build-support/rust/default-crate-overrides.nix { };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user