ditch crate2nix, use fenix instead of oxalica/rust-overlay
This commit is contained in:
parent
c4019f7b74
commit
61653794e1
2 changed files with 70 additions and 85 deletions
54
flake.nix
54
flake.nix
|
@ -4,14 +4,10 @@
|
|||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
crate2nix = {
|
||||
url = "github:kolloch/crate2nix";
|
||||
flake = false;
|
||||
};
|
||||
fenix.url = "github:nix-community/fenix";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, utils, rust-overlay, crate2nix }: let
|
||||
outputs = { self, nixpkgs, utils, fenix }: let
|
||||
name = "transbeam";
|
||||
in
|
||||
utils.lib.eachDefaultSystem
|
||||
|
@ -19,22 +15,13 @@
|
|||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
rust-overlay.overlays.default
|
||||
(final: prev: {
|
||||
rustc = final.rust-bin.stable.latest.default;
|
||||
cargo = final.rust-bin.stable.latest.default;
|
||||
})
|
||||
];
|
||||
overlays = [ fenix.overlays.default ];
|
||||
};
|
||||
fenixStable = fenix.packages.${system}.stable;
|
||||
fenixPlatform = pkgs.makeRustPlatform {
|
||||
cargo = fenixStable.toolchain;
|
||||
rustc = fenixStable.toolchain;
|
||||
};
|
||||
inherit (import "${crate2nix}/tools.nix" { inherit pkgs; })
|
||||
generatedCargoNix;
|
||||
project = import
|
||||
(generatedCargoNix {
|
||||
inherit name;
|
||||
src = ./.;
|
||||
})
|
||||
{ inherit pkgs; };
|
||||
in rec {
|
||||
packages.${name} = pkgs.symlinkJoin {
|
||||
inherit name;
|
||||
|
@ -49,7 +36,14 @@
|
|||
|
||||
defaultPackage = packages.${name};
|
||||
|
||||
packages."${name}-unwrapped" = project.rootCrate.build;
|
||||
packages."${name}-unwrapped" = let
|
||||
cargoTOML = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
||||
in fenixPlatform.buildRustPackage {
|
||||
pname = name;
|
||||
inherit (cargoTOML.package) version;
|
||||
src = ./.;
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
};
|
||||
|
||||
packages."${name}-cli" = with pkgs.python3Packages; buildPythonApplication {
|
||||
pname = "${name}-cli";
|
||||
|
@ -61,11 +55,18 @@
|
|||
src = ./cli;
|
||||
};
|
||||
|
||||
devShell = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
devShell = with pkgs; let
|
||||
fenixWith = fenixStable.withComponents [
|
||||
"cargo"
|
||||
"clippy"
|
||||
"rust-src"
|
||||
"rustc"
|
||||
"rustfmt"
|
||||
];
|
||||
in mkShell {
|
||||
nativeBuildInputs = [
|
||||
stdenv.cc
|
||||
rustc
|
||||
cargo
|
||||
fenixWith
|
||||
cargo-audit
|
||||
cargo-flamegraph
|
||||
(python3.withPackages (p: with p; [
|
||||
|
@ -73,7 +74,6 @@
|
|||
websockets
|
||||
]))
|
||||
];
|
||||
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue