From 349d63946ce8eedef1af1312659c6d328d671856 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Sun, 27 Aug 2023 04:30:45 -0400 Subject: [PATCH] Switch to using rust-overlay I need to enable nightly features, so this will let me do that. --- flake.lock | 15 ++++++++------- flake.nix | 21 ++++++++++++++++----- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index 858eedf..96a2dc4 100644 --- a/flake.lock +++ b/flake.lock @@ -9,7 +9,9 @@ "nixpkgs": [ "nixpkgs" ], - "rust-overlay": "rust-overlay" + "rust-overlay": [ + "rust-overlay" + ] }, "locked": { "lastModified": 1692750383, @@ -79,26 +81,25 @@ "inputs": { "crane": "crane", "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" } }, "rust-overlay": { "inputs": { "flake-utils": [ - "crane", "flake-utils" ], "nixpkgs": [ - "crane", "nixpkgs" ] }, "locked": { - "lastModified": 1691374719, - "narHash": "sha256-HCodqnx1Mi2vN4f3hjRPc7+lSQy18vRn8xWW68GeQOg=", + "lastModified": 1693102271, + "narHash": "sha256-JuxJYl7zZ9FUOA/3Az5OPYWQfH9Y8SvtqqFnPKB6zUw=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "b520a3889b24aaf909e287d19d406862ced9ffc9", + "rev": "1aac4029cfbc529f8b39c96d29fe1d09338f9110", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index c7a5f70..e664663 100644 --- a/flake.nix +++ b/flake.nix @@ -3,17 +3,28 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; + rust-overlay.url = "github:oxalica/rust-overlay"; + rust-overlay.inputs = { + nixpkgs.follows = "nixpkgs"; + flake-utils.follows = "flake-utils"; + }; + crane.url = "github:ipetkov/crane"; crane.inputs = { nixpkgs.follows = "nixpkgs"; flake-utils.follows = "flake-utils"; + rust-overlay.follows = "rust-overlay"; }; }; - outputs = { self, nixpkgs, crane, flake-utils, ... }: + outputs = { self, nixpkgs, flake-utils, rust-overlay, crane, ... }: flake-utils.lib.eachDefaultSystem (system: - let pkgs = import nixpkgs { inherit system; }; - craneLib = crane.lib.${system}; + let pkgs = import nixpkgs { + inherit system; + overlays = [ rust-overlay.overlays.default ]; + }; + rustToolchain = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default); + craneLib = crane.lib.${system}.overrideToolchain rustToolchain; commonArgs = { version = "0.1.0"; @@ -32,7 +43,7 @@ # Run clippy (and deny all warnings) on the crate source runClippy = craneLib.cargoClippy (commonArgs // { - pname = "ggelo-clippy-check"; + pname = "ggelo"; cargoClippyExtraArgs = "--all-targets -- --deny warnings"; inherit cargoArtifacts; }); @@ -49,7 +60,7 @@ checks.runClippy = runClippy; devShells.default = pkgs.mkShell { - packages = with pkgs; [ rustc cargo pkg-config rust-analyzer ]; + packages = with pkgs; [ rustToolchain pkg-config rust-analyzer ]; PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; }; });