Commit graph

91 commits

Author SHA1 Message Date
FireFragment
4d0b369475 Add crate-specific overrides 2024-05-30 13:12:19 +02:00
Patryk Wychowaniec
78789c30d6 Fix support for .cargo/config
Before https://github.com/nix-community/naersk/pull/300, our
`builtinz.toTOML` used to return a string representing the serialized
document which was later redirected into a file:

https://github.com/nix-community/naersk/pull/300/files#diff-b6b537316f2d29c8faf178a110366796811d1bc72f694262c7d2efad79aa984bL238

Over that merge request, this was changed to return a path, to make it
consistent with how nixpkgs' formatters work - but I haven't noticed one
place that still _read_ the file instead of returning a path (which was
fine before, since the code did `echo ... > ...`, but is not a correct
thing to do for `cp`).

Closes https://github.com/nix-community/naersk/issues/305.
2023-08-18 11:40:12 +02:00
Patryk Wychowaniec
eb2bdf3b0f Use TOML serializer from nixpkgs
Closes https://github.com/nix-community/naersk/issues/263
2023-08-16 11:32:57 +02:00
Robin Appelman
9327600ac6 add option to run cargo check/test/clippy instead of building 2023-06-12 14:14:47 +02:00
Patryk Wychowaniec
6944160c19 Improve unpacking dependencies 2022-09-03 17:53:20 +02:00
Patryk Wychowaniec
94beb7a3ed Add support for the postInstall hook
During compilation, we build two derivations - one for the dependencies
and another for the user's crate itself. Passing `postInstall` to
`buildPackage` pass-throughs it into both derivations, which is not what
most users would probably expect.

This commit adds `postInstall` as an explicit configuration option (so
that it's neatly documented), zeroing it out for the dependencies-only
derivation.

I don't think there's any use case for something like `postInstallDeps`,
so it's not introduced here.

Closes https://github.com/nix-community/naersk/issues/237
2022-05-16 19:33:31 +02:00
Patryk Wychowaniec
d626f73332 code review: allRefs -> gitAllRefs, refresh README 2022-04-04 20:16:32 +02:00
Yusuf Bera Ertan
99c7fce671 feat: optional submodule fetching 2022-04-04 20:16:32 +02:00
Yusuf Bera Ertan
8be5c0059d feat: simplify git dependency detection by only using cargo lock, allRefs support 2022-04-04 20:16:32 +02:00
Léo Gaspard
bc1069f52a expose copySource for dealing with path-based dependencies 2021-01-18 14:39:52 +01:00
Nicolas Mattia
22b96210b2 Make top-level override easier
This adds `overrideMain f` which is equivalent to calling
`drv.overrideAttrs f`.
2020-10-08 18:05:41 +02:00
Nicolas Mattia
a82fd7dc31 Light cleanup 2020-04-16 15:45:40 +02:00
Tony Olagbaiye
c55558b630 Parse lockfile for expanded revision 2020-03-23 14:05:17 +01:00
Nicolas Mattia
d6ba33f942 Forward extra arguments to mkDerivation 2020-02-18 15:55:26 +01:00
Bas van Dijk
1b6b98d74f Fix too big environment variable paths in symlinkJoin
When there are too many crate dependencies the `crates.io` derivation will fail with:

```
while setting up the build environment: executing '/nix/store/rm1hz1lybxangc8sdl7xvzs5dcvigvf7-bash-4.4-p23/bin/bash': Argument list too long
builder for '/nix/store/pbbnw6y6zggqddy244ix5nyysamcgm0j-crates-io.drv' failed with exit code 1
```

This is caused by the [`paths` environment variable of `symlinkJoin`](fc592a52ca/pkgs/build-support/trivial-builders.nix (L250)) exceeding the limit.

This is fixed by having our own version of `symlinkJoin` called `symlinkJoinPassViaFile` which passes `paths` via a file instead of via an environment variable.

I think this should be fixed in the upstream `symlinkJoin` so I'll provide a PR for that in `nixpkgs`. But until that lands we should have this fix here.
2020-02-18 10:08:46 +01:00
Nicolas Mattia
360a3d20eb Don't touch lib and main and build except in build.nix 2020-02-11 23:44:42 +01:00
Nicolas Mattia
206cf17e20 Add copyBinsFilter option for configuring which executables are copied 2020-02-10 14:03:08 +01:00
Nicolas Mattia
45bee2e6b5 Refactor config.nix for cargo options 2020-02-10 12:53:55 +01:00
Nicolas Mattia
81a3ad4bf9 Ensure build.rs is rebuilt if necessary 2020-02-02 13:41:23 +01:00
Nicolas Mattia
cfbaf2a6f2 Clean up git dependency code 2019-12-17 17:03:10 +01:00
Nicolas Mattia
47b22494d9 Add experimental support for git dependencies 2019-12-16 10:33:10 +01:00
Nicolas Mattia
ad0580c8d8 Split source between src and root 2019-11-21 15:46:20 +01:00
Nicolas Mattia
568c3db8f3 Don't use builtins.fetchurl 2019-11-21 10:34:16 +01:00
zimbatm
9a72012540
stylistic changes
these are not mandated by nixpkgs-fmt
2019-11-19 20:12:42 +00:00
zimbatm
d11a8a036c
format nix code with nixpkgs-fmt v0.6.1 2019-11-19 20:12:36 +00:00
Nicolas Mattia
4714fb8ac1 Allow path or attrset as arguments 2019-11-18 17:52:11 +01:00
Nicolas Mattia
79ccb516e9 Split build and build-plan configuration 2019-11-18 16:41:28 +01:00
Nicolas Mattia
9829b21bc1 Make all build.nix arguments mandatory 2019-11-18 16:16:46 +01:00
Nicolas Mattia
115b63b554 Re indent 2019-11-18 14:59:14 +01:00
Nicolas Mattia
1e4b63a406 Split config out of default 2019-11-18 14:58:25 +01:00
Nicolas Mattia
deb09d67e6 Compress target by default 2019-11-13 16:31:13 +01:00
Nicolas Mattia
2b5696830f Remove silly names and set proper package name and version 2019-10-30 17:42:44 +01:00
Nicolas Mattia
b5fa169655 Remove unused parameters 2019-10-30 15:25:41 +01:00
Nicolas Mattia
4dd9dc45bd Cleanup preBuild 2019-10-30 15:12:59 +01:00
Bas van Dijk
9ed75a8286
Merge pull request #31 from nmattia/patched-sources
Copy paths from the [patch] section into the dummy-src
2019-10-29 15:27:10 +01:00
Bas van Dijk
59921aa707 Copy paths from the [patch] section into the dummy-src
This allows users to override the source of crates using:

```
[patch.crates-io]
bar = { path = 'my/local/bar' }
```
2019-10-29 14:57:28 +01:00
Nicolas Mattia
0327d6a66a Fix missing name 2019-10-29 13:31:22 +01:00
Philip Patsch
3f04e344ec default.nix: improve derivation names a bit 2019-10-27 23:10:29 +01:00
Nicolas Mattia
db7b28ab9e dummySrc: only create config file when config exists 2019-10-14 12:31:46 +02:00
Nicolas Mattia
6b78252c24 Drop singleStep attr when calling build.nix 2019-10-14 10:25:48 +02:00
Nicolas Mattia
816b15c73a Simplify configuration for single step build 2019-10-10 18:50:03 +02:00
Nicolas Mattia
1a3ede8a56 Don't import src in store for pathExists 2019-10-10 14:07:19 +02:00
Nicolas Mattia
6c072bd0ed Use cargo_release arg list for --release 2019-09-11 13:45:06 +02:00
Bas van Dijk
df0c276e7a Use the cargoTestCommands specified by the user for building the deps 2019-09-09 11:21:51 +02:00
Bas van Dijk
2791c3bd52 Use cargo build --out-dir instead of cargo install
Since we don't use cargo install anymore we go back to building the
workspace instead of building each crate separately.
2019-09-04 17:36:40 +02:00
Bas van Dijk
21850b632a Run cargo clippy for the deps 2019-09-04 12:15:15 +02:00
Bas van Dijk
e98ef6b715 Run cargoBuild and cargoTest per crate 2019-09-04 12:14:36 +02:00
Nicolas Mattia
51e8f903c4 Fix features rebuild 2019-08-28 19:21:13 +02:00
Nicolas Mattia
fc13d3d7b8 Fix rebuild on install 2019-08-28 11:20:40 +02:00
Bas van Dijk
156328e941 Don't copy the docs to a separate doc output for the dependencies
In the deps derivation the docs are already contained in `target`
which is copied to `$out`. So in that case also copying the docs to a
separate `$doc` output wastes space. Only the final derivation should
have its docs in a separate `$doc` output.
2019-08-26 16:35:05 +02:00