Commit Graph

60 Commits

Author SHA1 Message Date
Jan Tojnar
6ecc641d08
doc: prepare for commonmark
We are still using Pandoc’s Markdown parser, which differs from CommonMark spec slightly.

Notably:
- Line breaks in lists behave differently.
- Admonitions do not support the simpler syntax https://github.com/jgm/commonmark-hs/issues/75
- The auto_identifiers uses a different algorithm – I made the previous ones explicit.
- Languages (classes) of code blocks cannot contain whitespace so we have to use “pycon” alias instead of Python “console” as GitHub’s linguist

While at it, I also fixed the following issues:
- ShellSesssion was used
- Removed some pointless docbook tags.
2021-06-07 06:34:59 +02:00
Daniël de Kok
9cca8ce446 doc: fix incorrect use of cargoDeps
Thanks to @bjornfor for reporting this error!
2021-06-01 13:14:28 +02:00
Daniël de Kok
b3969f3ad7 rustPlatform.buildRustPackage: support direct use of Cargo.lock
This change introduces the cargoLock argument to buildRustPackage,
which can be used in place of cargo{Sha256,Hash} or cargoVendorDir. It
uses the importCargoLock function to build the vendor
directory. Differences compared to cargo{Sha256,Hash}:

- Requires a Cargo.lock file.
- Does not require a Cargo hash.
- Retrieves all dependencies as fixed-output derivations.

This makes buildRustPackage much easier to use as part of a Rust
project, since it does not require updating cargo{Sha256,Hash} for
every change to the lock file.
2021-05-28 08:01:28 +02:00
Daniël de Kok
2f46d77e28 rustPlatform.importCargoLock: init
This function can be used to create an output path that is a cargo
vendor directory. In contrast to e.g. fetchCargoTarball all the
dependent crates are fetched using fixed-output derivations. The
hashes for the fixed-output derivations are gathered from the
Cargo.lock file.

Usage is very simple, e.g.:

importCargoLock {
  lockFile = ./Cargo.lock;
}

would use the lockfile from the current directory.

The implementation of this function is based on Eelco Dolstra's
import-cargo:

https://github.com/edolstra/import-cargo/blob/master/flake.nix

Compared to upstream:

- We use fetchgit in place of builtins.fetchGit.
- Sync to current cargo vendoring.
2021-05-28 08:01:25 +02:00
Sandro
3a6116c550
Merge pull request #116257 from SuperSandro2000/code-fences
doc/languages-frameworks/*: add missing languages to code fences
2021-04-05 05:38:38 +02:00
Sandro Jäckel
2c143a4614 doc/languages-frameworks/*: add missing languages to code fences
convert shell -> ShellSession
2021-04-05 05:23:19 +02:00
Frederik Rietdijk
1ecb97eae9 Merge master into staging-next 2021-03-19 18:17:01 +01:00
Katharina Fey
29df3bc24c
doc: fix code formatting 2021-03-19 13:37:27 +01:00
github-actions[bot]
8c04f70ddd
Merge master into staging-next 2021-03-14 12:21:07 +00:00
Florian Engel
3329093c6a Remove repeating words from doc 2021-03-14 12:15:34 +01:00
Max Hausch
ebe3ae4d4d
buildRustPackage: Add cargoTestFlags
This makes it possible to pass flags to `cargo test`, which is needed if
a crate is compiled with custom feature flags.
2021-03-02 09:45:26 +01:00
Max Hausch
fa62f37160
doc: rust: Fix code blocks in markdown
And add a word
2021-03-02 09:40:58 +01:00
Daniël de Kok
c50a347cb5 buildRustPackage: use checkType argument
The `checkType` argument of buildRustPackage was not used anymore
since the refactoring of `buildRustPackage` into hooks. This was
an oversight that is fixed by this change.

The check type can also be passed directly to cargoCheckHook using the
`cargoCheckType` environment variable.
2021-02-26 11:57:27 +01:00
Frederik Rietdijk
c456a2512f Merge master into staging-next 2021-02-26 10:25:13 +01:00
Daniël de Kok
05e40e79a8 buildRustPackage: factor out check phase to cargoCheckHook
API change:

`cargoParallelTestThreads` suggests that this attribute sets the
number of threads used during tests, while it is actually a boolean
option (use 1 thread or NIX_BUILD_CORES threads). In the hook, this
is replaced by a more canonical name `dontUseCargoParallelTests`.
2021-02-16 08:09:15 +01:00
Daniël de Kok
9757c7101a buildRustPackage: factor out install phase to cargoInstallHook 2021-02-15 12:17:18 +01:00
Daniël de Kok
d92396039d buildRustPackage: add cargoDepsName attribute
The directory in the tarball of vendored dependencies contains `name`,
which is by default set to `${pname}-${version}`. This adds an
additional attribute to permit setting the name to something of the
user's choosing.

Since `cargoSha256`/`cargoHash` depend on the name of the directory of
vendored dependencies, `cargoDepsName` can be used to e.g. make the
hash invariant to the package version by setting `cargoDepsName =
pname`.
2021-02-15 07:06:31 +01:00
Daniël de Kok
dbc8633daf doc: describe cargoBuildHook and maturinBuildHook in the Rust section 2021-02-12 08:40:46 +01:00
Daniël de Kok
198dd77635 doc: describe cargoSetupHook in the Rust section 2021-02-10 07:03:48 +01:00
V
7616206b77
doc: add function argument order convention (#110060)
* doc: add function argument order convention

Ordering by usage is the de facto ordering given to arguments. It's
logical, and makes finding argument usage easier. Putting lib first is
common in NixOS modules, so it's reasonable to mirror this in nixpkgs
proper. Additionally, it's not a package as such, has zero dependencies,
and can be found used anywhere in a derivation.

* doc: clean up usage of lib
2021-01-20 19:07:16 -05:00
Jonathan Ringer
7c64854b23 docs: pkgconfig -> pkg-config 2021-01-19 01:16:25 -08:00
Alexei Colin
72bebd8c0c doc: rust: fix syntax error in declarative overlay
Otherwise pasting the snippet into shell.nix results in:

	error: syntax error, unexpected '=', expecting $end, at /.../shell.nix:2:9

Signed-off-by: Alexei Colin <ac@alexeicolin.com>
2021-01-17 01:29:15 -05:00
Profpatsch
b0c1583a0b doc: stdenv.lib -> lib
Part of: https://github.com/NixOS/nixpkgs/issues/108938

Changing the documentation to not refer to stdenv.lib is the first
step to make people use it directly.
2021-01-11 09:52:27 +01:00
Ryan Mulligan
dd6c0efa62
Merge pull request #108147 from ryantm/doc-cleanup
doc: explicit Markdown anchors for top-level headings; remove metadata
2021-01-01 11:40:09 -08:00
Ryan Mulligan
b8344f9e5c doc: explicit Markdown anchors for top-level headings; remove metadata
I used the existing anchors generated by Docbook, so the anchor part
should be a no-op. This could be useful depending on the
infrastructure we choose to use, and it is better to be explicit than
rely on Docbook's id generating algorithms.

I got rid of the metadata segments of the Markdown files, because they
are outdated, inaccurate, and could make people less willing to change
them without speaking with the author.
2021-01-01 10:02:57 -08:00
Daniël de Kok
b6728fa15c docs/rust: describe cargoHash 2020-12-31 11:18:13 +01:00
John Ericson
b7650aaa77 rust: Clean up target configs and test some more
See the new docs for details. The difference is vis-a-vis older versions
of this PR, not master.
2020-11-28 19:36:28 +00:00
John Ericson
8ddf5c6907 Merge remote-tracking branch 'upstream/master' into aj-rust-custom-target 2020-11-28 18:10:38 +00:00
Jörg Thalheim
4844ca43d8
Merge pull request #67496 from mb21/patch-1
Docs: clarify Rust overlay on non-NixOS
2020-11-28 14:29:04 +01:00
Aaron Janse
2bccf2e554 add documentation 2020-10-17 00:48:07 -07:00
John Ericson
c0df12de5d rust: Add support for managing target JSON in Nix 2020-10-14 04:20:23 +00:00
Manuel Bärenz
cd2dab91d6 Doc -> Languages & Frameworks -> Rust: Update
Add information on declarative overlay usage
2020-09-26 10:58:06 +02:00
zowoq
e4c71e6c6c buildRustPackage: support setting test-threads 2020-09-24 07:19:58 +10:00
Alexandre Esteves
0cad09a68a docs/rust: fix typo
Co-authored-by: Drew <drewrisinger@users.noreply.github.com>
2020-09-10 19:10:27 +02:00
zowoq
473536e3b5 buildRustPackage: remove platform.all from packages 2020-08-16 12:48:18 +10:00
zowoq
b3d71cd63d doc/*: editorconfig fixes 2020-07-31 15:06:53 +10:00
Frederik Rietdijk
1c68570ab2 Merge staging-next into staging 2020-06-05 19:42:16 +02:00
Jörg Thalheim
f0396574ab
buildRustPackage: add documentation on how to create cargo.lock patches 2020-06-05 10:41:46 +01:00
Maximilian Bosch
59e8e7a129
rust: improve docs
Co-authored-by: cole-h <cole.e.helbling@outlook.com>
Co-authored-by: asymmetric <lorenzo@mailbox.org>
2020-05-31 21:47:32 +02:00
Maximilian Bosch
6574ba1946
rust*: add docs for testing packages
See also https://discourse.nixos.org/t/rust-build-speed-improvements/7225
2020-05-24 18:37:34 +02:00
Benjamin Hipple
05343f6ff1 rust: remove legacy cargo fetcher
We have now migrated every single Rust package in NixPkgs! This deletes the
legacy fetcher, which is now unused.

Resolves #79975
2020-03-18 20:12:32 -07:00
Benjamin Hipple
ad30a30488 rustPlatform.fetchCargo: handle custom Cargo.lock patchfiles with validation
Previously, we would asssert that the lockfiles are consistent during the
unpackPhase, but if the pkg has a patch for the lockfile itself then we must
wait until the patchPhase is complete to check.

This also removes an implicity dependency on the src attribute coming from
`fetchzip` / `fetchFromGitHub`, which happens to name the source directory
"source". Now we glob for it, so different fetchers will work consistently.
2020-02-28 18:54:23 -08:00
Jonathan Ringer
3990b914c3 manual: use quoted homepage urls 2020-02-16 09:49:12 -08:00
Benjamin Hipple
131a32a5af rust: update docs on legacyCargoFetcher; remove unnecessary defaults
As mentioned in #79975, the default on `legacyCargoFetcher` if left unspecified
is now `false`.
2020-02-15 22:07:47 -08:00
Benjamin Hipple
2115a2037c fetchcargo: use flat tar.gz file for vendored src instead of recursive hash dir
This has several advantages:

1. It takes up less space on disk in-between builds in the nix store.
2. It uses less space in the binary cache for vendor derivation packages.
3. It uses less network traffic downloading from the binary cache.
4. It plays nicely with hashed mirrors like tarballs.nixos.org, which only
   substitute --flat hashes on single files (not recursive directory hashes).
5. It's consistent with how simple `fetchurl` src derivations work.
6. It provides a stronger abstraction between input src-package and output
   package, e.g., it's harder to accidentally depend on the src derivation at
   runtime by referencing something like `${src}/etc/index.html`. Likewise, in
   the store it's harder to get confused with something that is just there as a
   build-time dependency vs. a runtime dependency, since the build-time
   src dependencies are tarred up.

Disadvantages are:
1. It takes slightly longer to untar at the start of a build.

As currently implemented, this attaches the compacted vendor.tar.gz feature as a
rider on `verifyCargoDeps`, since both of them are relatively newly implemented
behavior that change the `cargoSha256`.

If this PR is accepted, I will push forward the remaining rust packages with a
series of treewide PRs to update the `cargoSha256`s.
2020-02-10 10:17:29 -05:00
adisbladis
fece3e5ca1
doc: Remove comment advising to install build tooling system-wide
We should not encourage installing build-tooling system-wide but
instead promote nix-shell.
2020-01-23 21:09:30 +00:00
Benjamin Hipple
c2e5ff3fe8 doc: update rust example on buildRustPackage (#77534)
The example in the manual was out of date and didn't use the newer `pname`
convention, which simplifies the fetch call.
2020-01-12 17:19:57 +00:00
Arnout Engelen
07c84f4de2 documentation: drop double 'the' 2019-11-09 10:10:47 +01:00
Jörg Thalheim
56240d7f20
Merge pull request #71899 from decentriq/aslemmer/build-rust-package-add-target
build-support/rust: Add target option
2019-11-01 15:46:47 +00:00
exfalso
bb7184d6a6 buildRustPackage: Add readme comment on target option 2019-11-01 14:19:39 +00:00