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"
|
"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-compat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -190,27 +170,9 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"crane": "crane",
|
"crane": "crane",
|
||||||
"fenix": "fenix",
|
|
||||||
"nix": "nix",
|
"nix": "nix",
|
||||||
"nixpkgs": "nixpkgs_2"
|
"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",
|
"root": "root",
|
||||||
|
|
38
flake.nix
38
flake.nix
|
@ -4,11 +4,6 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.tar.gz";
|
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
|
# Pinned to `master` until a release containing
|
||||||
# <https://github.com/ipetkov/crane/pull/792> is cut.
|
# <https://github.com/ipetkov/crane/pull/792> is cut.
|
||||||
crane.url = "github:ipetkov/crane";
|
crane.url = "github:ipetkov/crane";
|
||||||
|
@ -16,7 +11,7 @@
|
||||||
nix.url = "https://flakehub.com/f/NixOS/nix/2.tar.gz";
|
nix.url = "https://flakehub.com/f/NixOS/nix/2.tar.gz";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, fenix, crane, ... }@inputs:
|
outputs = { self, nixpkgs, crane, ... }@inputs:
|
||||||
let
|
let
|
||||||
supportedSystems = [
|
supportedSystems = [
|
||||||
"aarch64-linux"
|
"aarch64-linux"
|
||||||
|
@ -35,27 +30,12 @@
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
inherit system;
|
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
|
in
|
||||||
{
|
{
|
||||||
|
|
||||||
overlays.default = final: prev:
|
overlays.default = final: prev:
|
||||||
let
|
let
|
||||||
toolchain = fenixToolchain final.hostPlatform.system;
|
craneLib = crane.mkLib final;
|
||||||
craneLib = (crane.mkLib final).overrideToolchain toolchain;
|
|
||||||
crateName = craneLib.crateNameFromCargoToml {
|
crateName = craneLib.crateNameFromCargoToml {
|
||||||
cargoToml = ./magic-nix-cache/Cargo.toml;
|
cargoToml = ./magic-nix-cache/Cargo.toml;
|
||||||
};
|
};
|
||||||
|
@ -122,14 +102,14 @@
|
||||||
createChain 200 startFile;
|
createChain 200 startFile;
|
||||||
});
|
});
|
||||||
|
|
||||||
devShells = forEachSupportedSystem ({ system, pkgs, lib }:
|
devShells = forEachSupportedSystem ({ system, pkgs, lib }: {
|
||||||
let
|
|
||||||
toolchain = fenixToolchain system;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
toolchain
|
rustc
|
||||||
|
cargo
|
||||||
|
clippy
|
||||||
|
rustfmt
|
||||||
|
rust-analyzer
|
||||||
|
|
||||||
nix # for linking attic
|
nix # for linking attic
|
||||||
boost # for linking attic
|
boost # for linking attic
|
||||||
|
@ -149,7 +129,7 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
NIX_CFLAGS_LINK = lib.optionalString pkgs.stdenv.isDarwin "-lc++abi";
|
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