Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing mkRustCrate #24991

Closed
wants to merge 4 commits into from
Closed

Introducing mkRustCrate #24991

wants to merge 4 commits into from

Conversation

P-E-Meunier
Copy link
Contributor

Motivation for this change

mkRustCrate is an alternative to Cargo for building Rust crates. It is especially useful when using NixOps, as an increasing number of web services (proxies, HTTP(S) servers, SSH servers…) are using Rust, and NixOps recompiles the world on each deployment.

My own current usage of this is with a companion tool called generate-nix-expr, which generates a Nix expression calling out mkRustCrate to keep build products between builds.

This does not replace the version and features resolution algorithm in Cargo, and hence does not yet allow build products to be cached in channels, but that is clearly a foreseeable future of this project.

The maturity level is alpha. I use it successfully to compile and deploy nest.pijul.com, which depends on more than 120 crates, including some that are non-trivial to compile, such as *ring*.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@Mic92
Copy link
Member

Mic92 commented Apr 18, 2017

This sounds interesting. Can you also add one or two examples? Also the tool you mentioned generate-nix-expr would be helpful.

@P-E-Meunier
Copy link
Contributor Author

P-E-Meunier commented Apr 18, 2017

I just uploaded the generate-nix-pkg tool to crates.io: https://crates.io/crates/generate-nix-pkg

Here is an example hello, world (on this particular example, there is no difference with compiling with cargo):

cargo new hello
cd hello
echo "fn main() { println!(\"Hello, world\") }" > src/main.rs

Then, start a new file, hello,nix, in the same directory:

with import <nixpkgs> {};
rec {
  hello = (mkRustCrate {
    crateName = "hello";
    version = "0.1.0";
    src = ./.;
  }) pkgs.rustc;
}

Call nix-build hello.nix, and voilà! No Cargo involved, the compilation is done purely in Nix. The goal is not to replace cargo, though, just to allow projects using the same crates to share compilation products, and avoid recompiling hundreds of packages when deploying web services with nixops.

@Mic92
Copy link
Member

Mic92 commented Apr 18, 2017

@P-E-Meunier I suppose the source of this tool is hosted with pijul?

@P-E-Meunier
Copy link
Contributor Author

Sure, why?

@Mic92
Copy link
Member

Mic92 commented Apr 18, 2017

In case I want to contribute changes back. For instances VCS support is a major pain point of the current buildRustPackage function

@P-E-Meunier
Copy link
Contributor Author

P-E-Meunier commented Apr 18, 2017

In case you want to contribute, the repository is hosted on https://nest.pijul.com/pmeunier/nix-rust.

You are more than welcome to contribute! Feel free to ask anything about Pijul/the Nest/…

Contributing should be way easier than on any other platform, with the minor caveat that not all kinds of SSH keys are supported: unprotected Ed25519 keys work well, unprotected RSA should be fine, protected/agents are not yet supported.

Also, if you write patches, Pijul guarantees that they won't be merged in random places you've never seen, contrarily to what other tools (git/mercurial/svn) do.

@Mic92
Copy link
Member

Mic92 commented Apr 18, 2017

It is called nix-rust, now the confusion is complete: https://github.com/nix-rust/nix :)

@FlorentBecker
Copy link
Contributor

What / how many crates did you manage to build with it? Would you say it's ready to be used by nixpkgs itself, or is it too early?

@P-E-Meunier
Copy link
Contributor Author

P-E-Meunier commented Apr 20, 2017

Here's the build file I use for nest.pijul.com, all the crates build correctly. A huge improvement is that I don't have to keep my unpublished dependencies in the same repository, and I can share them with other projects (such as libpijul).

I don't know whether it could be used by nixpkgs, but the purpose of this pull request is to decide that, and to fill the gaps. There are several caveats:

  1. Nix files are generated from Cargo.lock.
  2. Some features require manual tweaking: cargo build --verbose seems to take the union of all features. I've submitted a bug report asking for Cargo.lock to contain the features, because cargo doesn't always follow its own documentation on the syntax of Cargo.toml.
  3. Platforms complicate the story even more: my compiler doesn't always generate the correct file when the Cargo.toml contains platform-specific things.

The file below is generated automatically, edited to remove references to redox, and called with:

let rust = (pkgs.callPackage ./rust-nightly.nix { }).rust {};
    nest = (import ./nest.nix).nest_0_1_0 rust;
in

Where ./rust-nightly.nix contains a rustup-based derivation to get Rust nightly.

Code
with import <nixpkgs> {};
let release = true;
in
rec {
  aho_corasick_0_5_3 = mkRustCrate {
    crateName = "aho-corasick";
    version = "0.5.3";
    dependencies = [ memchr_0_1_11 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/aho-corasick/0.5.3/download";
      sha256 = "1igab46mvgknga3sxkqc917yfff0wsjxjzabdigmh240p5qxqlnn";
      name = "aho-corasick-0.5.3.tar.gz";
    };
    libName = "aho_corasick";
    crateBin = [ {  name = "aho-corasick-dot"; } ];
    inherit release;
  };
  aho_corasick_0_6_3 = mkRustCrate {
    crateName = "aho-corasick";
    version = "0.6.3";
    dependencies = [ memchr_1_0_1 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/aho-corasick/0.6.3/download";
      sha256 = "1cpqzf6acj8lm06z3f1cg41wn6c2n9l3v49nh0dvimv4055qib6k";
      name = "aho-corasick-0.6.3.tar.gz";
    };
    libName = "aho_corasick";
    crateBin = [ {  name = "aho-corasick-dot"; } ];
    inherit release;
  };
  ansi_term_0_9_0 = mkRustCrate {
    crateName = "ansi_term";
    version = "0.9.0";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/ansi_term/0.9.0/download";
      sha256 = "1vcd8m2hglrdi4zmqnkkz5zy3c73ifgii245k7vj6qr5dzpn9hij";
      name = "ansi_term-0.9.0.tar.gz";
    };
    libName = "ansi_term";
    inherit release;
  };
  approx_0_1_1 = mkRustCrate {
    crateName = "approx";
    version = "0.1.1";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/approx/0.1.1/download";
      sha256 = "1wrhjjqhdg9qvw59489iw3cy1dy96v63isbflbkwbrv79ayksa3c";
      name = "approx-0.1.1.tar.gz";
    };
    libName = "approx";
    inherit release;
  };
  arrayref_0_3_3 = mkRustCrate {
    crateName = "arrayref";
    version = "0.3.3";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/arrayref/0.3.3/download";
      sha256 = "09808p7p6nny38wp1lhiis545d248yx2i6gmp7zkxdhhvsixhj9z";
      name = "arrayref-0.3.3.tar.gz";
    };
    inherit release;
  };
  atty_0_2_2 = mkRustCrate {
    crateName = "atty";
    version = "0.2.2";
    dependencies = [ kernel32_sys_0_2_2 libc_0_2_21 winapi_0_2_8 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/atty/0.2.2/download";
      sha256 = "05c6jvrxljp4s1aycgq2z3y56f7f5yvc56v25cqlmpc1qx65z7ba";
      name = "atty-0.2.2.tar.gz";
    };
    inherit release;
  };
  base64_0_2_1 = mkRustCrate {
    crateName = "base64";
    version = "0.2.1";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/base64/0.2.1/download";
      sha256 = "1y53xbk9xj0nymqaj1jvixgy3slmsxa8lavajqn2q8jrz33n5hpq";
      name = "base64-0.2.1.tar.gz";
    };
    inherit release;
  };
  bincode_1_0_0 = mkRustCrate {
    crateName = "bincode";
    version = "1.0.0-alpha7";
    dependencies = [ byteorder_1_0_0 num_traits_0_1_37 serde_0_9_14 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/bincode/1.0.0-alpha7/download";
      sha256 = "0dhih6ikwkkarv4a8c9kbqy3kzq8nm0c2cni9bd1fxsydl8378a3";
      name = "bincode-1.0.0-alpha7.tar.gz";
    };
    inherit release;
  };
  bitflags_0_4_0 = mkRustCrate {
    crateName = "bitflags";
    version = "0.4.0";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/bitflags/0.4.0/download";
      sha256 = "0an03kibhfcc0mcxf6a0mvbab0s7cggnvflw8jn0b15i351h828c";
      name = "bitflags-0.4.0.tar.gz";
    };
    inherit release;
  };
  bitflags_0_7_0 = mkRustCrate {
    crateName = "bitflags";
    version = "0.7.0";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/bitflags/0.7.0/download";
      sha256 = "1hr72xg5slm0z4pxs2hiy4wcyx3jva70h58b7mid8l0a4c8f7gn5";
      name = "bitflags-0.7.0.tar.gz";
    };
    inherit release;
  };
  bitflags_0_8_2 = mkRustCrate {
    crateName = "bitflags";
    version = "0.8.2";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/bitflags/0.8.2/download";
      sha256 = "0whaj3969ysqxzk620sk1isvq6vh85516f2fplvqjrw3syz44sb2";
      name = "bitflags-0.8.2.tar.gz";
    };
    inherit release;
  };
  byteorder_1_0_0 = mkRustCrate {
    crateName = "byteorder";
    version = "1.0.0";
    features = [ "std" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/byteorder/1.0.0/download";
      sha256 = "14pdnds4517vcpablc51vv76hvc3glnpkpbb7qdil591q7lyb0m1";
      name = "byteorder-1.0.0.tar.gz";
    };
    libName = "byteorder";
    inherit release;
  };
  bytes_0_4_2 = mkRustCrate {
    crateName = "bytes";
    version = "0.4.2";
    dependencies = [ byteorder_1_0_0 iovec_0_1_0 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/bytes/0.4.2/download";
      sha256 = "0103d0dk1plhzy188fxf4a3qv2g5bjvxjcf0rjncwrhx6rrkmz1x";
      name = "bytes-0.4.2.tar.gz";
    };
    inherit release;
  };
  cfg_if_0_1_0 = mkRustCrate {
    crateName = "cfg-if";
    version = "0.1.0";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/cfg-if/0.1.0/download";
      sha256 = "1grr9v6ijms84cvl1jqv5hp9clw9gn3l3g6kj9a31sdzvidd6v29";
      name = "cfg-if-0.1.0.tar.gz";
    };
    inherit release;
  };
  chrono_0_3_0 = mkRustCrate {
    crateName = "chrono";
    version = "0.3.0";
    dependencies = [ num_0_1_37 rustc_serialize_0_3_23 serde_0_9_14 time_0_1_36 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/chrono/0.3.0/download";
      sha256 = "0mshjr8h471bvqv0fp02rf0p5582l9kzdcs2kavl1hk7i4qpdv3r";
      name = "chrono-0.3.0.tar.gz";
    };
    libName = "chrono";
    inherit release;
  };
  chrono_tz_0_3_2 = mkRustCrate {
    crateName = "chrono-tz";
    version = "0.3.2";
    dependencies = [ chrono_0_3_0 parse_zoneinfo_0_1_0 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/chrono-tz/0.3.2/download";
      sha256 = "0byi5v7bfppq56r3gdmjdk1rpm09naiw4gbvhz4kpbjwk9xyjibp";
      name = "chrono-tz-0.3.2.tar.gz";
    };
    build = "build.rs";
    inherit release;
  };
  clap_2_23_2 = mkRustCrate {
    crateName = "clap";
    version = "2.23.2";
    dependencies = [ ansi_term_0_9_0 atty_0_2_2 bitflags_0_8_2 strsim_0_6_0 term_size_0_3_0 unicode_segmentation_1_1_0 unicode_width_0_1_4 vec_map_0_7_0 ];
    features = [ "color" "suggestions" "wrap_help" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/clap/2.23.2/download";
      sha256 = "1sfc2h9sn4k3vkgqxwk2mhl75f0i9gl3ncl7d2y7plhp18k5nlrs";
      name = "clap-2.23.2.tar.gz";
    };
    inherit release;
  };
  cryptovec_0_3_3 = mkRustCrate {
    crateName = "cryptovec";
    version = "0.3.3";
    dependencies = [ kernel32_sys_0_2_2 libc_0_2_21 winapi_0_2_8 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/cryptovec/0.3.3/download";
      sha256 = "13nz0x69crc5hkcka8qq89rwnmh058bm1i3vhgq2drywkrwz5r99";
      name = "cryptovec-0.3.3.tar.gz";
    };
    inherit release;
  };
  deque_0_3_1 = mkRustCrate {
    crateName = "deque";
    version = "0.3.1";
    dependencies = [ rand_0_3_15 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/deque/0.3.1/download";
      sha256 = "04x8i5aagxmslk350i8qszyw7kmvrqc3d99g4qi1xnfmr61y7m68";
      name = "deque-0.3.1.tar.gz";
    };
    inherit release;
  };
  dtoa_0_4_1 = mkRustCrate {
    crateName = "dtoa";
    version = "0.4.1";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/dtoa/0.4.1/download";
      sha256 = "0mgg4r90yby68qg7y8csbclhsm53ac26vsyq615viq535plllhzw";
      name = "dtoa-0.4.1.tar.gz";
    };
    inherit release;
  };
  env_logger_0_3_5 = mkRustCrate {
    crateName = "env_logger";
    version = "0.3.5";
    dependencies = [ log_0_3_7 regex_0_1_80 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/env_logger/0.3.5/download";
      sha256 = "1mvxiaaqsyjliv1mm1qaagjqiccw11mdyi3n9h9rf8y6wj15zycw";
      name = "env_logger-0.3.5.tar.gz";
    };
    inherit release;
  };
  env_logger_0_4_2 = mkRustCrate {
    crateName = "env_logger";
    version = "0.4.2";
    dependencies = [ log_0_3_7 regex_0_2_1 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/env_logger/0.4.2/download";
      sha256 = "1l74h35ls0gfmh0c32lyvmqll999kfh4kiwcg0iz2h9k76j9w4p2";
      name = "env_logger-0.4.2.tar.gz";
    };
    inherit release;
  };
  flate2_0_2_19 = mkRustCrate {
    crateName = "flate2";
    version = "0.2.19";
    dependencies = [ libc_0_2_21 miniz_sys_0_1_9 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/flate2/0.2.19/download";
      sha256 = "1dpnvw4hcxplalr3bk527d9rfiy7c08580hji9dnfcv5fmdg1znq";
      name = "flate2-0.2.19.tar.gz";
    };
    inherit release;
  };
  fs2_0_4_1 = mkRustCrate {
    crateName = "fs2";
    version = "0.4.1";
    dependencies = [ kernel32_sys_0_2_2 libc_0_2_21 winapi_0_2_8 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/fs2/0.4.1/download";
      sha256 = "1xlmbyqjwjypl0cvmiczi8xlhxxg53glgm5b384lmb9a95rzyxdm";
      name = "fs2-0.4.1.tar.gz";
    };
    inherit release;
  };
  futures_0_1_13 = mkRustCrate {
    crateName = "futures";
    version = "0.1.13";
    features = [ "use_std" "with-deprecated" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/futures/0.1.13/download";
      sha256 = "04l59smi34z3nx9n79g0zsgq9j8y8m0lwr72wwnl8hc7ln3vbq7q";
      name = "futures-0.1.13.tar.gz";
    };
    inherit release;
  };
  gcc_0_3_45 = mkRustCrate {
    crateName = "gcc";
    version = "0.3.45";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/gcc/0.3.45/download";
      sha256 = "0d3pzpbh7wr7645i2rkg5f7c4bhp01a9syrw600fjcvqhkiykp5n";
      name = "gcc-0.3.45.tar.gz";
    };
    inherit release;
  };
  getopts_0_2_14 = mkRustCrate {
    crateName = "getopts";
    version = "0.2.14";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/getopts/0.2.14/download";
      sha256 = "1wdz34vls97g9868h8kiw4wmwkbyxg4xm3xzvr1542hc3w4c7z0a";
      name = "getopts-0.2.14.tar.gz";
    };
    inherit release;
  };
  google_oauth_0_1_0 = mkRustCrate {
    crateName = "google-oauth";
    version = "0.1.0";
    dependencies = [ env_logger_0_4_2 futures_0_1_13 httpserver_0_1_0 log_0_3_7 oauthcli_1_0_4 regex_0_2_1 ring_0_7_5 rustc_serialize_0_3_23 serde_0_9_14 serde_derive_0_9_14 serde_json_0_9_10 tokio_core_0_1_6 untrusted_0_3_2 url_1_4_0 ];
    src = ../google-oauth;
    inherit release;
  };
  httpserver_0_1_0 = mkRustCrate {
    crateName = "httpserver";
    version = "0.1.0";
    dependencies = [ byteorder_1_0_0 chrono_0_3_0 env_logger_0_4_2 futures_0_1_13 lazy_static_0_2_8 libc_0_2_21 log_0_3_7 net2_0_2_27 regex_0_2_1 ring_0_7_5 rustc_serialize_0_3_23 rustls_0_5_8 rustls_tokio_0_1_0 tokio_core_0_1_6 tokio_io_0_1_1 url_1_4_0 webpki_roots_0_7_0 ];
    src = ../google-oauth/../httpserver;
    inherit release;
  };
  idna_0_1_1 = mkRustCrate {
    crateName = "idna";
    version = "0.1.1";
    dependencies = [ matches_0_1_4 unicode_bidi_0_2_5 unicode_normalization_0_1_4 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/idna/0.1.1/download";
      sha256 = "1rj1w2kc561viha9xjchrxh0dx3gc5zvjsl7nqv9vahnwrghdswr";
      name = "idna-0.1.1.tar.gz";
    };
    inherit release;
  };
  iovec_0_1_0 = mkRustCrate {
    crateName = "iovec";
    version = "0.1.0";
    dependencies = [ libc_0_2_21 winapi_0_2_8 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/iovec/0.1.0/download";
      sha256 = "01gmbcaamfms70ll964wj3akqbj5bf6zzi7nfj5y2hvzjxd959sj";
      name = "iovec-0.1.0.tar.gz";
    };
    inherit release;
  };
  itoa_0_3_1 = mkRustCrate {
    crateName = "itoa";
    version = "0.3.1";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/itoa/0.3.1/download";
      sha256 = "0jp1wvfw0qqbyz0whbycp7xr5nx1ds5plh4wsfyj503xmjf9ab4k";
      name = "itoa-0.3.1.tar.gz";
    };
    inherit release;
  };
  kernel32_sys_0_2_2 = mkRustCrate {
    crateName = "kernel32-sys";
    version = "0.2.2";
    dependencies = [ winapi_0_2_8 winapi_build_0_1_1 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/kernel32-sys/0.2.2/download";
      sha256 = "1lrw1hbinyvr6cp28g60z97w32w8vsk6pahk64pmrv2fmby8srfj";
      name = "kernel32-sys-0.2.2.tar.gz";
    };
    libName = "kernel32";
    build = "build.rs";
    buildDependencies = [ winapi_build_0_0_0 ];
    inherit release;
  };
  lazy_static_0_2_8 = mkRustCrate {
    crateName = "lazy_static";
    version = "0.2.8";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/lazy_static/0.2.8/download";
      sha256 = "1xbpxx7cd5kl60g87g43q80jxyrsildhxfjc42jb1x4jncknpwbl";
      name = "lazy_static-0.2.8.tar.gz";
    };
    inherit release;
  };
  lazycell_0_4_0 = mkRustCrate {
    crateName = "lazycell";
    version = "0.4.0";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/lazycell/0.4.0/download";
      sha256 = "1vgxv62l8qh3m8gvjyrd7wkx44hih724ivssc1mwj7vq9gnhgl0d";
      name = "lazycell-0.4.0.tar.gz";
    };
    inherit release;
  };
  libc_0_2_21 = mkRustCrate {
    crateName = "libc";
    version = "0.2.21";
    features = [ "use_std" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/libc/0.2.21/download";
      sha256 = "0glj3lxwc8358cfw9pb5dd4zr9iynzj6w2ly59nshrggsw021j75";
      name = "libc-0.2.21.tar.gz";
    };
    inherit release;
  };
  libpijul_0_5_0 = mkRustCrate {
    crateName = "libpijul";
    version = "0.5.0";
    dependencies = [ bincode_1_0_0 bitflags_0_8_2 byteorder_1_0_0 chrono_0_3_0 flate2_0_2_19 libc_0_2_21 log_0_3_7 rand_0_3_15 ring_0_7_5 rustc_serialize_0_3_23 sanakirja_0_8_5 serde_0_9_14 serde_derive_0_9_14 ];
    src = ../../pijul/libpijul;
    inherit release;
  };
  log_0_3_7 = mkRustCrate {
    crateName = "log";
    version = "0.3.7";
    features = [ "use_std" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/log/0.3.7/download";
      sha256 = "1qxrwkhpfzhgcmfnw4bl9yy7wwr92wwbin3dp6izcfy58lr369v4";
      name = "log-0.3.7.tar.gz";
    };
    inherit release;
  };
  matches_0_1_4 = mkRustCrate {
    crateName = "matches";
    version = "0.1.4";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/matches/0.1.4/download";
      sha256 = "0hwspvmc2c8zg2svqbrpsmn1bbvb4y3jq81qbg5vmniiw8p6j5zd";
      name = "matches-0.1.4.tar.gz";
    };
    libPath = "lib.rs";
    libName = "matches";
    inherit release;
  };
  maxminddb_0_7_2 = mkRustCrate {
    crateName = "maxminddb";
    version = "0.7.2";
    dependencies = [ log_0_3_7 rustc_serialize_0_3_23 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/maxminddb/0.7.2/download";
      sha256 = "052y5p4q2n3vmhpvijn6yv9iwyd8dn1rsd8504w8ixm9nq0h7d96";
      name = "maxminddb-0.7.2.tar.gz";
    };
    libPath = "src/maxminddb/lib.rs";
    libName = "maxminddb";
    inherit release;
  };
  md5_0_3_4 = mkRustCrate {
    crateName = "md5";
    version = "0.3.4";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/md5/0.3.4/download";
      sha256 = "19qxj1fm748y4g0id0iqrwa8h5fi3b9j4vw0qcp0figlk04gxm3x";
      name = "md5-0.3.4.tar.gz";
    };
    inherit release;
  };
  memchr_0_1_11 = mkRustCrate {
    crateName = "memchr";
    version = "0.1.11";
    dependencies = [ libc_0_2_21 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/memchr/0.1.11/download";
      sha256 = "0x73jghamvxxq5fsw9wb0shk5m6qp3q6fsf0nibn0i6bbqkw91s8";
      name = "memchr-0.1.11.tar.gz";
    };
    libName = "memchr";
    inherit release;
  };
  memchr_1_0_1 = mkRustCrate {
    crateName = "memchr";
    version = "1.0.1";
    dependencies = [ libc_0_2_21 ];
    features = [ "use_std" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/memchr/1.0.1/download";
      sha256 = "071m5y0zm9p1k7pzqm20f44ixvmycf71xsrpayqaypxrjwchnkxm";
      name = "memchr-1.0.1.tar.gz";
    };
    libName = "memchr";
    inherit release;
  };
  memmap_0_5_2 = mkRustCrate {
    crateName = "memmap";
    version = "0.5.2";
    dependencies = [ fs2_0_4_1 kernel32_sys_0_2_2 libc_0_2_21 winapi_0_2_8 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/memmap/0.5.2/download";
      sha256 = "16v7r23p9c5ybzljhnmps16m137v63yq18idazprysi0xhwzixm3";
      name = "memmap-0.5.2.tar.gz";
    };
    inherit release;
  };
  mime_0_2_3 = mkRustCrate {
    crateName = "mime";
    version = "0.2.3";
    dependencies = [ log_0_3_7 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/mime/0.2.3/download";
      sha256 = "1vip64kq1qmllwsfa0vblg801j5yapbhpr9bxnl4bbj3rchzw6d8";
      name = "mime-0.2.3.tar.gz";
    };
    inherit release;
  };
  mime_guess_1_8_1 = mkRustCrate {
    crateName = "mime_guess";
    version = "1.8.1";
    dependencies = [ mime_0_2_3 phf_0_7_21 phf_codegen_0_7_21 unicase_1_4_0 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/mime_guess/1.8.1/download";
      sha256 = "01y6q2hcmfj83qjyayf99qldmp8zngrn8r0mg6y0j0y92cppbcjw";
      name = "mime_guess-1.8.1.tar.gz";
    };
    build = "src/gen_mime_types.rs";
    inherit release;
  };
  miniz_sys_0_1_9 = mkRustCrate {
    crateName = "miniz-sys";
    version = "0.1.9";
    dependencies = [ gcc_0_3_45 libc_0_2_21 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/miniz-sys/0.1.9/download";
      sha256 = "09m2953zr0msq8cgk86991y4aqfvw3cxf52fx0d49jqy92nqmfmv";
      name = "miniz-sys-0.1.9.tar.gz";
    };
    libPath = "lib.rs";
    libName = "miniz_sys";
    build = "build.rs";
    inherit release;
  };
  mio_0_6_6 = mkRustCrate {
    crateName = "mio";
    version = "0.6.6";
    dependencies = [ iovec_0_1_0 kernel32_sys_0_2_2 lazycell_0_4_0 libc_0_2_21 log_0_3_7 miow_0_2_1 net2_0_2_27 slab_0_3_0 winapi_0_2_8 ];
    features = [ "with-deprecated" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/mio/0.6.6/download";
      sha256 = "1n7b93rhd8mqvsnjqxspdjd5glg6l19yxy33zppvrnxp36sikjxw";
      name = "mio-0.6.6.tar.gz";
    };
    inherit release;
  };
  miow_0_2_1 = mkRustCrate {
    crateName = "miow";
    version = "0.2.1";
    dependencies = [ kernel32_sys_0_2_2 net2_0_2_27 winapi_0_2_8 ws2_32_sys_0_2_1 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/miow/0.2.1/download";
      sha256 = "14f8zkc6ix7mkyis1vsqnim8m29b6l55abkba3p2yz7j1ibcvrl0";
      name = "miow-0.2.1.tar.gz";
    };
    inherit release;
  };
  mustache_0_8_0 = mkRustCrate {
    crateName = "mustache";
    version = "0.8.0";
    dependencies = [ log_0_3_7 rustc_serialize_0_3_23 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/mustache/0.8.0/download";
      sha256 = "06imcm31rlhfz5dwr5n07rg6b5cwmyn591rc07ssjd6vxr0h57p7";
      name = "mustache-0.8.0.tar.gz";
    };
    inherit release;
  };
  nest_0_1_0 = mkRustCrate {
    crateName = "nest";
    version = "0.1.0";
    dependencies = [ bitflags_0_8_2 byteorder_1_0_0 chrono_0_3_0 chrono_tz_0_3_2 clap_2_23_2 cryptovec_0_3_3 env_logger_0_4_2 flate2_0_2_19 fs2_0_4_1 futures_0_1_13 google_oauth_0_1_0 httpserver_0_1_0 lazy_static_0_2_8 libc_0_2_21 libpijul_0_5_0 log_0_3_7 maxminddb_0_7_2 mime_guess_1_8_1 mustache_0_8_0 net2_0_2_27 nix_0_8_1 num_cpus_1_3_0 palette_0_2_1 postgres_0_1_0 privdrop_0_1_3 pulldown_cmark_0_0_14 rand_0_3_15 regex_0_2_1 ring_0_7_5 rustc_serialize_0_3_23 rustls_0_5_8 sanakirja_0_8_5 serde_0_9_14 serde_derive_0_9_14 serde_json_0_9_10 thrussh_0_10_0 tokio_core_0_1_6 toml_0_3_2 twitter_oauth_0_1_0 url_1_4_0 uuid_0_4_0 ];
    src = ./nest.tar.gz;
    crateBin = [ {  name = "nest";  path = "src/main.rs"; } {  name = "make_help";  path = "src/make_help.rs"; } ];
    inherit release;
  };
  net2_0_2_27 = mkRustCrate {
    crateName = "net2";
    version = "0.2.27";
    dependencies = [ cfg_if_0_1_0 kernel32_sys_0_2_2 libc_0_2_21 winapi_0_2_8 ws2_32_sys_0_2_1 ];
    features = [ "duration" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/net2/0.2.27/download";
      sha256 = "1gwl55iv3yh03m48fvmgcn1m193ncfv2axg7mvrak26s1mpsb3ns";
      name = "net2-0.2.27.tar.gz";
    };
    inherit release;
  };
  nix_0_7_0 = mkRustCrate {
    crateName = "nix";
    version = "0.7.0";
    dependencies = [ bitflags_0_4_0 cfg_if_0_1_0 libc_0_2_21 rustc_version_0_1_7 semver_0_1_20 void_1_0_2 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/nix/0.7.0/download";
      sha256 = "1cqghcawn2gqip1926x40lv79b6vm5ymzi4xxncy8cqk578n5nvy";
      name = "nix-0.7.0.tar.gz";
    };
    build = "build.rs";
    inherit release;
  };
  nix_0_8_1 = mkRustCrate {
    crateName = "nix";
    version = "0.8.1";
    dependencies = [ bitflags_0_7_0 cfg_if_0_1_0 libc_0_2_21 void_1_0_2 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/nix/0.8.1/download";
      sha256 = "0iqmn55ajwcq91pl8xviwdvc2zrkaccajsp0nc9lbq9ydli0vhf9";
      name = "nix-0.8.1.tar.gz";
    };
    inherit release;
  };
  num_0_1_37 = mkRustCrate {
    crateName = "num";
    version = "0.1.37";
    dependencies = [ num_bigint_0_1_37 num_complex_0_1_37 num_integer_0_1_34 num_iter_0_1_33 num_rational_0_1_36 num_traits_0_1_37 ];
    features = [ "bigint" "complex" "rational" "rustc-serialize" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/num/0.1.37/download";
      sha256 = "156l8bxl19phb33az8bkymnyf9143j8dajq36q4galwmw6ql4d0q";
      name = "num-0.1.37.tar.gz";
    };
    inherit release;
  };
  num_bigint_0_1_37 = mkRustCrate {
    crateName = "num-bigint";
    version = "0.1.37";
    dependencies = [ num_integer_0_1_34 num_traits_0_1_37 rand_0_3_15 rustc_serialize_0_3_23 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/num-bigint/0.1.37/download";
      sha256 = "0scyqfi5azf48yyc8fhns8i1g8zq1rax155hhj9mhr0c1j6w99gs";
      name = "num-bigint-0.1.37.tar.gz";
    };
    inherit release;
  };
  num_complex_0_1_37 = mkRustCrate {
    crateName = "num-complex";
    version = "0.1.37";
    dependencies = [ num_traits_0_1_37 rustc_serialize_0_3_23 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/num-complex/0.1.37/download";
      sha256 = "1yjwh8r9qhix78ngyf7k8cnd7k7hjwm1v6m9r0h3649hap3f6nhh";
      name = "num-complex-0.1.37.tar.gz";
    };
    inherit release;
  };
  num_integer_0_1_34 = mkRustCrate {
    crateName = "num-integer";
    version = "0.1.34";
    dependencies = [ num_traits_0_1_37 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/num-integer/0.1.34/download";
      sha256 = "1i160ddy78sgih3xq9r6raqmg4s83abwbphv4cvyb1lnwsh0b318";
      name = "num-integer-0.1.34.tar.gz";
    };
    inherit release;
  };
  num_iter_0_1_33 = mkRustCrate {
    crateName = "num-iter";
    version = "0.1.33";
    dependencies = [ num_integer_0_1_34 num_traits_0_1_37 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/num-iter/0.1.33/download";
      sha256 = "1xjzf2p2vaqwknkr4s8ka5hn6cpr5rsshnydbpkn2pvapfzdrqd3";
      name = "num-iter-0.1.33.tar.gz";
    };
    inherit release;
  };
  num_rational_0_1_36 = mkRustCrate {
    crateName = "num-rational";
    version = "0.1.36";
    dependencies = [ num_bigint_0_1_37 num_integer_0_1_34 num_traits_0_1_37 rustc_serialize_0_3_23 ];
    features = [ "bigint" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/num-rational/0.1.36/download";
      sha256 = "0jibhs8xiap2wlv1xjwdvhyj4yrxwfisqbnfm53vjm5ldlijp87p";
      name = "num-rational-0.1.36.tar.gz";
    };
    inherit release;
  };
  num_traits_0_1_37 = mkRustCrate {
    crateName = "num-traits";
    version = "0.1.37";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/num-traits/0.1.37/download";
      sha256 = "0rwzfmdjq6iz6plva2gi7agvy1w9sjs7aqjh0p115w57xiix2224";
      name = "num-traits-0.1.37.tar.gz";
    };
    inherit release;
  };
  num_cpus_1_3_0 = mkRustCrate {
    crateName = "num_cpus";
    version = "1.3.0";
    dependencies = [ libc_0_2_21 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/num_cpus/1.3.0/download";
      sha256 = "0i0zm6qh932k9b67qf7f1vsczkdim5kg9qv73m7y5hhw1i781rrb";
      name = "num_cpus-1.3.0.tar.gz";
    };
    inherit release;
  };
  oauthcli_1_0_4 = mkRustCrate {
    crateName = "oauthcli";
    version = "1.0.4";
    dependencies = [ rand_0_3_15 rust_crypto_0_2_36 rustc_serialize_0_3_23 time_0_1_36 url_1_4_0 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/oauthcli/1.0.4/download";
      sha256 = "0cdllcmd0a9p24sd19x85vmqvgvkxmwqicn74bg6pds1bxxx5ina";
      name = "oauthcli-1.0.4.tar.gz";
    };
    inherit release;
  };
  palette_0_2_1 = mkRustCrate {
    crateName = "palette";
    version = "0.2.1";
    dependencies = [ approx_0_1_1 num_0_1_37 phf_0_7_21 phf_codegen_0_7_21 ];
    features = [ "named" "named_from_str" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/palette/0.2.1/download";
      sha256 = "0iw53gr05sgr40h1flwq5cfakk4kdhp7qx6aqisrjrx07g252pis";
      name = "palette-0.2.1.tar.gz";
    };
    build = "build/main.rs";
    buildDependencies = [ phf_codegen_0_0_0 ];
    inherit release;
  };
  parse_zoneinfo_0_1_0 = mkRustCrate {
    crateName = "parse-zoneinfo";
    version = "0.1.0";
    dependencies = [ regex_0_1_80 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/parse-zoneinfo/0.1.0/download";
      sha256 = "0s47si495lv6wzs2j95s6xy6pjx1nyyfhi79fc8bbh90rxdisn3w";
      name = "parse-zoneinfo-0.1.0.tar.gz";
    };
    inherit release;
  };
  phf_0_7_21 = mkRustCrate {
    crateName = "phf";
    version = "0.7.21";
    dependencies = [ phf_shared_0_7_21 ];
    features = [ "unicase" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/phf/0.7.21/download";
      sha256 = "11m2rzm2s8s35m0s97gjxxb181xz352kjlhr387xj5c8q3qp5afg";
      name = "phf-0.7.21.tar.gz";
    };
    libPath = "src/lib.rs";
    libName = "phf";
    inherit release;
  };
  phf_codegen_0_7_21 = mkRustCrate {
    crateName = "phf_codegen";
    version = "0.7.21";
    dependencies = [ phf_generator_0_7_21 phf_shared_0_7_21 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/phf_codegen/0.7.21/download";
      sha256 = "0kgy8s2q4zr0iqcm21mgq4ppc45wy6z7b5wn98xyfsrcad6lwmmj";
      name = "phf_codegen-0.7.21.tar.gz";
    };
    inherit release;
  };
  phf_generator_0_7_21 = mkRustCrate {
    crateName = "phf_generator";
    version = "0.7.21";
    dependencies = [ phf_shared_0_7_21 rand_0_3_15 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/phf_generator/0.7.21/download";
      sha256 = "1jxjfzc6d6d4l9nv0r2bb66if5brk9lnncmg4dpjjifn6zhhqd9g";
      name = "phf_generator-0.7.21.tar.gz";
    };
    inherit release;
  };
  phf_shared_0_7_21 = mkRustCrate {
    crateName = "phf_shared";
    version = "0.7.21";
    dependencies = [ siphasher_0_2_2 unicase_1_4_0 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/phf_shared/0.7.21/download";
      sha256 = "0lxpg3wgxfhzfalmf9ha9my1lsvfjy74ah9f6mfw88xlp545jlln";
      name = "phf_shared-0.7.21.tar.gz";
    };
    libPath = "src/lib.rs";
    libName = "phf_shared";
    inherit release;
  };
  postgres_0_1_0 = mkRustCrate {
    crateName = "postgres";
    version = "0.1.0";
    dependencies = [ byteorder_1_0_0 chrono_0_3_0 env_logger_0_4_2 futures_0_1_13 log_0_3_7 md5_0_3_4 tokio_core_0_1_6 tokio_io_0_1_1 uuid_0_4_0 ];
    src = ../postgres;
    inherit release;
  };
  privdrop_0_1_3 = mkRustCrate {
    crateName = "privdrop";
    version = "0.1.3";
    dependencies = [ libc_0_2_21 nix_0_7_0 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/privdrop/0.1.3/download";
      sha256 = "0n7al2952ac256rpxl3aafg0n14h6l3fjny2z0k357c5m4vllmz4";
      name = "privdrop-0.1.3.tar.gz";
    };
    inherit release;
  };
  pulldown_cmark_0_0_14 = mkRustCrate {
    crateName = "pulldown-cmark";
    version = "0.0.14";
    dependencies = [ bitflags_0_8_2 getopts_0_2_14 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/pulldown-cmark/0.0.14/download";
      sha256 = "1rqgy0wnidw9278yf3y8l72rkl483cx2yfw5c7imahsyr6kwhk5m";
      name = "pulldown-cmark-0.0.14.tar.gz";
    };
    crateBin = [ {  name = "pulldown-cmark"; } ];
    build = "build.rs";
    inherit release;
  };
  quote_0_3_15 = mkRustCrate {
    crateName = "quote";
    version = "0.3.15";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/quote/0.3.15/download";
      sha256 = "09il61jv4kd1360spaj46qwyl21fv1qz18fsv2jra8wdnlgl5jsg";
      name = "quote-0.3.15.tar.gz";
    };
    inherit release;
  };
  rand_0_3_15 = mkRustCrate {
    crateName = "rand";
    version = "0.3.15";
    dependencies = [ libc_0_2_21 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/rand/0.3.15/download";
      sha256 = "1fs30rc1xic40s1n7l3y7pxzfifpy03mgrvhy5ggp5p7zjfv3rr8";
      name = "rand-0.3.15.tar.gz";
    };
    inherit release;
  };
  rayon_0_7_0 = mkRustCrate {
    crateName = "rayon";
    version = "0.7.0";
    dependencies = [ rayon_core_1_0_0 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/rayon/0.7.0/download";
      sha256 = "102qkpni68wc9fz1hmba1z8d6pgnl86g5gdl9i3h3ilc6zjymxx7";
      name = "rayon-0.7.0.tar.gz";
    };
    inherit release;
  };
  rayon_core_1_0_0 = mkRustCrate {
    crateName = "rayon-core";
    version = "1.0.0";
    dependencies = [ deque_0_3_1 lazy_static_0_2_8 libc_0_2_21 num_cpus_1_3_0 rand_0_3_15 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/rayon-core/1.0.0/download";
      sha256 = "0gv3ysmx69r20n0ywjnqbgm802jjzgg0rly1iv1ssphgn5gg4hsh";
      name = "rayon-core-1.0.0.tar.gz";
    };
    build = "build.rs";
    inherit release;
  };
  regex_0_1_80 = mkRustCrate {
    crateName = "regex";
    version = "0.1.80";
    dependencies = [ aho_corasick_0_5_3 memchr_0_1_11 regex_syntax_0_3_9 thread_local_0_2_7 utf8_ranges_0_1_3 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/regex/0.1.80/download";
      sha256 = "0y4s8ghhx6sgzb35irwivm3w0l2hhqhmdcd2px9hirqnkagal9l6";
      name = "regex-0.1.80.tar.gz";
    };
    inherit release;
  };
  regex_0_2_1 = mkRustCrate {
    crateName = "regex";
    version = "0.2.1";
    dependencies = [ aho_corasick_0_6_3 memchr_1_0_1 regex_syntax_0_4_0 thread_local_0_3_3 utf8_ranges_1_0_0 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/regex/0.2.1/download";
      sha256 = "14dm8x4qiqx4agsgvjz7hypxb35f6zjw0h1yyrphspz5gns2fk8h";
      name = "regex-0.2.1.tar.gz";
    };
    inherit release;
  };
  regex_syntax_0_3_9 = mkRustCrate {
    crateName = "regex-syntax";
    version = "0.3.9";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/regex-syntax/0.3.9/download";
      sha256 = "1mzhphkbwppwd1zam2jkgjk550cqgf6506i87bw2yzrvcsraiw7m";
      name = "regex-syntax-0.3.9.tar.gz";
    };
    inherit release;
  };
  regex_syntax_0_4_0 = mkRustCrate {
    crateName = "regex-syntax";
    version = "0.4.0";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/regex-syntax/0.4.0/download";
      sha256 = "11dikf4mf4vba0sjf9wbwhw5n2rpviypq2d4mvlrs53mdp1cl3b6";
      name = "regex-syntax-0.4.0.tar.gz";
    };
    inherit release;
  };
  ring_0_7_5 = mkRustCrate {
    crateName = "ring";
    version = "0.7.5";
    dependencies = [ gcc_0_3_45 lazy_static_0_2_8 libc_0_2_21 rayon_0_7_0 untrusted_0_3_2 ];
    features = [ "bn_tests" "dev_urandom_fallback" "rsa_signing" "use_heap" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/ring/0.7.5/download";
      sha256 = "0n6phndms6lslagfbbg2n4z8d1sqiivnxahzb9b2bmxi01cd5qms";
      name = "ring-0.7.5.tar.gz";
    };
    libName = "ring";
    build = "build.rs";
    inherit release;
  };
  rust_crypto_0_2_36 = mkRustCrate {
    crateName = "rust-crypto";
    version = "0.2.36";
    dependencies = [ gcc_0_3_45 libc_0_2_21 rand_0_3_15 rustc_serialize_0_3_23 time_0_1_36 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/rust-crypto/0.2.36/download";
      sha256 = "1hm79xjmkyl20bx4b8ns77xbrm8wqklhqnci54n93zr6wiq3ddgi";
      name = "rust-crypto-0.2.36.tar.gz";
    };
    libName = "crypto";
    build = "build.rs";
    inherit release;
  };
  rustc_serialize_0_3_23 = mkRustCrate {
    crateName = "rustc-serialize";
    version = "0.3.23";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/rustc-serialize/0.3.23/download";
      sha256 = "0s8i928syzkj1xrsfqf04xlyi4zl37bfpzilf160gi2vhcikj0lw";
      name = "rustc-serialize-0.3.23.tar.gz";
    };
    inherit release;
  };
  rustc_version_0_1_7 = mkRustCrate {
    crateName = "rustc_version";
    version = "0.1.7";
    dependencies = [ semver_0_1_20 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/rustc_version/0.1.7/download";
      sha256 = "0plm9pbyvcwfibd0kbhzil9xmr1bvqi8fgwlfw0x4vali8s6s99p";
      name = "rustc_version-0.1.7.tar.gz";
    };
    inherit release;
  };
  rustls_0_5_8 = mkRustCrate {
    crateName = "rustls";
    version = "0.5.8";
    dependencies = [ base64_0_2_1 log_0_3_7 ring_0_7_5 time_0_1_36 untrusted_0_3_2 webpki_0_10_2 ];
    features = [ "logging" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/rustls/0.5.8/download";
      sha256 = "12jfgqfh184xglv47dbqcyg2vhm191hx7ff16i4ywi8k5fhxxy28";
      name = "rustls-0.5.8.tar.gz";
    };
    inherit release;
  };
  rustls_tokio_0_1_0 = mkRustCrate {
    crateName = "rustls-tokio";
    version = "0.1.0";
    dependencies = [ futures_0_1_13 log_0_3_7 rustls_0_5_8 tokio_core_0_1_6 tokio_io_0_1_1 ];
    src = ../google-oauth/../httpserver/../rustls-tokio;
    inherit release;
  };
  sanakirja_0_8_5 = mkRustCrate {
    crateName = "sanakirja";
    version = "0.8.5";
    dependencies = [ fs2_0_4_1 log_0_3_7 memmap_0_5_2 rand_0_3_15 rustc_serialize_0_3_23 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/sanakirja/0.8.5/download";
      sha256 = "1wpyfvl3p8w53bp4ihwn031zszqs4yb8rpzyp63002r925kf1xah";
      name = "sanakirja-0.8.5.tar.gz";
    };
    inherit release;
  };
  scoped_tls_0_1_0 = mkRustCrate {
    crateName = "scoped-tls";
    version = "0.1.0";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/scoped-tls/0.1.0/download";
      sha256 = "1j8azxa15srljafrg7wc221npvxb3700sbfk6jjav0rw2zclsnf5";
      name = "scoped-tls-0.1.0.tar.gz";
    };
    inherit release;
  };
  semver_0_1_20 = mkRustCrate {
    crateName = "semver";
    version = "0.1.20";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/semver/0.1.20/download";
      sha256 = "05cdig0071hls2k8lxbqmyqpl0zjmc53i2d43mwzps033b8njh4n";
      name = "semver-0.1.20.tar.gz";
    };
    inherit release;
  };
  serde_0_9_14 = mkRustCrate {
    crateName = "serde";
    version = "0.9.14";
    features = [ "std" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/serde/0.9.14/download";
      sha256 = "1yqb6g5950qchhhhx5fgr4bgvfjam1if22qi8yvam7xkicazp5x5";
      name = "serde-0.9.14.tar.gz";
    };
    inherit release;
  };
  serde_codegen_internals_0_14_2 = mkRustCrate {
    crateName = "serde_codegen_internals";
    version = "0.14.2";
    dependencies = [ syn_0_11_10 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/serde_codegen_internals/0.14.2/download";
      sha256 = "1v7kbxfhg42nmxwbchd6wgp1b3q5xfay3vii4f4jf0h1grn8mr9r";
      name = "serde_codegen_internals-0.14.2.tar.gz";
    };
    inherit release;
  };
  serde_derive_0_9_14 = mkRustCrate {
    crateName = "serde_derive";
    version = "0.9.14";
    dependencies = [ quote_0_3_15 serde_codegen_internals_0_14_2 syn_0_11_10 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/serde_derive/0.9.14/download";
      sha256 = "0qq71qmc5vii8yccjg6zx2y2qrn2zlawv8jv8jdw98qd4xw493qv";
      name = "serde_derive-0.9.14.tar.gz";
    };
    libName = "serde_derive";
    procMacro = true;
    inherit release;
  };
  serde_json_0_9_10 = mkRustCrate {
    crateName = "serde_json";
    version = "0.9.10";
    dependencies = [ dtoa_0_4_1 itoa_0_3_1 num_traits_0_1_37 serde_0_9_14 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/serde_json/0.9.10/download";
      sha256 = "0g6bxlfnvf2miicnsizyrxm686rfval6gbss1i2qcna8msfwc005";
      name = "serde_json-0.9.10.tar.gz";
    };
    inherit release;
  };
  siphasher_0_2_2 = mkRustCrate {
    crateName = "siphasher";
    version = "0.2.2";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/siphasher/0.2.2/download";
      sha256 = "0iyx7nlzfny9ly1634a6zcq0yvrinhxhypwas4p8ry3zqnn76qqr";
      name = "siphasher-0.2.2.tar.gz";
    };
    inherit release;
  };
  slab_0_3_0 = mkRustCrate {
    crateName = "slab";
    version = "0.3.0";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/slab/0.3.0/download";
      sha256 = "0y6lhjggksh57hyfd3l6p9wgv5nhvw9c6djrysq7jnalz8fih21k";
      name = "slab-0.3.0.tar.gz";
    };
    inherit release;
  };
  strsim_0_6_0 = mkRustCrate {
    crateName = "strsim";
    version = "0.6.0";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/strsim/0.6.0/download";
      sha256 = "1lz85l6y68hr62lv4baww29yy7g8pg20dlr0lbaswxmmcb0wl7gd";
      name = "strsim-0.6.0.tar.gz";
    };
    inherit release;
  };
  syn_0_11_10 = mkRustCrate {
    crateName = "syn";
    version = "0.11.10";
    dependencies = [ quote_0_3_15 synom_0_11_3 unicode_xid_0_0_4 ];
    features = [ "parsing" "printing" "visit" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/syn/0.11.10/download";
      sha256 = "1p2yyg4vjmhrh281bcm0fg91n3jhrj27scfgsgb4icssm8dwrglh";
      name = "syn-0.11.10.tar.gz";
    };
    inherit release;
  };
  synom_0_11_3 = mkRustCrate {
    crateName = "synom";
    version = "0.11.3";
    dependencies = [ unicode_xid_0_0_4 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/synom/0.11.3/download";
      sha256 = "1l6d1s9qjfp6ng2s2z8219igvlv7gyk8gby97sdykqc1r93d8rhc";
      name = "synom-0.11.3.tar.gz";
    };
    inherit release;
  };
  term_size_0_3_0 = mkRustCrate {
    crateName = "term_size";
    version = "0.3.0";
    dependencies = [ kernel32_sys_0_2_2 libc_0_2_21 winapi_0_2_8 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/term_size/0.3.0/download";
      sha256 = "054d5avad49sy5nfaaaphai4kv4rmdh6q0npchnvdhpxp02lcfhs";
      name = "term_size-0.3.0.tar.gz";
    };
    inherit release;
  };
  thread_id_2_0_0 = mkRustCrate {
    crateName = "thread-id";
    version = "2.0.0";
    dependencies = [ kernel32_sys_0_2_2 libc_0_2_21 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/thread-id/2.0.0/download";
      sha256 = "06i3c8ckn97i5rp16civ2vpqbknlkx66dkrl070iw60nawi0kjc3";
      name = "thread-id-2.0.0.tar.gz";
    };
    inherit release;
  };
  thread_id_3_0_0 = mkRustCrate {
    crateName = "thread-id";
    version = "3.0.0";
    dependencies = [ kernel32_sys_0_2_2 libc_0_2_21 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/thread-id/3.0.0/download";
      sha256 = "0c6mc42ykli0jipdijhnlyz44jpwnbwmdrzvn9salwaywpqljf5d";
      name = "thread-id-3.0.0.tar.gz";
    };
    inherit release;
  };
  thread_local_0_2_7 = mkRustCrate {
    crateName = "thread_local";
    version = "0.2.7";
    dependencies = [ thread_id_2_0_0 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/thread_local/0.2.7/download";
      sha256 = "19p0zrs24rdwjvpi10jig5ms3sxj00pv8shkr9cpddri8cdghqp7";
      name = "thread_local-0.2.7.tar.gz";
    };
    inherit release;
  };
  thread_local_0_3_3 = mkRustCrate {
    crateName = "thread_local";
    version = "0.3.3";
    dependencies = [ thread_id_3_0_0 unreachable_0_1_1 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/thread_local/0.3.3/download";
      sha256 = "1wynchya4z2hhcxjk5wdb61hni64dka7ivn3i3l7kn9ayw74nf5d";
      name = "thread_local-0.3.3.tar.gz";
    };
    inherit release;
  };
  thrussh_0_10_0 = mkRustCrate {
    crateName = "thrussh";
    version = "0.10.0";
    dependencies = [ arrayref_0_3_3 bitflags_0_7_0 byteorder_1_0_0 cryptovec_0_3_3 env_logger_0_3_5 futures_0_1_13 log_0_3_7 ring_0_7_5 rustc_serialize_0_3_23 tokio_core_0_1_6 untrusted_0_3_2 ];
    src = ../../thrussh;
    inherit release;
  };
  time_0_1_36 = mkRustCrate {
    crateName = "time";
    version = "0.1.36";
    dependencies = [ kernel32_sys_0_2_2 libc_0_2_21 winapi_0_2_8 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/time/0.1.36/download";
      sha256 = "16202ihqbjhha0npv6v0wd69pz65gz8mwkj9yd6dwjqb9lm2mib5";
      name = "time-0.1.36.tar.gz";
    };
    inherit release;
  };
  tokio_core_0_1_6 = mkRustCrate {
    crateName = "tokio-core";
    version = "0.1.6";
    dependencies = [ bytes_0_4_2 futures_0_1_13 iovec_0_1_0 log_0_3_7 mio_0_6_6 scoped_tls_0_1_0 slab_0_3_0 tokio_io_0_1_1 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/tokio-core/0.1.6/download";
      sha256 = "025cq04jvd0zfbj8q2iz6friwklsa00jhfhm3y0qdajm6kivdjf8";
      name = "tokio-core-0.1.6.tar.gz";
    };
    inherit release;
  };
  tokio_io_0_1_1 = mkRustCrate {
    crateName = "tokio-io";
    version = "0.1.1";
    dependencies = [ bytes_0_4_2 futures_0_1_13 log_0_3_7 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/tokio-io/0.1.1/download";
      sha256 = "1psznw63pkxszjn86kskqirmwdrk7qpcrmiqcjm56hj2v3ghbkjs";
      name = "tokio-io-0.1.1.tar.gz";
    };
    inherit release;
  };
  toml_0_3_2 = mkRustCrate {
    crateName = "toml";
    version = "0.3.2";
    dependencies = [ serde_0_9_14 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/toml/0.3.2/download";
      sha256 = "0fnfszhijk085j5pfwddkjmg49wcbng5hkzl6avh7s0wxdcph4hq";
      name = "toml-0.3.2.tar.gz";
    };
    inherit release;
  };
  twitter_oauth_0_1_0 = mkRustCrate {
    crateName = "twitter-oauth";
    version = "0.1.0";
    dependencies = [ cryptovec_0_3_3 env_logger_0_4_2 futures_0_1_13 httpserver_0_1_0 lazy_static_0_2_8 log_0_3_7 oauthcli_1_0_4 regex_0_2_1 serde_0_9_14 serde_derive_0_9_14 serde_json_0_9_10 tokio_core_0_1_6 url_1_4_0 ];
    src = ../twitter-oauth;
    inherit release;
  };
  unicase_1_4_0 = mkRustCrate {
    crateName = "unicase";
    version = "1.4.0";
    dependencies = [ rustc_version_0_1_7 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/unicase/1.4.0/download";
      sha256 = "1vlpcls8b1cf65s3mrkgmaf6gq98xbg5qm3ik185c1x62hvyjdwx";
      name = "unicase-1.4.0.tar.gz";
    };
    build = "build.rs";
    inherit release;
  };
  unicode_bidi_0_2_5 = mkRustCrate {
    crateName = "unicode-bidi";
    version = "0.2.5";
    dependencies = [ matches_0_1_4 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/unicode-bidi/0.2.5/download";
      sha256 = "0nsfs9289iy1sijzb7n8g1bfjj1hjijjlgp6xqsjljvzqj0pw2q1";
      name = "unicode-bidi-0.2.5.tar.gz";
    };
    libName = "unicode_bidi";
    inherit release;
  };
  unicode_normalization_0_1_4 = mkRustCrate {
    crateName = "unicode-normalization";
    version = "0.1.4";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/unicode-normalization/0.1.4/download";
      sha256 = "0917k162n24226ygsiylcwdik6d8f6cbcs46nb24vs55nf567wdj";
      name = "unicode-normalization-0.1.4.tar.gz";
    };
    inherit release;
  };
  unicode_segmentation_1_1_0 = mkRustCrate {
    crateName = "unicode-segmentation";
    version = "1.1.0";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/unicode-segmentation/1.1.0/download";
      sha256 = "10hk7wy0217jwdbp27p36skwkig5lbhk482yfzij9m87h247rry0";
      name = "unicode-segmentation-1.1.0.tar.gz";
    };
    inherit release;
  };
  unicode_width_0_1_4 = mkRustCrate {
    crateName = "unicode-width";
    version = "0.1.4";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/unicode-width/0.1.4/download";
      sha256 = "1rp7a04icn9y5c0lm74nrd4py0rdl0af8bhdwq7g478n1xifpifl";
      name = "unicode-width-0.1.4.tar.gz";
    };
    inherit release;
  };
  unicode_xid_0_0_4 = mkRustCrate {
    crateName = "unicode-xid";
    version = "0.0.4";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/unicode-xid/0.0.4/download";
      sha256 = "1dc8wkkcd3s6534s5aw4lbjn8m67flkkbnajp5bl8408wdg8rh9v";
      name = "unicode-xid-0.0.4.tar.gz";
    };
    inherit release;
  };
  unreachable_0_1_1 = mkRustCrate {
    crateName = "unreachable";
    version = "0.1.1";
    dependencies = [ void_1_0_2 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/unreachable/0.1.1/download";
      sha256 = "12nkmw2a491xwrn6shpbfbd648srhcfnaqy2hhw5mqrzpz7rdqmb";
      name = "unreachable-0.1.1.tar.gz";
    };
    inherit release;
  };
  untrusted_0_3_2 = mkRustCrate {
    crateName = "untrusted";
    version = "0.3.2";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/untrusted/0.3.2/download";
      sha256 = "0zhna9m8q1wvxcx5zj3smibh0f232r2xw0ajg55bw8r564g26lmp";
      name = "untrusted-0.3.2.tar.gz";
    };
    libName = "untrusted";
    inherit release;
  };
  url_1_4_0 = mkRustCrate {
    crateName = "url";
    version = "1.4.0";
    dependencies = [ idna_0_1_1 matches_0_1_4 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/url/1.4.0/download";
      sha256 = "1qvfzld53lb3kgsn9bg9rvrv55zykq61wxfva1hgc8mdd4k5172w";
      name = "url-1.4.0.tar.gz";
    };
    inherit release;
  };
  utf8_ranges_0_1_3 = mkRustCrate {
    crateName = "utf8-ranges";
    version = "0.1.3";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/utf8-ranges/0.1.3/download";
      sha256 = "1cj548a91a93j8375p78qikaiam548xh84cb0ck8y119adbmsvbp";
      name = "utf8-ranges-0.1.3.tar.gz";
    };
    inherit release;
  };
  utf8_ranges_1_0_0 = mkRustCrate {
    crateName = "utf8-ranges";
    version = "1.0.0";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/utf8-ranges/1.0.0/download";
      sha256 = "0rzmqprwjv9yp1n0qqgahgm24872x6c0xddfym5pfndy7a36vkn0";
      name = "utf8-ranges-1.0.0.tar.gz";
    };
    inherit release;
  };
  uuid_0_4_0 = mkRustCrate {
    crateName = "uuid";
    version = "0.4.0";
    dependencies = [ rand_0_3_15 rustc_serialize_0_3_23 serde_0_9_14 ];
    features = [ "v4" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/uuid/0.4.0/download";
      sha256 = "1fzgp3ayz7g5zx4gvxkxxm9jkrllj5qlvlyp6r2an0wyqm2y9qlh";
      name = "uuid-0.4.0.tar.gz";
    };
    inherit release;
  };
  vec_map_0_7_0 = mkRustCrate {
    crateName = "vec_map";
    version = "0.7.0";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/vec_map/0.7.0/download";
      sha256 = "0jawvi83b1nm101nam0w71kdyh7cy3fr0l9qj1hfcjvzvihfk2l1";
      name = "vec_map-0.7.0.tar.gz";
    };
    inherit release;
  };
  void_1_0_2 = mkRustCrate {
    crateName = "void";
    version = "1.0.2";
    features = [ "std" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/void/1.0.2/download";
      sha256 = "0h1dm0dx8dhf56a83k68mijyxigqhizpskwxfdrs1drwv2cdclv3";
      name = "void-1.0.2.tar.gz";
    };
    inherit release;
  };
  webpki_0_10_2 = mkRustCrate {
    crateName = "webpki";
    version = "0.10.2";
    dependencies = [ ring_0_7_5 rustc_serialize_0_3_23 time_0_1_36 untrusted_0_3_2 ];
    features = [ "trust_anchor_util" ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/webpki/0.10.2/download";
      sha256 = "171jl3l20x85hjnaadfza3c99bba528qbkjp56ksgdxl1gyzkdgl";
      name = "webpki-0.10.2.tar.gz";
    };
    libPath = "src/webpki.rs";
    libName = "webpki";
    inherit release;
  };
  webpki_roots_0_7_0 = mkRustCrate {
    crateName = "webpki-roots";
    version = "0.7.0";
    dependencies = [ untrusted_0_3_2 webpki_0_10_2 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/webpki-roots/0.7.0/download";
      sha256 = "1f81hs8if4yw9lnv4550hw9jqljvavjzfsyzbp7mpni7w9v0jraj";
      name = "webpki-roots-0.7.0.tar.gz";
    };
    inherit release;
  };
  winapi_0_2_8 = mkRustCrate {
    crateName = "winapi";
    version = "0.2.8";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/winapi/0.2.8/download";
      sha256 = "0a45b58ywf12vb7gvj6h3j264nydynmzyqz8d8rqxsj6icqv82as";
      name = "winapi-0.2.8.tar.gz";
    };
    inherit release;
  };
  winapi_build_0_1_1 = mkRustCrate {
    crateName = "winapi-build";
    version = "0.1.1";
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/winapi-build/0.1.1/download";
      sha256 = "1lxlpi87rkhxcwp2ykf1ldw3p108hwm24nywf3jfrvmff4rjhqga";
      name = "winapi-build-0.1.1.tar.gz";
    };
    libName = "build";
    inherit release;
  };
  ws2_32_sys_0_2_1 = mkRustCrate {
    crateName = "ws2_32-sys";
    version = "0.2.1";
    dependencies = [ winapi_0_2_8 winapi_build_0_1_1 ];
    src = fetchzip {
      url = "https://crates.io/api/v1/crates/ws2_32-sys/0.2.1/download";
      sha256 = "1zpy9d9wk11sj17fczfngcj28w4xxjs3b4n036yzpy38dxp4f7kc";
      name = "ws2_32-sys-0.2.1.tar.gz";
    };
    libName = "ws2_32";
    build = "build.rs";
    buildDependencies = [ winapi_build_0_0_0 ];
    inherit release;
  };
}

@Mic92 Mic92 mentioned this pull request May 5, 2017
@8573
Copy link
Contributor

8573 commented May 5, 2017

@P-E-Meunier I suggest you wrap the very long code block in the <details> tag (the syntax of which is like this: https://bpaste.net/show/b70fed4cf128).

@P-E-Meunier
Copy link
Contributor Author

Done.

@FlorentBecker
Copy link
Contributor

FlorentBecker commented May 31, 2017

That's very cool! I think it would be more in line with the rest of nixpkgs and more usable in that context (as opposed to outside the nixpkgs tree) if, instead of using

crates = rec {
   foo_0_1_0 = {
      dependencies = [ bar_0_2 baz_0_1_0];
      …
   };

   bar_0_2 = {…};
   baz_0_1_0 = {…};
}

each crate was defined as a function of its dependencies, and then the knot was tied later:

let foo_0_1_0_ = {bar, baz}:
    { dependencies = [bar baz];
      …
    };

    bar_0_2_ = {…}: {…};
    baz_0_1_0_ = …;
in
rec {
    foo_0_1_0 = foo_0_1_0_ {bar = bar_0_2; baz = baz_0_1_0};
    bar_0_2 = bar_0_2_ {…};
}

This would allow to have several version of the same crate with different dependencies, which is necessary when building stuff from more than one Cargo.lock. If the foo_0_1_0_ functions are defined in separate .nix files, then callPackage can make the "linking" part less painful, there's probably a way with a let … in … too, but I don't know how.

I think the way forward is to convert the packages that can be built with it to mkRustCrate, and keep buildRustPackages if some packages do need the more advanced features of cargo.

@P-E-Meunier
Copy link
Contributor Author

This could certainly be done. How would it look like in your example if foo_0_1_0 depended on several versions of bar?

@FlorentBecker
Copy link
Contributor

FlorentBecker commented Jun 1, 2017

I'm not sure I understand your question (I think cargo avoids having indirect dependencies with different versions for one crate), but here is an example of how it eliminates duplication in the case where we are introducing derivations for two different crates, foo and toto. The Cargo.lock files of foo and toto look like this:

foo 0.1.0 ---dep---> bar 0.2 ---dep---> baz 0.2
toto 0.1.0 ---dep---> titi 0.3 ---dep---> baz 0.1
toto 0.1.0 ---dep---> bar 0.2 ---dep---> baz 0.1

This is typically the case if titi depends on baz 0.1 and all other dependencies are '*' and get resolved to the latest version.

Then you would have:

let
  foo_0_1_0_ = {bar}: {…; dependencies = [ bar ]; …};
  toto_0_1_0_ = {titi, bar}: {…; dependencies = [ titi bar ]; …};
  let bar_0_2_ = {baz}: {…; dependencies = [ baz ];…};
  let baz_0_1 = {…};
  let baz_0_2 = {…};
in
rec {
   foo_0_1_0 = foo_0_1_0_ { bar = bar_0_2 };
   toto_0_1_0 = toto_0_1_0_ { bar = bar_0_2_ {baz = baz_0_1} };
   bar_0_2 = bar_0_2_ { baz = baz_0_2 };
   inherit baz_0_1 baz_0_2;
}

Again, the function calls in the 'rec {}' can be made less verbose through callPackage.

Note that this does not bring anything from the point of view of nix avoiding recompilations (your solution is already as good as possible from that point of view), it just makes the code cleaner for a collection of packages.

of them must be open using the firewall module.
'';
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this belongs in this PR. I wonder where it's coming from 😋

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@FlorentBecker
Copy link
Contributor

65009f2 should probably be rebased out of this PR

@P-E-Meunier
Copy link
Contributor Author

Cargo "does its best to avoid different version of the same indirect dependency", but cannot always avoid it.

Your comment answers my question I guess. I'll try to implement that soon.

@FlorentBecker
Copy link
Contributor

Any news about the "let … in rec {…}" solution? I'm eager to try and port at least some rust packages to mkRustCrate, but I don't want to short-cut something you're doing.

@P-E-Meunier
Copy link
Contributor Author

I'm not working on it right now, but it's definitely on my todo-list.

@P-E-Meunier
Copy link
Contributor Author

Hi! Look at the new output format of the script that produces nix files. The source of everything is still at the same place:

https://nest.pijul.com/pmeunier/nix-rust

I agree that crates from crates.io can now be packaged into nix.
Something needs to be written to maintain an updated version of all packages on crates.io. Maybe in an overlay, to avoid automatic commits?

with import <nixpkgs> {};
let release = true;
    verbose = true;
    aho_corasick_0_6_3_ = { dependencies?[], features?[] }: mkRustCrate {
      crateName = "aho-corasick";
      version = "0.6.3";
      src = fetchzip {
        url = "https://crates.io/api/v1/crates/aho-corasick/0.6.3/download";
        sha256 = "1cpqzf6acj8lm06z3f1cg41wn6c2n9l3v49nh0dvimv4055qib6k";
        name = "aho-corasick-0.6.3.tar.gz";
      };
      libName = "aho_corasick";
      crateBin = [ {  name = "aho-corasick-dot"; } ];
      inherit dependencies features release verbose;
    };
    env_logger_0_4_3_ = { dependencies?[], features?[] }: mkRustCrate {
      crateName = "env_logger";
      version = "0.4.3";
      src = fetchzip {
        url = "https://crates.io/api/v1/crates/env_logger/0.4.3/download";
        sha256 = "0nrx04p4xa86d5kc7aq4fwvipbqji9cmgy449h47nc9f1chafhgg";
        name = "env_logger-0.4.3.tar.gz";
      };
      inherit dependencies features release verbose;
    };
    lazy_static_0_2_8_ = { dependencies?[], features?[] }: mkRustCrate {
      crateName = "lazy_static";
      version = "0.2.8";
      src = fetchzip {
        url = "https://crates.io/api/v1/crates/lazy_static/0.2.8/download";
        sha256 = "1xbpxx7cd5kl60g87g43q80jxyrsildhxfjc42jb1x4jncknpwbl";
        name = "lazy_static-0.2.8.tar.gz";
      };
      inherit dependencies features release verbose;
    };
    libc_0_2_29_ = { dependencies?[], features?[] }: mkRustCrate {
      crateName = "libc";
      version = "0.2.29";
      src = fetchzip {
        url = "https://crates.io/api/v1/crates/libc/0.2.29/download";
        sha256 = "1h1mbhr3n6m40img43x7adh521g2475zg0hqvkgjkv9snbknsrhh";
        name = "libc-0.2.29.tar.gz";
      };
      inherit dependencies features release verbose;
    };
    log_0_3_8_ = { dependencies?[], features?[] }: mkRustCrate {
      crateName = "log";
      version = "0.3.8";
      src = fetchzip {
        url = "https://crates.io/api/v1/crates/log/0.3.8/download";
        sha256 = "1c43z4z85sxrsgir4s1hi84558ab5ic7jrn5qgmsiqcv90vvn006";
        name = "log-0.3.8.tar.gz";
      };
      inherit dependencies features release verbose;
    };
    memchr_1_0_1_ = { dependencies?[], features?[] }: mkRustCrate {
      crateName = "memchr";
      version = "1.0.1";
      src = fetchzip {
        url = "https://crates.io/api/v1/crates/memchr/1.0.1/download";
        sha256 = "071m5y0zm9p1k7pzqm20f44ixvmycf71xsrpayqaypxrjwchnkxm";
        name = "memchr-1.0.1.tar.gz";
      };
      libName = "memchr";
      inherit dependencies features release verbose;
    };
    nix_test_0_1_0_ = { dependencies?[], features?[] }: mkRustCrate {
      crateName = "nix-test";
      version = "0.1.0";
      src = ../nix-test;
      inherit dependencies features release verbose;
    };
    regex_0_2_2_ = { dependencies?[], features?[] }: mkRustCrate {
      crateName = "regex";
      version = "0.2.2";
      src = fetchzip {
        url = "https://crates.io/api/v1/crates/regex/0.2.2/download";
        sha256 = "1f1zrrynfylg0vcfyfp60bybq4rp5g1yk2k7lc7fyz7mmc7k2qr7";
        name = "regex-0.2.2.tar.gz";
      };
      inherit dependencies features release verbose;
    };
    regex_syntax_0_4_1_ = { dependencies?[], features?[] }: mkRustCrate {
      crateName = "regex-syntax";
      version = "0.4.1";
      src = fetchzip {
        url = "https://crates.io/api/v1/crates/regex-syntax/0.4.1/download";
        sha256 = "01yrsm68lj86ad1whgg1z95c2pfsvv58fz8qjcgw7mlszc0c08ls";
        name = "regex-syntax-0.4.1.tar.gz";
      };
      inherit dependencies features release verbose;
    };
    thread_local_0_3_4_ = { dependencies?[], features?[] }: mkRustCrate {
      crateName = "thread_local";
      version = "0.3.4";
      src = fetchzip {
        url = "https://crates.io/api/v1/crates/thread_local/0.3.4/download";
        sha256 = "1y6cwyhhx2nkz4b3dziwhqdvgq830z8wjp32b40pjd8r0hxqv2jr";
        name = "thread_local-0.3.4.tar.gz";
      };
      inherit dependencies features release verbose;
    };
    unreachable_1_0_0_ = { dependencies?[], features?[] }: mkRustCrate {
      crateName = "unreachable";
      version = "1.0.0";
      src = fetchzip {
        url = "https://crates.io/api/v1/crates/unreachable/1.0.0/download";
        sha256 = "1am8czbk5wwr25gbp2zr007744fxjshhdqjz9liz7wl4pnv3whcf";
        name = "unreachable-1.0.0.tar.gz";
      };
      inherit dependencies features release verbose;
    };
    utf8_ranges_1_0_0_ = { dependencies?[], features?[] }: mkRustCrate {
      crateName = "utf8-ranges";
      version = "1.0.0";
      src = fetchzip {
        url = "https://crates.io/api/v1/crates/utf8-ranges/1.0.0/download";
        sha256 = "0rzmqprwjv9yp1n0qqgahgm24872x6c0xddfym5pfndy7a36vkn0";
        name = "utf8-ranges-1.0.0.tar.gz";
      };
      inherit dependencies features release verbose;
    };
    void_1_0_2_ = { dependencies?[], features?[] }: mkRustCrate {
      crateName = "void";
      version = "1.0.2";
      src = fetchzip {
        url = "https://crates.io/api/v1/crates/void/1.0.2/download";
        sha256 = "0h1dm0dx8dhf56a83k68mijyxigqhizpskwxfdrs1drwv2cdclv3";
        name = "void-1.0.2.tar.gz";
      };
      inherit dependencies features release verbose;
    };

in
rec {
  aho_corasick_0_6_3 = aho_corasick_0_6_3_ {
    dependencies = [ memchr_1_0_1 ];
  };
  env_logger_0_4_3 = env_logger_0_4_3_ {
    dependencies = [ log_0_3_8 regex_0_2_2 ];
    features = [ "regex" ];
  };
  lazy_static_0_2_8 = lazy_static_0_2_8_ {};
  libc_0_2_29 = libc_0_2_29_ {
    features = [ "use_std" ];
  };
  log_0_3_8 = log_0_3_8_ {
    features = [ "use_std" ];
  };
  memchr_1_0_1 = memchr_1_0_1_ {
    dependencies = [ libc_0_2_29 ];
    features = [ "use_std" ];
  };
  nix_test_0_1_0 = nix_test_0_1_0_ {
    dependencies = [ env_logger_0_4_3 log_0_3_8 ];
  };
  regex_0_2_2 = regex_0_2_2_ {
    dependencies = [ aho_corasick_0_6_3 memchr_1_0_1 regex_syntax_0_4_1 thread_local_0_3_4 utf8_ranges_1_0_0 ];
  };
  regex_syntax_0_4_1 = regex_syntax_0_4_1_ {};
  thread_local_0_3_4 = thread_local_0_3_4_ {
    dependencies = [ lazy_static_0_2_8 unreachable_1_0_0 ];
  };
  unreachable_1_0_0 = unreachable_1_0_0_ {
    dependencies = [ void_1_0_2 ];
  };
  utf8_ranges_1_0_0 = utf8_ranges_1_0_0_ {};
  void_1_0_2 = void_1_0_2_ {
    features = [ "std" ];
  };
}

@sjmackenzie
Copy link
Contributor

sjmackenzie commented Aug 31, 2017

It would be very convenient if 2 things happened to generate-nix-pkg (via cli argument or not)

  1. The top line of the generated output is this: with import <nixpkgs> {}; it would be better if it was: { mkRustCrate fetchzip }:
    This allows the generated output to be used without including the whole nixpkgs, most likely the generated code would be used as part of a larger project so <nixpkgs> will be included elsewhere. Also I'll be making changes to mkRustCrate so this way I can select exactly which mkRustCrate is pulled in.

  2. For every crate derivation an indirection is introduced, for example include a line libc = libc_0_2_29 {}; where libc always points to the latest libc_x_x_x derivation in the generated set.
    This allows projects to say they want to always have the latest crate derivation, which localizes maintenance to just generating the nix output and running a test to see that things still build/work.
    In the case the latest crate derivation doesn't work one can default to an explicitly versioned crate derivation.

my 2c worth.

Really love this work, kudos!

@sjmackenzie
Copy link
Contributor

sjmackenzie commented Aug 31, 2017

Also one dirty hack I'm exploring is making only one generate-nix-pkg generation for every rust project that needs a subset of crate derivations.

The master toml file would look something like this:

[lib]

[package]
name = "all_crates"
version = "0.0.0"

[dependencies]
capnp = "*"
nom = "*"
iron = "*"
mount = "*"
staticfile= "*"
# add more crates as needed

The above is the minimal needed information in order to run cargo generate-lockfile.

This allows users to pull in the latest crate derivations where needed (in combination with the above xxx = xxx_y_y_y {}; indirection feature).

One downside to this approach is that you cannot include duplicate crate names in a Cargo.toml file. So:

capnp = "*"
capnp = "0.8.10"
capnp = "0.8.9"

will not work.

@sjmackenzie
Copy link
Contributor

sjmackenzie commented Sep 1, 2017

For anyone who might want those feature requests which could help integrating this into nixpkgs easier here you go: https://nest.pijul.com/sjmackenzie/nix-rust

@vitiral
Copy link
Contributor

vitiral commented Sep 5, 2017

@sjmackenzie the link you just posted seems to be broken.

@sjmackenzie
Copy link
Contributor

@vitiral there was a problem with nest.pijul.com @P-E-Meunier has resolved it. See my amended comment above.

@sjmackenzie
Copy link
Contributor

sjmackenzie commented Sep 13, 2017

@P-E-Meunier is there an associated change for generate-nix-pkg rust code? It would seem you've managed to run an executable that has a crate with build-dependencies. I'm probably getting similar issues as your backtrace-sys crate when running a binary that has the libsqlite3-sys crate.

namely:

thread '<unnamed>' panicked at 'cannot load: Error { repr: Custom(Custom { kind: Other, error: StringError("/nix/store/r471jgziyzl63sjmw3ghps1610isg0ya-rs_sqlite_get/lib/libagent.so: undefined symbol: sqlite3_bind_int64") }) }', /checkout/src/libcore/result.rs:906:4

@sjmackenzie
Copy link
Contributor

Nice one! Look forward to trying this out.

@P-E-Meunier
Copy link
Contributor Author

Can I do anything more to get this PR to be merged?

@sjmackenzie
Copy link
Contributor

@peti @qknight

@qknight
Copy link
Member

qknight commented Nov 2, 2017

@sjmackenzie the patch conflicts, needs fix from you before we can merge. also please provide a way we can test this PR. or document how it can be used.

@P-E-Meunier
Copy link
Contributor Author

That's assuming I know enough Git and GitHub to get my old branch back (I've deleted the repository where I produced it a while ago).

So, I've added the latest version as #31150. It can compile everything I've needed so far, including tricky crates such as *ring* and (since recently) OpenSSL.

@P-E-Meunier P-E-Meunier closed this Nov 2, 2017
@qknight
Copy link
Member

qknight commented Nov 2, 2017

@P-E-Meunier i'm confused, don't you want that code in nixpkgs?

@sjmackenzie
Copy link
Contributor

Na mate, he deleted his old branch and being sufficiently unfamiliarity with git and github (he's the author of pijul that's his lingua franca :-) ). So he decided to start on a fresh branch #31150 (adding docs etc). That's the code that'll merge into nixpkgs.

@P-E-Meunier
Copy link
Contributor Author

I do want that code in nixpkgs, but this branch was several months old and I've been adding lots of custom stuff to my nixpkgs, so that I couldn't fix the conflict. However, the exact same code is in #31150, it has no conflicts with the current nixpkgs. Maybe this time it will make it ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants