diff options
author | Akshay <[email protected]> | 2021-10-02 06:22:22 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2021-10-02 09:09:39 +0100 |
commit | 088559eedd40b16fff2ce97e48006580be39dd03 (patch) | |
tree | 46bb0ec90175d324e6b63d80f104e5ff9f42cea6 /flake.nix | |
parent | a60429891fe9eb5290f95a52dd5e56f62d25d344 (diff) |
update docs; nix-analyzer -> statix
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 114 |
1 files changed, 59 insertions, 55 deletions
@@ -6,71 +6,75 @@ | |||
6 | url = "github:mozilla/nixpkgs-mozilla"; | 6 | url = "github:mozilla/nixpkgs-mozilla"; |
7 | flake = false; | 7 | flake = false; |
8 | }; | 8 | }; |
9 | gitignore = { | ||
10 | url = "github:hercules-ci/gitignore"; | ||
11 | flake = false; | ||
12 | }; | ||
13 | flake-compat = { | 9 | flake-compat = { |
14 | url = "github:edolstra/flake-compat"; | 10 | url = "github:edolstra/flake-compat"; |
15 | flake = false; | 11 | flake = false; |
16 | }; | 12 | }; |
17 | }; | 13 | }; |
18 | 14 | ||
19 | outputs = { self, nixpkgs, utils, naersk, mozillapkgs, gitignore, ... }: | 15 | outputs = |
16 | { self | ||
17 | , nixpkgs | ||
18 | , utils | ||
19 | , naersk | ||
20 | , mozillapkgs | ||
21 | , ... | ||
22 | }: | ||
20 | utils.lib.eachDefaultSystem (system: | 23 | utils.lib.eachDefaultSystem (system: |
21 | let | 24 | let |
22 | pkgs = nixpkgs.legacyPackages."${system}"; | 25 | pkgs = nixpkgs.legacyPackages."${system}"; |
23 | inherit (import gitignore { inherit (pkgs) lib; }) gitignoreSource; | 26 | |
27 | # Get a specific rust version | ||
28 | mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") { }; | ||
29 | chanspec = { | ||
30 | date = "2021-03-31"; | ||
31 | channel = "nightly"; | ||
32 | sha256 = "oK5ebje09MRn988saJMT3Zze/tRE7u9zTeFPV1CEeLc="; # set zeros after modifying channel or date | ||
33 | }; | ||
34 | |||
35 | rustChannel = mozilla.rustChannelOf chanspec; | ||
36 | rust = rustChannel.rust; | ||
37 | rust-src = rustChannel.rust-src; | ||
38 | |||
39 | naersk-lib = naersk.lib."${system}".override { | ||
40 | cargo = rust; | ||
41 | rustc = rust; | ||
42 | }; | ||
24 | 43 | ||
25 | # Get a specific rust version | 44 | nativeBuildInputs = with pkgs; [ ]; |
26 | mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") { }; | ||
27 | chanspec = { | ||
28 | date = "2021-03-31"; | ||
29 | channel = "nightly"; | ||
30 | sha256 = "oK5ebje09MRn988saJMT3Zze/tRE7u9zTeFPV1CEeLc="; # set zeros after modifying channel or date | ||
31 | }; | ||
32 | 45 | ||
33 | rustChannel = mozilla.rustChannelOf chanspec; | 46 | in |
34 | rust = rustChannel.rust; | 47 | rec { |
35 | rust-src = rustChannel.rust-src; | 48 | packages.statix = naersk-lib.buildPackage { |
49 | pname = "statix"; | ||
50 | version = "0.1.0"; | ||
51 | root = ./.; | ||
52 | inherit nativeBuildInputs; | ||
53 | }; | ||
36 | 54 | ||
37 | naersk-lib = naersk.lib."${system}".override { | 55 | defaultPackage = packages.statix; |
38 | cargo = rust; | 56 | apps.statix = utils.lib.mkApp { |
39 | rustc = rust; | 57 | drv = packages.statix; |
40 | }; | 58 | }; |
41 | 59 | ||
42 | nativeBuildInputs = with pkgs; [ ]; | 60 | apps.check = { |
61 | type = "app"; | ||
62 | program = "${pkgs.cargo-watch}/bin/cargo-watch"; | ||
63 | }; | ||
43 | 64 | ||
44 | in | 65 | defaultApp = apps.statix; |
45 | rec { | 66 | devShell = pkgs.mkShell { |
46 | packages.nix-analyzer = naersk-lib.buildPackage { | 67 | nativeBuildInputs = nativeBuildInputs ++ [ |
47 | pname = "nix-analyzer"; | 68 | rust |
48 | version = "0.1.0"; | 69 | rust-src |
49 | root = gitignoreSource ./.; | 70 | pkgs.rust-analyzer |
50 | inherit nativeBuildInputs; | 71 | pkgs.rustfmt |
51 | }; | 72 | pkgs.cargo |
52 | defaultPackage = packages.nix-analyzer; | 73 | pkgs.cargo-watch |
53 | apps.nix-analyzer = utils.lib.mkApp { | 74 | ]; |
54 | drv = packages.nix-analyzer; | 75 | RUST_SRC_PATH = "${rust-src}/lib/rustlib/src/rust/library"; |
55 | }; | 76 | RUST_LOG = "info"; |
56 | apps.check = { | 77 | RUST_BACKTRACE = 1; |
57 | type = "app"; | 78 | }; |
58 | program = "${pkgs.cargo-watch}/bin/cargo-watch"; | 79 | }); |
59 | }; | ||
60 | defaultApp = apps.nix-analyzer; | ||
61 | devShell = pkgs.mkShell { | ||
62 | nativeBuildInputs = nativeBuildInputs ++ [ | ||
63 | rust | ||
64 | rust-src | ||
65 | pkgs.rust-analyzer | ||
66 | pkgs.rustfmt | ||
67 | pkgs.cargo | ||
68 | pkgs.cargo-watch | ||
69 | pkgs.cargo-tarpaulin | ||
70 | ]; | ||
71 | RUST_SRC_PATH = "${rust-src}/lib/rustlib/src/rust/library"; | ||
72 | RUST_LOG = "info"; | ||
73 | RUST_BACKTRACE = 1; | ||
74 | }; | ||
75 | }); | ||
76 | } | 80 | } |