summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2024-03-26 00:02:40 +0000
committerGitHub <noreply@github.com>2024-03-26 00:02:40 +0000
commit7f09da0f22011112c3df4dc9fcab0e39c1512b7d (patch)
tree978a15d3ed7dd12c0d40880094e87ec5ab0fecb1 /doc
parent5b130e5ecbd77314506313c7a65a7369dc5b5c82 (diff)
parentc904e6bf24e582e4fe28e988b7cdb7e9fda595c3 (diff)
Merge staging-next into staging
Diffstat (limited to 'doc')
-rw-r--r--doc/languages-frameworks/rust.section.md60
1 files changed, 60 insertions, 0 deletions
diff --git a/doc/languages-frameworks/rust.section.md b/doc/languages-frameworks/rust.section.md
index 75e57a8bb574..274ee9ce9cc4 100644
--- a/doc/languages-frameworks/rust.section.md
+++ b/doc/languages-frameworks/rust.section.md
@@ -651,6 +651,66 @@ buildPythonPackage rec {
}
```
+#### Rust package built with `meson` {#rust-package-built-with-meson}
+
+Some projects, especially GNOME applications, are built with the Meson Build System instead of calling Cargo directly. Using `rustPlatform.buildRustPackage` may successfully build the main program, but related files will be missing. Instead, you need to set up Cargo dependencies with `fetchCargoTarball` and `cargoSetupHook` and leave the rest to Meson. `rust` and `cargo` are still needed in `nativeBuildInputs` for Meson to use.
+
+```nix
+{ lib
+, stdenv
+, fetchFromGitLab
+, meson
+, ninja
+, pkg-config
+, rustPlatform
+, rustc
+, cargo
+, wrapGAppsHook4
+, blueprint-compiler
+, libadwaita
+, libsecret
+, tracker
+}:
+
+stdenv.mkDerivation rec {
+ pname = "health";
+ version = "0.95.0";
+
+ src = fetchFromGitLab {
+ domain = "gitlab.gnome.org";
+ owner = "World";
+ repo = "health";
+ rev = version;
+ hash = "sha256-PrNPprSS98yN8b8yw2G6hzTSaoE65VbsM3q7FVB4mds=";
+ };
+
+ cargoDeps = rustPlatform.fetchCargoTarball {
+ inherit src;
+ name = "${pname}-${version}";
+ hash = "sha256-8fa3fa+sFi5H+49B5sr2vYPkp9C9s6CcE0zv4xB8gww=";
+ };
+
+ nativeBuildInputs = [
+ meson
+ ninja
+ pkg-config
+ rustPlatform.cargoSetupHook
+ rustc
+ cargo
+ wrapGAppsHook4
+ blueprint-compiler
+ ];
+
+ buildInputs = [
+ libadwaita
+ libsecret
+ tracker
+ ];
+
+ # ...
+}
+```
+
## `buildRustCrate`: Compiling Rust crates using Nix instead of Cargo {#compiling-rust-crates-using-nix-instead-of-cargo}
### Simple operation {#simple-operation}