The sound distributed version control system

#589 [Bug] Can't build Pijul from main using Nix Flakes

Closed on February 22, 2023
a12l on December 11, 2021

I can’t build Pijul. When I try I get an error message.

$ pijul clone https://nest.pijul.com/pijul/pijul
Downloading changes [==================================================] 701/701
           Applying [==================================================] 701/701
 Completing changes [                                                  ] 0/0

$ cd pijul/

$ nix build .#pijul
error: builder for '/nix/store/7in0ray6my4710bnp8fflriy41hj19m1-rust_pijul-1.0.0-alpha.56.drv' failed with exit code 1;
       last 10 log lines:
       >    --> src/commands/record.rs:145:67
       >     |
       > 145 |             .apply_root_change_if_needed(&repo.changes, &channel, rand::thread_rng())?;
       >     |                                                                   ^^^^^^^^^^^^^^^^^^ the trait `rand_core::RngCore` is not implemented for `ThreadRng`
       >     |
       >     = note: required because of the requirements on the impl of `rand::Rng` for `ThreadRng`
       >
       > error: aborting due to previous error
       >
       > For more information about this error, try `rustc --explain E0277`.
       For full logs, run 'nix log /nix/store/7in0ray6my4710bnp8fflriy41hj19m1-rust_pijul-1.0.0-alpha.56.drv'.

$ nix log /nix/store/7in0ray6my4710bnp8fflriy41hj19m1-rust_pijul-1.0.0-alpha.56.drv
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/63906w035hvq1pjn35hwxx60mafdvvl9-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
Running cd .
@nix { "action": "setPhase", "phase": "buildPhase" }
building
Building pijul (src/main.rs)
Running rustc --crate-name pijul src/main.rs --crate-type bin -C opt-level=3 -C codegen-units=4 --remap-path-prefix=/build=/ --extern anyhow=/nix/store/ipdg2v3skda0p0f2c7icm6l3qywx59xv-rust_anyhow-1.0.48-lib/lib/>
error[E0277]: the trait bound `ThreadRng: rand_core::RngCore` is not satisfied
   --> src/commands/record.rs:145:67
    |
145 |             .apply_root_change_if_needed(&repo.changes, &channel, rand::thread_rng())?;
    |                                                                   ^^^^^^^^^^^^^^^^^^ the trait `rand_core::RngCore` is not implemented for `ThreadRng`
    |
    = note: required because of the requirements on the impl of `rand::Rng` for `ThreadRng`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
spacefrogg added a change on December 12, 2021
2YW3GIY7WROIXZOSL4UB3SRBDGWFXIDWAL3GKHAYXHZHHPE5DH7AC
spacefrogg on December 12, 2021

Apply above patch and try again. Cargo.nix frequently misses updates to cargo dependencies. @pmeunier :)

spacefrogg on December 22, 2021

An updated patch is kept in #596

pmeunier on February 22, 2023

Hi! It’s been a while, but I applied the updated patch. Thanks for the report anyway.

pmeunier closed this discussion on February 22, 2023