From 3c0ac8c4ee6422ab6f4832f2869300ad811916b6 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Mon, 8 May 2023 18:25:51 +0200 Subject: [PATCH] Switch to using nightly --- flake.lock | 71 ++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 24 +++++++++++---- rust-toolchain.toml | 3 ++ 3 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 rust-toolchain.toml diff --git a/flake.lock b/flake.lock index ef0b979..c9f42ef 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "naersk": { "inputs": { "nixpkgs": "nixpkgs" @@ -49,13 +67,49 @@ "type": "github" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1681358109, + "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "naersk": "naersk", "nixpkgs": "nixpkgs_2", + "rust-overlay": "rust-overlay", "utils": "utils" } }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1683512408, + "narHash": "sha256-QMJGp/37En+d5YocJuSU89GL14bBYkIJQ6mqhRfqkkc=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "75b07756c3feb22cf230e75fb064c1b4c725b9bc", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, @@ -71,9 +125,24 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "utils": { "inputs": { - "systems": "systems" + "systems": "systems_2" }, "locked": { "lastModified": 1681202837, diff --git a/flake.nix b/flake.nix index 13ff6a9..aa2221f 100644 --- a/flake.nix +++ b/flake.nix @@ -3,19 +3,33 @@ naersk.url = "github:nix-community/naersk/master"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; utils.url = "github:numtide/flake-utils"; + + rust-overlay.url = "github:oxalica/rust-overlay"; }; - outputs = { self, nixpkgs, utils, naersk }: + outputs = { self, nixpkgs, utils, naersk, rust-overlay }: utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { inherit system; }; - naersk-lib = pkgs.callPackage naersk { }; + + pkgs = import nixpkgs { + inherit system; + overlays = [ (import rust-overlay) ]; + }; + + toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + + naersk-lib = pkgs.callPackage naersk { + cargo = toolchain; + rustc = toolchain; + }; + in { defaultPackage = naersk-lib.buildPackage ./.; devShell = with pkgs; mkShell { - buildInputs = [ cargo rustc rustfmt pre-commit rustPackages.clippy ]; - RUST_SRC_PATH = rustPlatform.rustLibSrc; + nativeBuildInputs = [ + toolchain + ]; shellHook = '' export CARGO_HOME=$(pwd)/.cargo ''; diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..ce8c107 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "nightly-2023-05-08" +components = [ "rustfmt", "rustc-dev", "clippy", "cargo" ]