nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5 pkg-config,
6 cargo,
7 rustc,
8 clippy,
9 gcc,
10 makeWrapper,
11}:
12let
13 pname = "rustlings";
14 version = "6.5.0";
15in
16rustPlatform.buildRustPackage {
17 inherit pname version;
18 src = fetchFromGitHub {
19 owner = "rust-lang";
20 repo = "rustlings";
21 rev = "v${version}";
22 hash = "sha256-dUQIzNPxmKbhew9VjFIW7bY0D1IkuJ5+hRY2/CwmYhY=";
23 };
24
25 cargoHash = "sha256-AvwulWEqZMywaG7lEmT8nn9s2hda+bbIV1rnVXnKH8o=";
26
27 # Disabled test that does not work well in an isolated environment
28 checkFlags = [
29 "--skip=run_compilation_success"
30 "--skip=run_test_success"
31 "--skip=init"
32 ];
33
34 nativeBuildInputs = [
35 pkg-config
36 makeWrapper
37 ];
38
39 postFixup = ''
40 wrapProgram $out/bin/rustlings --suffix PATH : ${
41 lib.makeBinPath [
42 cargo
43 rustc
44 clippy
45 gcc
46 ]
47 }
48 '';
49
50 meta = {
51 description = "Explore the Rust programming language and learn more about it while doing exercises";
52 homepage = "https://rustlings.cool/";
53 changelog = "https://github.com/rust-lang/rustlings/releases";
54 license = lib.licenses.mit;
55 maintainers = with lib.maintainers; [ luftmensch-luftmensch ];
56 mainProgram = "rustlings";
57 };
58}