refactor!: improve rust flake further
This commit is contained in:
parent
6a45c8c099
commit
e9832d91b2
3 changed files with 28 additions and 20 deletions
|
|
@ -1,10 +0,0 @@
|
||||||
# This line needs to come before anything else in Cargo.toml
|
|
||||||
cargo-features = ["codegen-backend"]
|
|
||||||
|
|
||||||
[package]
|
|
||||||
name = "example"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2024"
|
|
||||||
|
|
||||||
[profile.dev]
|
|
||||||
codegen-backend = "cranelift"
|
|
||||||
|
|
@ -2,7 +2,14 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
rust-overlay = {
|
||||||
|
url = "github:oxalica/rust-overlay";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
# wild = {
|
||||||
|
# url = "github:davidlattimore/wild";
|
||||||
|
# inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
# };
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs:
|
outputs = inputs:
|
||||||
|
|
@ -39,7 +46,8 @@
|
||||||
|
|
||||||
mkDevShell = rustc:
|
mkDevShell = rustc:
|
||||||
pkgs.mkShell.override {
|
pkgs.mkShell.override {
|
||||||
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.clangStdenv;
|
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.stdenv;
|
||||||
|
# stdenv = pkgs.useWildLinker pkgs.stdenv;
|
||||||
} {
|
} {
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc}
|
export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc}
|
||||||
|
|
@ -50,7 +58,10 @@
|
||||||
in {
|
in {
|
||||||
_module.args.pkgs = import inputs.nixpkgs {
|
_module.args.pkgs = import inputs.nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
overlays = [(import inputs.rust-overlay)];
|
overlays = [
|
||||||
|
(import inputs.rust-overlay)
|
||||||
|
# inputs.wild.overlays.default
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
packages.default = self'.packages.example;
|
packages.default = self'.packages.example;
|
||||||
|
|
@ -58,10 +69,20 @@
|
||||||
|
|
||||||
packages.example = rustPackage "";
|
packages.example = rustPackage "";
|
||||||
|
|
||||||
devShells.nightly = mkDevShell ((pkgs.rust-bin.selectLatestNightlyWith
|
devShells.nightly = let
|
||||||
(toolchain: toolchain.default)).override {
|
nightly = (pkgs.rust-bin.selectLatestNightlyWith
|
||||||
extensions = ["rustc-codegen-cranelift-preview"];
|
(toolchain: toolchain.default)).override {
|
||||||
});
|
extensions = ["rustc-codegen-cranelift-preview"];
|
||||||
|
};
|
||||||
|
devShell = mkDevShell nightly;
|
||||||
|
in
|
||||||
|
devShell.overrideAttrs (old: {
|
||||||
|
shellHook =
|
||||||
|
old.shellHook or ""
|
||||||
|
+ ''
|
||||||
|
export RUSTFLAGS="-Zcodegen-backend=cranelift"
|
||||||
|
'';
|
||||||
|
});
|
||||||
devShells.stable = mkDevShell pkgs.rust-bin.stable.latest.default;
|
devShells.stable = mkDevShell pkgs.rust-bin.stable.latest.default;
|
||||||
devShells.msrv = mkDevShell pkgs.rust-bin.stable.${msrv}.default;
|
devShells.msrv = mkDevShell pkgs.rust-bin.stable.${msrv}.default;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
fn main() {
|
|
||||||
println!("Hello World!")
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue