diff options
author | Rutger Broekhoff | 2024-01-26 00:03:47 +0100 |
---|---|---|
committer | Rutger Broekhoff | 2024-01-26 00:03:47 +0100 |
commit | c3d120445877b307f5ea7e95aed4bab45d7dede0 (patch) | |
tree | cea88a96d20f1f167b68e68b0561df34623f8df2 | |
parent | 0451973538c92d260cf887392ebdf6b16b8ec772 (diff) | |
download | gitolfs3-c3d120445877b307f5ea7e95aed4bab45d7dede0.tar.gz gitolfs3-c3d120445877b307f5ea7e95aed4bab45d7dede0.zip |
Make rust-analyzer work again
-rw-r--r-- | flake.lock | 26 | ||||
-rw-r--r-- | flake.nix | 36 |
2 files changed, 52 insertions, 10 deletions
@@ -71,7 +71,31 @@ | |||
71 | "advisory-db": "advisory-db", | 71 | "advisory-db": "advisory-db", |
72 | "crane": "crane", | 72 | "crane": "crane", |
73 | "flake-utils": "flake-utils", | 73 | "flake-utils": "flake-utils", |
74 | "nixpkgs": "nixpkgs" | 74 | "nixpkgs": "nixpkgs", |
75 | "rust-overlay": "rust-overlay" | ||
76 | } | ||
77 | }, | ||
78 | "rust-overlay": { | ||
79 | "inputs": { | ||
80 | "flake-utils": [ | ||
81 | "flake-utils" | ||
82 | ], | ||
83 | "nixpkgs": [ | ||
84 | "nixpkgs" | ||
85 | ] | ||
86 | }, | ||
87 | "locked": { | ||
88 | "lastModified": 1706149103, | ||
89 | "narHash": "sha256-Me28A0tAb1EzZIozfi31+hnsQIaYU0HXaMPWCe+zByc=", | ||
90 | "owner": "oxalica", | ||
91 | "repo": "rust-overlay", | ||
92 | "rev": "493cc67d5e9f1b298241b8d92aa06883296acc3f", | ||
93 | "type": "github" | ||
94 | }, | ||
95 | "original": { | ||
96 | "owner": "oxalica", | ||
97 | "repo": "rust-overlay", | ||
98 | "type": "github" | ||
75 | } | 99 | } |
76 | }, | 100 | }, |
77 | "systems": { | 101 | "systems": { |
@@ -2,24 +2,39 @@ | |||
2 | inputs = { | 2 | inputs = { |
3 | nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2311.*.tar.gz"; | 3 | nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2311.*.tar.gz"; |
4 | flake-utils.url = "https://flakehub.com/f/numtide/flake-utils/0.1.90.tar.gz"; | 4 | flake-utils.url = "https://flakehub.com/f/numtide/flake-utils/0.1.90.tar.gz"; |
5 | crane.url = "https://flakehub.com/f/ipetkov/crane/0.16.0.tar.gz"; | 5 | |
6 | crane.inputs.nixpkgs.follows = "nixpkgs"; | 6 | crane = { |
7 | url = "https://flakehub.com/f/ipetkov/crane/0.16.0.tar.gz"; | ||
8 | inputs.nixpkgs.follows = "nixpkgs"; | ||
9 | }; | ||
10 | |||
7 | advisory-db = { | 11 | advisory-db = { |
8 | url = "github:rustsec/advisory-db"; | 12 | url = "github:rustsec/advisory-db"; |
9 | flake = false; | 13 | flake = false; |
10 | }; | 14 | }; |
15 | |||
16 | rust-overlay = { | ||
17 | url = "github:oxalica/rust-overlay"; | ||
18 | inputs = { | ||
19 | nixpkgs.follows = "nixpkgs"; | ||
20 | flake-utils.follows = "flake-utils"; | ||
21 | }; | ||
22 | }; | ||
11 | }; | 23 | }; |
12 | 24 | ||
13 | outputs = { self, nixpkgs, flake-utils, crane, advisory-db, ... }@inputs: | 25 | outputs = { self, nixpkgs, flake-utils, crane, rust-overlay, advisory-db, ... }@inputs: |
14 | flake-utils.lib.eachDefaultSystem | 26 | flake-utils.lib.eachDefaultSystem |
15 | (system: | 27 | (system: |
16 | let | 28 | let |
17 | pkgs = import nixpkgs { | 29 | pkgs = import nixpkgs { |
18 | inherit system; | 30 | inherit system; |
19 | overlays = [ ]; | 31 | overlays = [ (import rust-overlay) ]; |
20 | }; | 32 | }; |
21 | 33 | ||
22 | craneLib = crane.lib.${system}; | 34 | rustToolchain = pkgs.rust-bin.stable.latest.default.override { |
35 | extensions = [ "rust-src" ]; | ||
36 | }; | ||
37 | craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; | ||
23 | src = craneLib.cleanCargoSource (craneLib.path ./.); | 38 | src = craneLib.cleanCargoSource (craneLib.path ./.); |
24 | 39 | ||
25 | commonArgs = { | 40 | commonArgs = { |
@@ -44,19 +59,19 @@ | |||
44 | inherit cargoArtifacts; | 59 | inherit cargoArtifacts; |
45 | cargoClippyExtraArgs = "--all-targets -- --deny warnings"; | 60 | cargoClippyExtraArgs = "--all-targets -- --deny warnings"; |
46 | }); | 61 | }); |
47 | 62 | ||
48 | gitolfs3-doc = craneLib.cargoDoc (commonArgs // { | 63 | gitolfs3-doc = craneLib.cargoDoc (commonArgs // { |
49 | inherit cargoArtifacts; | 64 | inherit cargoArtifacts; |
50 | }); | 65 | }); |
51 | 66 | ||
52 | # Check formatting | 67 | # Check formatting |
53 | gitolfs3-fmt = craneLib.cargoFmt commonArgs; | 68 | gitolfs3-fmt = craneLib.cargoFmt commonArgs; |
54 | 69 | ||
55 | # Audit dependencies | 70 | # Audit dependencies |
56 | gitolfs3-audit = craneLib.cargoAudit (commonArgs // { | 71 | gitolfs3-audit = craneLib.cargoAudit (commonArgs // { |
57 | inherit advisory-db; | 72 | inherit advisory-db; |
58 | }); | 73 | }); |
59 | 74 | ||
60 | # Run tests with cargo-nextest | 75 | # Run tests with cargo-nextest |
61 | gitolfs3-nextest = craneLib.cargoNextest (commonArgs // { | 76 | gitolfs3-nextest = craneLib.cargoNextest (commonArgs // { |
62 | inherit cargoArtifacts; | 77 | inherit cargoArtifacts; |
@@ -70,6 +85,9 @@ | |||
70 | 85 | ||
71 | devShells.default = craneLib.devShell { | 86 | devShells.default = craneLib.devShell { |
72 | checks = self.checks.${system}; | 87 | checks = self.checks.${system}; |
88 | |||
89 | packages = [ rustToolchain pkgs.rust-analyzer ]; | ||
90 | RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library"; | ||
73 | }; | 91 | }; |
74 | 92 | ||
75 | formatter = pkgs.nixpkgs-fmt; | 93 | formatter = pkgs.nixpkgs-fmt; |