Commit Graph

180 Commits

Author SHA1 Message Date
Daiderd Jordan
65e92d19d2
Merge pull request #34968 from timokau/rust-find
buildRustPackage: Restrict `find` to files
2018-04-23 21:29:08 +02:00
pe@pijul.org
ec40f193ac disable parallel rustc (-C codegen-units=1) 2018-04-16 16:16:28 +02:00
pe@pijul.org
8e87f73e36 Update to 0.7.2 2018-04-16 16:07:47 +02:00
pe@pijul.org
29a3059746 Carnix 0.7 2018-04-16 14:11:25 +02:00
Kevin Cox
4499513e54
rust: Allow setting cargoSha256 to null.
Setting the hash to null is a convenient way to bypass the hash check
while developing. It looks like the ability to do this was inadvertently
removed while adding vendor directory support.

This still checks that the user is explicitly setting the value but
allows null as a valid option.
2018-04-07 22:48:55 +01:00
Jörg Thalheim
d12cab3bb1 buildRustCrate: remove ancient test guards
Let's leave x"" to the 1990s, where they belong
2018-03-28 09:24:22 +01:00
Shell Turner
8cc6897ae9
buildRustCrate: fix equality testing
Use string equality instead of integer equality.
2018-03-27 20:08:48 +01:00
Jan Tojnar
a31d98f312
tree-wide: autorename gnome packages to use dashes 2018-02-25 17:41:16 +01:00
Mario Rodas
bdf031dd4f buildRustCrate: Set target_os to "macos" on darwin
The rust compiler uses "macos" as "target_os" conditional on Mac OS[1]

[1] 8e7a609e63/src/librustc_back/target/x86_64_apple_darwin.rs (L29)
2018-02-23 18:00:39 -05:00
Yurii Rashkovskii
e1aecec4cd
build-support/rust: make use of abandoned cargoUpdateHook
Previously, cargoUpdateHook was meaningful as it was used
in
[`cargo-fetch-deps`](19d3cf81d3/pkgs/build-support/rust/fetch-cargo-deps (L71)).

However, this entire file was removed in
5f8cf0048e. As far as I can
tell, nothing in the code is using it, but it is still
being passed around:
https://github.com/NixOS/nixpkgs/search?q=cargoUpdateHook&type=Code&utf8=%E2%9C%93

There are, however, legitimate use cases for it. For example,
in some software, some dependencies are not locked in Cargo.toml
and this causes Cargo to try fetching another version of them.
This doesn't work well with vendoring crates.

This hook allows to inject patching or whatever necessary workarounds
in the crate vendoring process. I suppose that's what it was for
in there in the first place.

This patch restores this hook and makes it usable again.
2018-02-23 11:17:03 +07:00
Jörg Thalheim
f61e8d98ff
rust: 1.22.1 -> 1.24.0 2018-02-20 09:59:26 +00:00
Pierre-Etienne Meunier
8e5ab6e7ac BuildRustCrate: more general overrides, and handling the "dylib" crate type (#35171)
* buildRustCrate: adding a symlink from libblah-xxxxx.so to libblah.so
* BuildRustCrate: overriding phases
* Carnix: 0.6.5 -> 0.6.6
* Fixing symlink_dependencies --buildDep
* Shorter symlink_dependencies
* running `runHook postBuild` *after* the build
2018-02-20 08:55:04 +01:00
Timo Kaufmann
dc53518dc3 buildRustPackage: Restrict find to files
`find -executable` finds everything with the executable bit set,
including directories. Thats not harmful in this scenario as `cp` won't
copy those directories, but it does result in a few warning messages.
2018-02-14 17:27:03 +01:00
Stewart Mackenzie
a5cabdb6b1 buildRustCrate: add a postInstall phase (#34906) 2018-02-13 17:28:32 +01:00
pe@pijul.org
113591c803 defaultCrateOverrides: add pq-sys
fixes #34228
2018-02-10 06:59:56 -06:00
pe@pijul.org
508bf1b318 defaultCrateOverrides: add thrussh-libsodium 2018-02-10 06:59:56 -06:00
gnidorah
810a19bab3 way-cooler: 0.6.2 -> 0.8.0 2018-02-04 05:17:53 +03:00
Jörg Thalheim
2a2c8eab26 rust: fix evaluation 2018-02-04 00:09:00 +00:00
Jörg Thalheim
6580b18d3f cargo-vendor: move to all-packages 2018-02-03 22:35:27 +00:00
pe@pijul.org
8f20e7ce3a carnix: 0.6.0 -> 0.6.5 2018-02-03 22:31:54 +00:00
Jörg Thalheim
8ee54334e9
Merge pull request #33980 from thefloweringash/cargo-vendor-carnix
cargo-vendor: Build from source using carnix
2018-02-03 10:28:57 +00:00
Pierre-Etienne Meunier
6fbaa05dd1 Carnix 0.6 (#34238) 2018-01-26 10:53:18 +00:00
Andrew Childs
be797f7e1c cargo-vendor: Build from source using carnix
Removes a binary bootstrap, and enables cargo-vendor on aarch64.
2018-01-18 20:44:42 +09:00
Andrew Childs
62dcb3d5d0 buildRustCrate: Allow arbitrary attributes in crateOverrides 2018-01-18 20:42:00 +09:00
Tuomas Tynkkynen
6ed0fe7e45 Merge remote-tracking branch 'upstream/master' into staging
Conflicts:
	pkgs/build-support/fetchbower/default.nix
	pkgs/build-support/fetchdarcs/default.nix
	pkgs/build-support/fetchgx/default.nix
	pkgs/development/python-modules/botocore/default.nix
	pkgs/os-specific/linux/firmware/firmware-linux-nonfree/default.nix
	pkgs/tools/admin/awscli/default.nix
2018-01-14 21:18:27 +02:00
John Ericson
e017a027d5
Merge pull request #33681 from obsidiansystems/fixed-output-deps
Fixed output deps
2018-01-10 14:28:10 -05:00
John Ericson
888404f11b treewide: Fix deps in a few other fixed output derivations 2018-01-10 11:18:44 -05:00
Robin Gloster
7c5430c27c
Revert "rust: store the cargo-vendor config"
This reverts commit 0af2c5891b.

See 0af2c5891b (commitcomment-26737983)
This breaks the cargoSha256 hashes.
2018-01-09 15:03:03 +01:00
zimbatm
0af2c5891b rust: store the cargo-vendor config
cargo-vendor generates almost the right cargo config. Store it with the
vendored files and patch it on use.

This allows to re-use the generated config when using git dependencies.
2018-01-09 03:37:53 +01:00
Daiderd Jordan
5a02143c20
Merge pull request #33010 from LnL7/cacert-hook
cacert: add hook that sets SSL_CERT_FILE
2018-01-07 09:55:15 +01:00
dywedir
10e22d53ad carnix: 0.5.0 -> 0.5.2 2018-01-06 13:53:23 +01:00
Daiderd Jordan
091c2b9f04
cacert: cleanup exporting SSL_CERT_FILE 2017-12-27 21:36:32 +01:00
Graham Christensen
e5629dc51a
Merge pull request #32365 from vcunat/p/check-meta
check meta, treewide
2017-12-12 18:55:23 -05:00
Vladimír Čunát
3a110ea3f9
treewide platform checks: abort -> throw
They aren't meant to be critical (uncatchable) errors.
Tested with nix-env + checkMeta:
[ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ]
2017-12-12 18:08:10 -05:00
Pierre-Étienne Meunier
4348b7f2d0 carnix: init at 0.5.0
fixes #31150
2017-12-12 04:59:12 -06:00
Pierre-Étienne Meunier
5a0d954156 add buildRustCrate function to build rust crates 2017-12-12 04:58:45 -06:00
Pierre-Étienne Meunier
ea232fe29d add fetchCrate function to fetch rust crates 2017-12-12 04:58:45 -06:00
Thomas Tuegel
7ede960a27
buildRustPackage: make dependencies' source writable
Some packages, such as the xcb crate, do code generation at build-time;
therefore, the dependencies' source tree must be writable.
2017-11-20 11:02:01 -06:00
zimbatm
daf53c9a10 buildRustPackage: allow passthru overrides
Don't ignore the passthru that could be passed to the derivation
2017-10-26 17:44:52 +01:00
Kevin Cox
5f8cf0048e rust: update cargo builder to fetch registry dynamically
The biggest benefit is that we no longer have to update the registry
package. This means that just about any cargo package can be built by
nix. No longer does `cargo update` need to be feared because it will
update to packages newer then what is available in nixpkgs.

Instead of fetching the cargo registry this bundles all the source code
into a "vendor/" folder.

This also uses the new --frozen and --locked flags which is nice.

Currently cargo-vendor only provides binaries for Linux and
macOS 64-bit. This can be solved by building it for the other
architectures and uploading it somewhere (like the NixOS cache).

This also has the downside that it requires a change to everyone's deps
hash. And if the old one is used because it was cached it will fail to
build as it will attempt to use the old version. For this reason the
attribute has been renamed to `cargoSha256`.

Authors:
* Kevin Cox <kevincox@kevincox.ca>
* Jörg Thalheim <Mic92@users.noreply.github.com>
* zimbatm <zimbatm@zimbatm.com>
2017-10-23 00:30:47 +01:00
Jörg Thalheim
7a10cc84a0 rustRegistry: switch to mkDerivation
fixes #26582
2017-06-25 11:56:29 +01:00
tilpner
c610f99d8f Expose custom Rust registry versions
This allows users to specify a custom registry src,
because currently every packager would need to create
an outdated Cargo.lock just to be compatible with the
probably outdated rustRegistry in nixpkgs.

Currently there is no easy way to convince cargo to
do that, so this makes that workaround unnecessary.
2017-06-25 11:56:15 +01:00
Benno Fünfstück
19d3cf81d3 rust: fix fetch-cargo-deps for git dependencies
We need to make sure that `$revs` ends with a space, since files must always
end with newlines. The previous code ignored the last entry in `$revs`, because
read already returns non-zero exit code for the last entry, as it does not end
with a space.
2017-05-23 10:01:33 +02:00
Benno Fünfstück
bd78749d33 rust: improve fetch-cargo-deps determinism for non-sandboxed builds
When not using sandboxing, /usr/share/git-core/templates may leak into the
nix build through the libgit2 hardcoded default template search path. We now
explictly set the templatedir to avoid this problem.

See https://github.com/bennofs/nix-index/issues/2#issuecomment-296268983 for
an example case of nondeterminism.
2017-04-21 23:26:46 +02:00
Jörg Thalheim
e8d5af0bd8
buildRustPackage: only copy executables to bin
in newer rust versions also *.rlib files are put into this directory
2017-04-15 13:26:51 +02:00
Jörg Thalheim
be70c02461
buildRustPackage: add standard package hooks
when overriding build phases also the standard hooks should be called
2017-04-15 13:26:51 +02:00
Jörg Thalheim
33cfee8177
buildRustPackage: add cargoBuildFlags 2017-04-15 13:26:50 +02:00
Christian Kauhaus
09f24f628b buildRustPackage: Fix "warning: file ... may be generated" (#24471)
Every Rust derivation used to emit a warning like the following:

```
setting SOURCE_DATE_EPOCH to timestamp 1490877042 of file cargo-6e0c18c/Cargo.lock
warning: file cargo-6e0c18c/Cargo.lock may be generated; SOURCE_DATE_EPOCH may be non-deterministic
```

The reason is that the dependencies are copied without preserving
timestamps. Changing the build script to timestamp-preserving copy
removes the warning.
2017-03-30 15:15:49 +02:00
Anders Papitto
095cf1b903 Revert "buildRustPackage: fix deprecated use of registry.index config key"
This reverts commit e8aa8cc94be45103fcd32b5f0bfee4a55eae4080.
2017-03-02 13:40:19 +01:00
anderspapitto
6dbb3ab031 buildRustPackage: fix deprecated use of registry.index config key (#22987)
See
8214bb953d
for the cargo commit which deprecated the registry.index key, and
implements this as a replacement. This gets rid of the error message

warning: custom registry support via the `registry.index` configuration is being removed, this functionality will not work in the future
2017-02-19 18:25:25 +00:00
Aristid Breitkreuz
e3dcf5da1d rq: init at 0.9.2 (broken because our v8 is too old, and I'm too weak to update v8) 2016-12-03 23:36:48 +01:00
Profpatsch
61462c94e6 lib/fetchers.nix: factor out impure proxy vars (#18702)
Apparently everyone just copied those variables, instead of creating a
library constant for them. Some even removed the comment. -.-
2016-09-17 21:50:01 +02:00
David Craven
54f80775cb rust: Refactoring of rust and cargo packages 2016-06-15 12:47:13 +02:00
David Craven
c22f0c7474 Fix buildRustPackage edge cases
1. When multiple versions of the same package are required
   $revs is an array.
2. When cargo fetch is run it usually doesn't need a network
   connection. But when it does SSL_CERT_FILE isn't set.
2016-06-02 17:15:52 +02:00
Moritz Ulrich
d8b0618e6c buildRustPackage: Don't specify logLevel by default. 2016-05-28 15:05:11 +02:00
Moritz Ulrich
1e04865e87 buildRustPackage: Add log-level argument. 2016-05-28 15:05:11 +02:00
Nikolay Amiantov
4f74a4aacb fetch-cargo-deps: factor into fetchCargoDeps function 2016-02-25 14:05:44 +03:00
Nikolay Amiantov
34023d867d fetchcargo: set CA bundle path 2016-02-25 13:51:12 +03:00
Jude Taylor
a2b19cdb04 revert fetch-cargo-deps change 2016-02-23 18:31:45 -08:00
Jude Taylor
7336191574 fix fetch-cargo SSL error 2016-02-23 16:42:51 -08:00
Ricardo M. Correia
fd3e02add8 Merge pull request #13027 from puffnfresh/package/pijul
pijul: 0.1 -> 0.2-6ab9ba
2016-02-20 15:43:53 +01:00
Brian McKenna
8b644c5826 rust: fix prePatch phase fail when sourceRoot set
We want to go up more than a single directory if we're in a nested one.
2016-02-17 07:28:26 +11:00
Guillaume Maudoux
9f358f809d Configure a default trust store for openssl 2016-02-03 12:42:01 +01:00
Tyson Whitehead
5c89edbc3b buildRustPackage: don't hardcode /nix/store, use $NIX_STORE 2016-01-12 13:45:11 -05:00
Ricardo M. Correia
799f0f1f23 buildRustPackage: fix failure due to branch names with slashes
Fixes #11237
2015-11-24 20:50:11 +01:00
Ricardo M. Correia
2b694c237b cargo, cargoSnapshot: add rustc runtime dependency
It turns out that cargo implicitly depends on rustc at runtime: even
`cargo help` will fail if rustc is not in the PATH.

This means that we need to wrap the cargo binary to add rustc to PATH.
However, I have opted into doing something slightly unusual: instead of
tying down a specific cargo to use a specific rustc (i.e., wrap cargo so
that "${rustc}/bin" is prefixed into PATH), instead I'm adding the rustc
used to build cargo as a fallback rust compiler (i.e., wrap cargo so
that "${rustc}/bin" is suffixed into PATH). This means that cargo will
prefer to use a rust compiler that is in the default path, but fallback
into the one used to build cargo only if there wasn't any rust compiler
in the default path.

The reason I'm doing this is that otherwise it could cause unexpected
effects. For example, if you had a build environment with the
rustcMaster and cargo derivations, you would expect cargo to use
rustcMaster to compile your project (since rustcMaster would be the only
compiler available in $PATH), but this wouldn't happen if we tied down
cargo to use the rustc that was used to compile it (because the default
cargo derivation gets compiled with the stable rust compiler).

That said, I have slightly modified makeRustPlatform so that a rust
platform will always use the rust compiler that was used to build cargo,
because this prevents mistakenly depending on two different versions of
the rust compiler (stable and unstable) in the same rust platform,
something which is usually undesirable.

Fixes #11053
2015-11-18 02:41:45 +01:00
Ricardo M. Correia
2389a707af fetch-cargo-deps: add debug output
... so that we can find out why there are sporadic hash mismatches.
2015-11-02 15:44:43 +01:00
Ricardo M. Correia
777c9c3768 buildRustPackage: fix erroneous /bin/sh reference
The fetch-cargo-deps script is written in bash syntax, but it
erroneously ran under the /bin/sh interpreter.

This wasn't noticed because /bin/sh is actually bash in NixOS, but on
some other systems this is not true.
2015-10-29 15:16:51 +01:00
Ricardo M. Correia
a0249ed425 buildRustPackage: Fix rust builds due to #7524
Fixes #8966
2015-07-24 20:47:58 +02:00
William A. Kennington III
ffd0539eba cacert: store ca-bundle.crt in $out/etc/ssl/certs instead of $out 2015-06-05 13:00:52 -07:00
Ricardo M. Correia
9176f73cee buildRustPackage: Cosmetic improvement 2015-06-05 19:18:45 +02:00
William A. Kennington III
14c1e0fa1f Fix ca-bundle paths 2015-05-29 14:03:34 -07:00
Ricardo M. Correia
d7ebe7a4f3 buildRustPackage: Accept srcs attribute as well
Add support for building Rust packages that have multiple sources, i.e.,
that use the `srcs` and `sourceRoot` attributes instead of just `src`.
2015-05-29 19:46:20 +02:00
Ricardo M. Correia
9b752fd0e1 buildRustPackage: Don't hardcode registry index hash
Instead, discover it automatically when building the package.

This makes `buildRustPackage` more future-proof with respect to changes
in how `cargo` generates the hash.

Also, it fixes broken builds in i686 because apparently, cargo generates
a different registry index hash in this architecture (compared to
x86-64).
2015-05-19 19:02:38 +02:00
Ricardo M. Correia
d6093505cc buildRustPackage: Get rid of /proc/self/cwd hack
This makes buildRustPackage portable to non-Linux platforms.

Additionally, now we also save the `Cargo.lock` file into the fetch output, so
that we don't have to run $cargoUpdateHook again just before building.
2015-04-23 20:22:19 +02:00
Ricardo M. Correia
b993c2113c buildRustPackage: Add a mechanism to patch registry deps
... in a more generic way.

With this commit, if you need to patch a registry package to make it
work with Nix, you just need to add a script to patch-registry-deps
in the same style as the `pkg-config` script.
2015-04-23 16:41:52 +02:00
Ricardo M. Correia
0cde1dc524 cargo: Remove setupHook
Instead, move that code into buildRustPackage.

The setup hook was only doing part of the work anyway, and having it in
a separate place was obscuring what was really going on.
2015-04-23 15:26:23 +02:00
Ricardo M. Correia
e42c17ee97 buildRustPackage: Fix Cargo.lock being ignored
It turns out that `cargo`, with respect to registry dependencies, was
ignoring the package versions locked in `Cargo.lock` because we changed
the registry index URL.

Therefore, every time `rustRegistry` would be updated, we'd always try
to use the latest version available for every dependency and as a result
the deps' SHA256 hashes would almost always have to be changed.

To fix this, now we do a string substitution in `Cargo.lock` of the
`crates.io` registry URL with our URL. This should be safe because our
registry is just a copy of the `crates.io` registry at a certain point
in time.

Since now we don't always use the latest version of every dependency,
the build of `cargo` actually started to fail because two of the
dependencies specified in its `Cargo.lock` file have build failures.

To fix the latter problem, I've added a `cargoUpdateHook` variable that
gets ran both when fetching dependencies and just before building the
program. The purpose of `cargoUpdateHook` is to do any ad-hoc updating
of dependencies necessary to get the package to build. The use of the
'--precise' flag is needed so that cargo doesn't try to fetch an even
newer version whenever `rustRegistry` is updated (and therefore have to
change depsSha256 as a consequence).
2015-04-23 02:58:07 +02:00
Ricardo M. Correia
d648be6724 buildRustPackage: Add check phase and enable it by default
Also disable check phase in cargo as there are lots of failures (some
probably due to trying to access the network).
2015-04-21 20:45:05 +02:00
Georges Dubus
7d67efa3f2 Add support for building cargo'ed Rust programs 2015-04-21 19:46:29 +02:00