forked from rust-lang/cargo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
66 lines (65 loc) · 2.45 KB
/
Copy pathflake.nix
File metadata and controls
66 lines (65 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
description = "a flake to build libnix cargo";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
fenix.url = "github:nix-community/fenix";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ self, nixpkgs, flake-utils, fenix } @ inputs:
flake-utils.lib.eachDefaultSystem
(system:
let
project_root = ./.;
pkgs = import nixpkgs {
inherit system;
overlays = [
fenix.overlays.default
];
};
# 1_87_0_plus_v1_src
cargo-libnix-1_87_0_plus_v1_src = builtins.fetchTarball {
url = "https://github.com/nixcloud/cargo/releases/download/libnix-1.87.0%2Bv1/libnix-1.87.0+v1.tar.bz2";
sha256 = "sha256:1pa5yg6i5rk0f50f0syv3ci0864ca3w9ch60rx2q6mp7fy86h086";
};
cargo-libnix-1_87_0_plus_v1 = (import (cargo-libnix-1_87_0_plus_v1_src + "/derivations/default.nix"){
inherit project_root pkgs;
external_crate_dependencies = import (cargo-libnix-1_87_0_plus_v1_src + "/Cargo.dependencies.nix") { inherit pkgs; };
rustc = fenix.packages.${system}.stable.rustc;
cargo = fenix.packages.${system}.stable.cargo;
}).cargo-0_88_0-bin-b4cc6eeacb818d24;
external_crate_dependencies = { envs = {}; deps = {}; } // (
if builtins.pathExists ./Cargo.dependencies.nix
then import ./Cargo.dependencies.nix { inherit pkgs; }
else { });
# most recent development
in
with pkgs;
rec {
packages = { inherit cargo-libnix-1_87_0_plus_v1; };
devShells.default = mkShell {
buildInputs = [
# to build cargo with 'CARGO_BACKEND=legacy cargo build'
openssl
pkg-config
# git helper
tig
# the toolchain used
fenix.packages.${system}.stable.rustc
# your cargo compiler
#fenix.packages.${system}.stable.cargo
cargo-libnix-1_87_0_plus_v1
# comfy tools
fenix.packages.${system}.stable.rust-src
fenix.packages.${system}.stable.rustfmt
fenix.packages.${system}.stable.clippy
# used by cargo (libnix)
nix-prefetch-scripts
];
shellHook = ''
export CARGO_BACKEND=nix
'';
};
}
);
}