J’ai installé NixOS sur une machine dont j’avais pétée la distribution Ubuntu.
Afin de pouvoir apprendre mieux ce système et donc Nix.
J’ai installé l’IDE Jetbrains Intellij Idea avec le plugin Rust.
Je compile bien gcli
avec l’IDE sous NixOS !
J’utilise crate2nix pour générer un fichier Cargo.nix
à partir du fichier cargo.toml
(ou .lock
).
crate2nix generate
J’ai créé un fichier default.nix
pour faire le build à partir de Cargo.nix
:
let pkgs = import <nixpkgs> { }; in
let cargo_nix = pkgs.callPackage ./Cargo.nix {};
in cargo_nix.rootCrate.build
Je lance la commande de build :
nix-build
Et ça à l’air d’aller plus loin, mais boom !
unpacking source archive /nix/store/x5jjmr0dlnj4f8w15c1yk4wiyqf8c5bz-duniter-polkadot-sdk-c84530c
Running cd /build/duniter-polkadot-sdk-c84530c/substrate/primitives/storage
source root is duniter-polkadot-sdk-c84530c
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: buildPhase
Building src/lib.rs (sp-storage)
Running rustc --crate-name sp_storage src/lib.rs --out-dir target/lib -L dependency=target/deps --cap-lints allow -C opt-level=3 -C codegen-units=1 --remap-path-prefix=/build=/ --extern impl_serde=/nix/store/1n1b175hla3a229yawi713ygndnn4lvv-rust_impl-serde-0.4.0-lib/lib/libimpl_serde-278d5a2ea8.rlib --extern codec=/nix/store/rshjpjk584wa4rdvbrqxp01p5r7xdrb4-rust_parity-scale-codec-3.6.9-lib/lib/libparity_scale_codec-e9fb4e9eb3.rlib --extern ref_cast=/nix/store/8v883psgx60680w59qm8r9iq3n8wlaci-rust_ref-cast-1.0.22-lib/lib/libref_cast-7fe7ff157b.rlib --extern serde=/nix/store/4s90pqnmm9vpjcgb8550498m5q54ryan-rust_serde-1.0.196-lib/lib/libserde-bf801c33c1.rlib --extern sp_debug_derive=/nix/store/qgghmv095qjcgll24q628y3hhsx503kv-rust_sp-debug-derive-8.0.0-lib/lib/libsp_debug_derive-e1f5db7d9d.so --extern sp_std=/nix/store/7mcdn19svhl6g4rbfnxfvhjra716zpf5-rust_sp-std-8.0.0-lib/lib/libsp_std-622782830f.rlib --cfg feature="impl-serde" --cfg feature="serde" --cfg feature="std" --edition 2021 -C metadata=14b8493325 -C extra-filename=-14b8493325 --crate-type lib --color always
Running phase: configurePhase
Searching for matching Cargo.toml (sp-tracing)
error: `CARGO` env variable not set.
--> src/lib.rs:39:63
|
39 | derive(Serialize, Deserialize, Hash, PartialOrd, Ord, Clone, Encode, Decode)
| ^^^^^^
|
= note: this error originates in the derive macro `Encode` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `CARGO` env variable not set.
--> src/lib.rs:39:71
|
39 | derive(Serialize, Deserialize, Hash, PartialOrd, Ord, Clone, Encode, Decode)
| ^^^^^^
|
= note: this error originates in the derive macro `Decode` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `CARGO` env variable not set.
--> src/lib.rs:53:75
|
53 | PartialEq, Eq, Ord, PartialOrd, sp_std::hash::Hash, RuntimeDebug, Clone, Encode, Decode,
| ^^^^^^
|
= note: this error originates in the derive macro `Encode` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `CARGO` env variable not set.
--> src/lib.rs:53:83
|
53 | PartialEq, Eq, Ord, PartialOrd, sp_std::hash::Hash, RuntimeDebug, Clone, Encode, Decode,
| ^^^^^^
|
= note: this error originates in the derive macro `Decode` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `CARGO` env variable not set.
--> src/lib.rs:146:63
|
146 | derive(Serialize, Deserialize, Hash, PartialOrd, Ord, Clone, Encode, Decode, Default)
| ^^^^^^
|
= note: this error originates in the derive macro `Encode` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `CARGO` env variable not set.
--> src/lib.rs:146:71
|
146 | derive(Serialize, Deserialize, Hash, PartialOrd, Ord, Clone, Encode, Decode, Default)
| ^^^^^^
|
= note: this error originates in the derive macro `Decode` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `CARGO` env variable not set.
--> src/lib.rs:250:76
|
250 | #[cfg_attr(feature = "serde", derive(PartialEq, Eq, Hash, PartialOrd, Ord, Encode, Decode))]
| ^^^^^^
|
= note: this error originates in the derive macro `Encode` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `CARGO` env variable not set.
--> src/lib.rs:250:84
|
250 | #[cfg_attr(feature = "serde", derive(PartialEq, Eq, Hash, PartialOrd, Ord, Encode, Decode))]
| ^^^^^^
|
= note: this error originates in the derive macro `Decode` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `CARGO` env variable not set.
--> src/lib.rs:397:76
|
397 | #[cfg_attr(feature = "serde", derive(PartialEq, Eq, Hash, PartialOrd, Ord, Encode, Decode))]
| ^^^^^^
|
= note: this error originates in the derive macro `Encode` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `CARGO` env variable not set.
--> src/lib.rs:397:84
|
397 | #[cfg_attr(feature = "serde", derive(PartialEq, Eq, Hash, PartialOrd, Ord, Encode, Decode))]
| ^^^^^^
|
= note: this error originates in the derive macro `Decode` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `CARGO` env variable not set.
--> src/lib.rs:418:36
|
418 | #[cfg_attr(feature = "std", derive(Encode, Decode))]
| ^^^^^^
|
= note: this error originates in the derive macro `Encode` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `CARGO` env variable not set.
--> src/lib.rs:418:44
|
418 | #[cfg_attr(feature = "std", derive(Encode, Decode))]
| ^^^^^^
|
= note: this error originates in the derive macro `Decode` (in Nightly builds, run with -Z macro-backtrace for more info)
...checking manifest_path ./Cargo.toml
error: aborting due to 12 previous errors
error: builder for '/nix/store/sm9jrgcjws8hhp3xj878zsapys3nn4m1-rust_sp-storage-13.0.0.drv' failed with exit code 1;
last 10 log lines:
> error: `CARGO` env variable not set.
> --> src/lib.rs:418:44
> |
> 418 | #[cfg_attr(feature = "std", derive(Encode, Decode))]
> | ^^^^^^
> |
> = note: this error originates in the derive macro `Decode` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> error: aborting due to 12 previous errors
>
For full logs, run 'nix-store -l /nix/store/sm9jrgcjws8hhp3xj878zsapys3nn4m1-rust_sp-storage-13.0.0.drv'.
error: 1 dependencies of derivation '/nix/store/ma75jf62d0r3b9hcpbjfrx6sv4x7zlig-rust_gcli-0.2.9.drv' failed to build
Une compilation échoue car la variable d’environnement “CARGO” n’est pas trouvée…
A suivre…