diff options
author | Akshay <[email protected]> | 2021-10-23 08:48:03 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2021-10-23 08:48:03 +0100 |
commit | 05b11f14b7f4a3d8c1ab68fb0846ae881433b326 (patch) | |
tree | dcc80687438718e55d2af79034748a86bf32c55e | |
parent | c2f0582d1907dbef69e9ad42ba9d4301337fe1e8 (diff) |
simplify flake
-rw-r--r-- | bin/src/config.rs | 2 | ||||
-rw-r--r-- | flake.nix | 21 |
2 files changed, 14 insertions, 9 deletions
diff --git a/bin/src/config.rs b/bin/src/config.rs index 077f73e..cb03a4b 100644 --- a/bin/src/config.rs +++ b/bin/src/config.rs | |||
@@ -11,7 +11,7 @@ use vfs::ReadOnlyVfs; | |||
11 | 11 | ||
12 | use crate::err::ConfigErr; | 12 | use crate::err::ConfigErr; |
13 | 13 | ||
14 | /// Static analysis and linting for the nix programming language | 14 | /// Lints and suggestions for the Nix programming language |
15 | #[derive(Clap, Debug)] | 15 | #[derive(Clap, Debug)] |
16 | #[clap(version = "0.1.0", author = "Akshay <[email protected]>")] | 16 | #[clap(version = "0.1.0", author = "Akshay <[email protected]>")] |
17 | pub struct Opts { | 17 | pub struct Opts { |
@@ -21,6 +21,7 @@ | |||
21 | }: | 21 | }: |
22 | let | 22 | let |
23 | inherit (import-cargo.builders) importCargo; | 23 | inherit (import-cargo.builders) importCargo; |
24 | |||
24 | supportedSystems = [ "x86_64-linux" ]; | 25 | supportedSystems = [ "x86_64-linux" ]; |
25 | forAllSystems = nixpkgs.lib.genAttrs supportedSystems; | 26 | forAllSystems = nixpkgs.lib.genAttrs supportedSystems; |
26 | nixpkgsFor = forAllSystems (system: | 27 | nixpkgsFor = forAllSystems (system: |
@@ -28,26 +29,31 @@ | |||
28 | inherit system; | 29 | inherit system; |
29 | overlays = [ self.overlay ]; | 30 | overlays = [ self.overlay ]; |
30 | }); | 31 | }); |
32 | |||
31 | mozilla = p: p.callPackage (mozillapkgs + "/package-set.nix") { }; | 33 | mozilla = p: p.callPackage (mozillapkgs + "/package-set.nix") { }; |
32 | chanspec = { | 34 | chanspec = { |
33 | date = "2021-09-30"; | 35 | date = "2021-09-30"; |
34 | channel = "nightly"; | 36 | channel = "nightly"; |
35 | sha256 = "Elqn7GDBDE/QT1XTDyj0EvivbC//uwjWX8d+J3Pi0dY="; # set zeros after modifying channel or date | 37 | sha256 = "Elqn7GDBDE/QT1XTDyj0EvivbC//uwjWX8d+J3Pi0dY="; # set zeros after modifying channel or date |
36 | }; | 38 | }; |
39 | rustChannel = p: (mozilla p).rustChannelOf chanspec; | ||
40 | |||
37 | in | 41 | in |
38 | { | 42 | { |
39 | 43 | ||
40 | overlay = final: prev: | 44 | overlay = final: prev: |
41 | let | 45 | let |
42 | rustChannel = (mozilla final.pkgs).rustChannelOf chanspec; | 46 | inherit (rustChannel final.pkgs) rust rust-src; |
43 | inherit (rustChannel) rust rustc rust-src; | ||
44 | in | 47 | in |
45 | { | 48 | { |
46 | 49 | ||
47 | statix = with final; pkgs.stdenv.mkDerivation { | 50 | statix = with final; pkgs.stdenv.mkDerivation { |
48 | pname = "statix"; | 51 | pname = "statix"; |
49 | version = "v0.1.0"; | 52 | version = "v0.1.0"; |
50 | src = ./.; | 53 | src = builtins.path { |
54 | path = ./.; | ||
55 | name = "statix"; | ||
56 | }; | ||
51 | nativeBuildInputs = [ | 57 | nativeBuildInputs = [ |
52 | (importCargo { lockFile = ./Cargo.lock; inherit pkgs; }).cargoHome | 58 | (importCargo { lockFile = ./Cargo.lock; inherit pkgs; }).cargoHome |
53 | rust | 59 | rust |
@@ -73,21 +79,20 @@ | |||
73 | devShell = forAllSystems (system: | 79 | devShell = forAllSystems (system: |
74 | let | 80 | let |
75 | pkgs = nixpkgsFor.${system}; | 81 | pkgs = nixpkgsFor.${system}; |
76 | rustChannel = (mozilla pkgs).rustChannelOf chanspec; | 82 | inherit (rustChannel pkgs) rust rust-src; |
77 | in | 83 | in |
78 | with pkgs; | 84 | with pkgs; |
79 | mkShell rec { | 85 | mkShell rec { |
80 | buildInputs = | 86 | buildInputs = |
81 | (with pkgs; [ | 87 | [ |
82 | rust-analyzer | 88 | rust-analyzer |
83 | rustfmt | 89 | rustfmt |
84 | cargo | 90 | cargo |
85 | cargo-watch | 91 | cargo-watch |
86 | ]) ++ (with rustChannel; [ | ||
87 | rust | 92 | rust |
88 | rust-src | 93 | rust-src |
89 | ]); | 94 | ]; |
90 | RUST_SRC_PATH = "${rustChannel.rust-src}/lib/rustlib/src/rust/library"; | 95 | RUST_SRC_PATH = "${rust-src}/lib/rustlib/src/rust/library"; |
91 | RUST_LOG = "info"; | 96 | RUST_LOG = "info"; |
92 | RUST_BACKTRACE = 1; | 97 | RUST_BACKTRACE = 1; |
93 | }); | 98 | }); |