From 7fd8d42918de6fe1ba451fb2055e1707f1ebcabd Mon Sep 17 00:00:00 2001 From: Ashhhleyyy Date: Thu, 8 Dec 2022 19:33:27 +0000 Subject: [PATCH] fix: rust-analyzer --- flake.lock | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 17 +++++++++++------ 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index e29b492..ac0965d 100644 --- a/flake.lock +++ b/flake.lock @@ -69,6 +69,21 @@ "type": "github" } }, + "flake-utils_3": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1669809720, @@ -85,11 +100,28 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1665296151, + "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "crane": "crane", "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay_2" } }, "rust-overlay": { @@ -116,6 +148,25 @@ "repo": "rust-overlay", "type": "github" } + }, + "rust-overlay_2": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1670380307, + "narHash": "sha256-7fJN5ndnE8YbrrtYdqMo3gDV/BW37M4wNBRhjdfP/XY=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "fc98242f5f49d39b8fd3a611c146741a35dc012d", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 5c00470..70bcf47 100644 --- a/flake.nix +++ b/flake.nix @@ -3,14 +3,16 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; crane.url = "github:ipetkov/crane"; crane.inputs.nixpkgs.follows = "nixpkgs"; + rust-overlay.url = "github:oxalica/rust-overlay"; flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, crane, flake-utils }: + outputs = { self, nixpkgs, crane, rust-overlay, flake-utils }: flake-utils.lib.eachDefaultSystem (system: let + overlays = [ (import rust-overlay) ]; pkgs = import nixpkgs { - system = system; + inherit system overlays; }; inherit (pkgs) lib; @@ -20,6 +22,7 @@ buildInputs = [ pkgs.bintools + rust-toolchain ] ++ lib.optionals pkgs.stdenv.isDarwin [ # Additional darwin specific inputs can be set here pkgs.libiconv @@ -34,6 +37,11 @@ aoc-2022 = craneLib.buildPackage { inherit cargoArtifacts src buildInputs; }; + + rust-toolchain = pkgs.rust-bin.stable.latest.default; + rust-dev-toolchain = pkgs.rust-bin.stable.latest.default.override { + extensions = [ "rust-src" "rust-analyzer" ]; + }; in { checks = { @@ -68,10 +76,7 @@ # Extra inputs can be added here nativeBuildInputs = with pkgs; [ - cargo - cargo-expand - rustc - rustfmt + rust-dev-toolchain bintools ]; };