Switch to using rust-overlay

I need to enable nightly features, so this will let me do that.
This commit is contained in:
Kiana Sheibani 2023-08-27 04:30:45 -04:00
parent edcef12c2f
commit 349d63946c
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
2 changed files with 24 additions and 12 deletions

View file

@ -9,7 +9,9 @@
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"rust-overlay": "rust-overlay" "rust-overlay": [
"rust-overlay"
]
}, },
"locked": { "locked": {
"lastModified": 1692750383, "lastModified": 1692750383,
@ -79,26 +81,25 @@
"inputs": { "inputs": {
"crane": "crane", "crane": "crane",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
} }
}, },
"rust-overlay": { "rust-overlay": {
"inputs": { "inputs": {
"flake-utils": [ "flake-utils": [
"crane",
"flake-utils" "flake-utils"
], ],
"nixpkgs": [ "nixpkgs": [
"crane",
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1691374719, "lastModified": 1693102271,
"narHash": "sha256-HCodqnx1Mi2vN4f3hjRPc7+lSQy18vRn8xWW68GeQOg=", "narHash": "sha256-JuxJYl7zZ9FUOA/3Az5OPYWQfH9Y8SvtqqFnPKB6zUw=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "b520a3889b24aaf909e287d19d406862ced9ffc9", "rev": "1aac4029cfbc529f8b39c96d29fe1d09338f9110",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -3,17 +3,28 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils"; 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.url = "github:ipetkov/crane";
crane.inputs = { crane.inputs = {
nixpkgs.follows = "nixpkgs"; nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils"; 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: flake-utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; }; let pkgs = import nixpkgs {
craneLib = crane.lib.${system}; inherit system;
overlays = [ rust-overlay.overlays.default ];
};
rustToolchain = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default);
craneLib = crane.lib.${system}.overrideToolchain rustToolchain;
commonArgs = { commonArgs = {
version = "0.1.0"; version = "0.1.0";
@ -32,7 +43,7 @@
# Run clippy (and deny all warnings) on the crate source # Run clippy (and deny all warnings) on the crate source
runClippy = craneLib.cargoClippy (commonArgs // { runClippy = craneLib.cargoClippy (commonArgs // {
pname = "ggelo-clippy-check"; pname = "ggelo";
cargoClippyExtraArgs = "--all-targets -- --deny warnings"; cargoClippyExtraArgs = "--all-targets -- --deny warnings";
inherit cargoArtifacts; inherit cargoArtifacts;
}); });
@ -49,7 +60,7 @@
checks.runClippy = runClippy; checks.runClippy = runClippy;
devShells.default = pkgs.mkShell { 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"; PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
}; };
}); });