aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-10-02 06:22:22 +0100
committerAkshay <[email protected]>2021-10-02 09:09:39 +0100
commit088559eedd40b16fff2ce97e48006580be39dd03 (patch)
tree46bb0ec90175d324e6b63d80f104e5ff9f42cea6
parenta60429891fe9eb5290f95a52dd5e56f62d25d344 (diff)
update docs; nix-analyzer -> statix
-rw-r--r--flake.lock17
-rw-r--r--flake.nix114
-rw-r--r--readme.md12
3 files changed, 65 insertions, 78 deletions
diff --git a/flake.lock b/flake.lock
index 8ba571c..54aabdc 100644
--- a/flake.lock
+++ b/flake.lock
@@ -16,22 +16,6 @@
16 "type": "github" 16 "type": "github"
17 } 17 }
18 }, 18 },
19 "gitignore": {
20 "flake": false,
21 "locked": {
22 "lastModified": 1611672876,
23 "narHash": "sha256-qHu3uZ/o9jBHiA3MEKHJ06k7w4heOhA+4HCSIvflRxo=",
24 "owner": "hercules-ci",
25 "repo": "gitignore",
26 "rev": "211907489e9f198594c0eb0ca9256a1949c9d412",
27 "type": "github"
28 },
29 "original": {
30 "owner": "hercules-ci",
31 "repo": "gitignore",
32 "type": "github"
33 }
34 },
35 "mozillapkgs": { 19 "mozillapkgs": {
36 "flake": false, 20 "flake": false,
37 "locked": { 21 "locked": {
@@ -97,7 +81,6 @@
97 "root": { 81 "root": {
98 "inputs": { 82 "inputs": {
99 "flake-compat": "flake-compat", 83 "flake-compat": "flake-compat",
100 "gitignore": "gitignore",
101 "mozillapkgs": "mozillapkgs", 84 "mozillapkgs": "mozillapkgs",
102 "naersk": "naersk", 85 "naersk": "naersk",
103 "nixpkgs": "nixpkgs_2", 86 "nixpkgs": "nixpkgs_2",
diff --git a/flake.nix b/flake.nix
index ceccfc8..82d7a1f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -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}
diff --git a/readme.md b/readme.md
index 9a9e0ca..76c633a 100644
--- a/readme.md
+++ b/readme.md
@@ -1,15 +1,15 @@
1## nix-analyzer 1## statix
2 2
3`nix-analyzer` intends to be a static analysis tool for the 3`statix` intends to be a static analysis tool for the
4Nix programming language. 4Nix programming language.
5 5
6For the time-being, `nix-analyzer` works only with ASTs 6For the time-being, `statix` works only with ASTs
7produced by the `rnix-parser` crate and does not evaluate 7produced by the `rnix-parser` crate and does not evaluate
8any nix code. 8any nix code (imports, attr sets etc.).
9 9
10## Architecture 10## Architecture
11 11
12`nix-analyzer` has the following components: 12`statix` has the following components:
13 13
14- `bin`: the CLI/entrypoint 14- `bin`: the CLI/entrypoint
15- `lib`: library of lints and utilities to define these 15- `lib`: library of lints and utilities to define these
@@ -18,7 +18,7 @@ any nix code.
18 18
19### `bin` 19### `bin`
20 20
21This is the main point of interaction between `nix-analyzer` 21This is the main point of interaction between `statix`
22and the end user. It's output is human-readable and should 22and the end user. It's output is human-readable and should
23also support JSON/errorfmt outputs for external tools to 23also support JSON/errorfmt outputs for external tools to
24use. 24use.