Skip to content

Instantly share code, notes, and snippets.

@boxofrox
Last active November 20, 2017 17:37
Show Gist options
  • Save boxofrox/9cc1a26e3d63a6183d07b0e7adbcfff4 to your computer and use it in GitHub Desktop.
Save boxofrox/9cc1a26e3d63a6183d07b0e7adbcfff4 to your computer and use it in GitHub Desktop.
carnix bug: example: missing cargo environment variables for compiling http-box crate
# ~/.config/nixpkgs/overlays/crates-overlay.nix
self: super:
{
rustHttpBox = super.callPackage ./crates/httpbox.nix { };
}
$ nix-env -f ~/nixpkgs -iA rustHttpBox
installing ‘rust_bitflags-0.5.0’
installing ‘rust_byte-slice-0.1.12’
installing ‘rust_getopts-0.2.14’
installing ‘rust_http-box-0.1.5’
installing ‘rust_libc-0.2.24’
installing ‘rust_pulldown-cmark-0.0.8’
installing ‘rust_rand-0.3.15’
installing ‘rust_skeptic-0.7.1’
installing ‘rust_tempdir-0.3.5’
these derivations will be built:
/nix/store/2xmn0ydz0inzlz7cvw8k4lnvjwfzg3ai-rust_http-box-0.1.5.drv
building path(s) ‘/nix/store/0lw68c2c3v8g3rmyhpqiqsf7yi239gvm-rust_http-box-0.1.5’
unpacking sources
unpacking source archive /nix/store/41cbak4bc06yvbzbp7zidqdcvyl3rxps-http-box-0.1.5.tar.gz
source root is http-box-0.1.5.tar.gz
patching sources
configuring
no configure script, doing nothing
building
Building build.rs (http-box)
/nix/store/xjnqfxdc7b7mm7g4y1y9gd9rlmiky3r8-stdenv/setup: line 1121: 1: command not found
Building src/lib.rs (http-box)
/nix/store/xjnqfxdc7b7mm7g4y1y9gd9rlmiky3r8-stdenv/setup: line 1178: 1: command not found
error: environment variable `CARGO_PKG_VERSION_MAJOR` not defined
--> src/lib.rs:41:41
|
41 | pub const VERSION_MAJOR: &'static str = env!("CARGO_PKG_VERSION_MAJOR");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: environment variable `CARGO_PKG_VERSION_MINOR` not defined
--> src/lib.rs:44:41
|
44 | pub const VERSION_MINOR: &'static str = env!("CARGO_PKG_VERSION_MINOR");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: environment variable `CARGO_PKG_VERSION_PATCH` not defined
--> src/lib.rs:47:41
|
47 | pub const VERSION_PATCH: &'static str = env!("CARGO_PKG_VERSION_PATCH");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors
builder for ‘/nix/store/2xmn0ydz0inzlz7cvw8k4lnvjwfzg3ai-rust_http-box-0.1.5.drv’ failed with exit code 101
# ~/.config/nixpkgs/overlays/crates/httpbox.nix
{ pkgs, ... }:
with pkgs;
let
bitflags_0_5_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
crateName = "bitflags";
version = "0.5.0";
sha256 = "0bgw1kiy121kikjrwj6zsd7l8n1gg1jirivzkc7zpjsvqa3p0hla";
inherit dependencies buildDependencies features;
};
byte_slice_0_1_12_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
crateName = "byte-slice";
version = "0.1.12";
sha256 = "0s5rh45b40cvw955m7axsh25dig6vbyycw78jj73h3l0spzf6hn9";
inherit dependencies buildDependencies features;
};
getopts_0_2_14_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
crateName = "getopts";
version = "0.2.14";
sha256 = "1wdz34vls97g9868h8kiw4wmwkbyxg4xm3xzvr1542hc3w4c7z0a";
inherit dependencies buildDependencies features;
};
http_box_0_1_5_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
crateName = "http-box";
version = "0.1.5";
sha256 = "11rywsm8wp80d1fms0pp1x402ip1mnkzwf7ip30vashyq02scpd3";
build = "build.rs";
inherit dependencies buildDependencies features;
};
libc_0_2_24_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
crateName = "libc";
version = "0.2.24";
sha256 = "0q4hv4wwbpz8nszqfh52jq7p0m4lxp0nkza05lzqj3hyzjza3g0v";
inherit dependencies buildDependencies features;
};
pulldown_cmark_0_0_8_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
crateName = "pulldown-cmark";
version = "0.0.8";
sha256 = "16ixrqj7ah3cxr13mxjjb75jszhp4bmd2g4frsg3hp17d03xc1sv";
crateBin = [ { name = "pulldown-cmark"; } ];
inherit dependencies buildDependencies features;
};
rand_0_3_15_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
crateName = "rand";
version = "0.3.15";
sha256 = "1fs30rc1xic40s1n7l3y7pxzfifpy03mgrvhy5ggp5p7zjfv3rr8";
inherit dependencies buildDependencies features;
};
skeptic_0_7_1_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
crateName = "skeptic";
version = "0.7.1";
sha256 = "0fdp7kv67fgakvdxf0favv1fjvl98629xnynfkl0v0q8x0glmb5a";
libPath = "lib.rs";
inherit dependencies buildDependencies features;
};
tempdir_0_3_5_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate {
crateName = "tempdir";
version = "0.3.5";
sha256 = "0rirc5prqppzgd15fm8ayan349lgk2k5iqdkrbwrwrv5pm4znsnz";
inherit dependencies buildDependencies features;
};
in
rec {
bitflags_0_5_0 = bitflags_0_5_0_ {};
byte_slice_0_1_12 = byte_slice_0_1_12_ {};
getopts_0_2_14 = getopts_0_2_14_ {};
http_box_0_1_5 = http_box_0_1_5_ {
dependencies = [ byte_slice_0_1_12 ];
buildDependencies = [ skeptic_0_7_1 ];
};
libc_0_2_24 = libc_0_2_24_ {
features = [ "use_std" ];
};
pulldown_cmark_0_0_8 = pulldown_cmark_0_0_8_ {
dependencies = [ bitflags_0_5_0 getopts_0_2_14 ];
};
rand_0_3_15 = rand_0_3_15_ {
dependencies = [ libc_0_2_24 ];
};
skeptic_0_7_1 = skeptic_0_7_1_ {
dependencies = [ pulldown_cmark_0_0_8 tempdir_0_3_5 ];
};
tempdir_0_3_5 = tempdir_0_3_5_ {
dependencies = [ rand_0_3_15 ];
};
}
# clone nixpkgs and checkout PR-31150
cd ~
git clone https://github.com/NixOS/nixpkgs.git
cd nixpkgs
git fetch pull/31150/head:pr-31150
git co pr-31150
# cp httpbox.nix from gist into ~/.config/nixpkgs/overlays/crates
# cp crates-overlay.nix from gist into ~/.config/nixpkgs/overlays
nix-env -f ~/nixpkgs -iA rustHttpBox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment