rust: fix for nix2.8

This commit is contained in:
Sam W 2022-05-20 13:45:39 +01:00
parent ffeb072222
commit 7422dcaf19
1 changed files with 14 additions and 8 deletions

View File

@ -11,23 +11,29 @@
outputs = { self, nixpkgs, utils, naersk, devshell, rust-overlay }: outputs = { self, nixpkgs, utils, naersk, devshell, rust-overlay }:
utils.lib.eachDefaultSystem (system: utils.lib.eachDefaultSystem (system:
let let
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs {
rust = rust-bin.stable.latest.default; inherit system;
overlays = [ (import rust-overlay) ];
};
rust = pkgs.rust-bin.stable.latest.default;
# Override naersk to use our chosen rust version from rust-overlay
naersk-lib = naersk.lib.${system}.override { naersk-lib = naersk.lib.${system}.override {
cargo = rust; cargo = rust;
rust = rust; rustc = rust;
};
in rec {
packages.default = naersk-lib.buildPackage {
pname = "cool-rust-disaster";
root = ./.;
}; };
in {
defaultPackage = naersk-lib.buildPackage ./.;
defaultApp = utils.lib.mkApp { drv = self.defaultPackage."${system}"; }; apps.default = utils.lib.mkApp { drv = packages.default; };
# Provide a dev env with rust and rls # Provide a dev env with rust and rls
devShell = let devShell = let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
overlays = [ devshell.overlay ];
overlays = [ devshell.overlay (import rust-overlay) ];
}; };
in pkgs.devshell.mkShell { in pkgs.devshell.mkShell {
packages = with pkgs; [ (rust.override { extensions = [ "rls" ]; }) ]; packages = with pkgs; [ (rust.override { extensions = [ "rls" ]; }) ];