flake: use stock Nixpkgs Rust toolchain
This makes it easier to use Nixpkgs’ cross‐compilation machinery and simplifies the flake.
This commit is contained in:
parent
92b7440174
commit
a5c0301ee8
|
@ -1,3 +0,0 @@
|
|||
# For -Zbuild-std
|
||||
[target.aarch64-unknown-linux-musl]
|
||||
rustflags = ["-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc"]
|
38
flake.lock
38
flake.lock
|
@ -15,26 +15,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"fenix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"rust-analyzer-src": "rust-analyzer-src"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1738391509,
|
||||
"narHash": "sha256-TC3xA++KgprECm/WPsLUd+a77MObZPElCW6eAsjVW1k=",
|
||||
"rev": "de3ea31eb651b663449361f77d9c1e8835290470",
|
||||
"revCount": 2156,
|
||||
"type": "tarball",
|
||||
"url": "https://api.flakehub.com/f/pinned/nix-community/fenix/0.1.2156%2Brev-de3ea31eb651b663449361f77d9c1e8835290470/0194c095-0041-7b9c-b19e-cf1c4a2adaad/source.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://flakehub.com/f/nix-community/fenix/0.1.1727.tar.gz"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -190,27 +170,9 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"fenix": "fenix",
|
||||
"nix": "nix",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
}
|
||||
},
|
||||
"rust-analyzer-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1738224931,
|
||||
"narHash": "sha256-1zhfA5NBqin0Z79Se85juvqQteq7uClJMEb7l2pdDUY=",
|
||||
"owner": "rust-lang",
|
||||
"repo": "rust-analyzer",
|
||||
"rev": "3c2aca1e5e9fbabb4e05fc4baa62e807aadc476a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rust-lang",
|
||||
"ref": "nightly",
|
||||
"repo": "rust-analyzer",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
38
flake.nix
38
flake.nix
|
@ -4,11 +4,6 @@
|
|||
inputs = {
|
||||
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.tar.gz";
|
||||
|
||||
fenix = {
|
||||
url = "https://flakehub.com/f/nix-community/fenix/0.1.1727.tar.gz";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# Pinned to `master` until a release containing
|
||||
# <https://github.com/ipetkov/crane/pull/792> is cut.
|
||||
crane.url = "github:ipetkov/crane";
|
||||
|
@ -16,7 +11,7 @@
|
|||
nix.url = "https://flakehub.com/f/NixOS/nix/2.tar.gz";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, fenix, crane, ... }@inputs:
|
||||
outputs = { self, nixpkgs, crane, ... }@inputs:
|
||||
let
|
||||
supportedSystems = [
|
||||
"aarch64-linux"
|
||||
|
@ -35,27 +30,12 @@
|
|||
inherit (pkgs) lib;
|
||||
inherit system;
|
||||
});
|
||||
|
||||
fenixToolchain = system: with fenix.packages.${system};
|
||||
combine ([
|
||||
stable.clippy
|
||||
stable.rustc
|
||||
stable.cargo
|
||||
stable.rustfmt
|
||||
stable.rust-src
|
||||
stable.rust-analyzer
|
||||
] ++ nixpkgs.lib.optionals (system == "x86_64-linux") [
|
||||
targets.x86_64-unknown-linux-musl.stable.rust-std
|
||||
] ++ nixpkgs.lib.optionals (system == "aarch64-linux") [
|
||||
targets.aarch64-unknown-linux-musl.stable.rust-std
|
||||
]);
|
||||
in
|
||||
{
|
||||
|
||||
overlays.default = final: prev:
|
||||
let
|
||||
toolchain = fenixToolchain final.hostPlatform.system;
|
||||
craneLib = (crane.mkLib final).overrideToolchain toolchain;
|
||||
craneLib = crane.mkLib final;
|
||||
crateName = craneLib.crateNameFromCargoToml {
|
||||
cargoToml = ./magic-nix-cache/Cargo.toml;
|
||||
};
|
||||
|
@ -122,14 +102,14 @@
|
|||
createChain 200 startFile;
|
||||
});
|
||||
|
||||
devShells = forEachSupportedSystem ({ system, pkgs, lib }:
|
||||
let
|
||||
toolchain = fenixToolchain system;
|
||||
in
|
||||
{
|
||||
devShells = forEachSupportedSystem ({ system, pkgs, lib }: {
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
toolchain
|
||||
rustc
|
||||
cargo
|
||||
clippy
|
||||
rustfmt
|
||||
rust-analyzer
|
||||
|
||||
nix # for linking attic
|
||||
boost # for linking attic
|
||||
|
@ -149,7 +129,7 @@
|
|||
];
|
||||
|
||||
NIX_CFLAGS_LINK = lib.optionalString pkgs.stdenv.isDarwin "-lc++abi";
|
||||
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
|
||||
RUST_SRC_PATH = "${pkgs.rustPlatform.rustcSrc}/library";
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue