update docs; nix-analyzer -> statix

This commit is contained in:
Akshay 2021-10-02 10:52:22 +05:30
parent a60429891f
commit 088559eedd
3 changed files with 65 additions and 78 deletions

View File

@ -16,22 +16,6 @@
"type": "github"
}
},
"gitignore": {
"flake": false,
"locked": {
"lastModified": 1611672876,
"narHash": "sha256-qHu3uZ/o9jBHiA3MEKHJ06k7w4heOhA+4HCSIvflRxo=",
"owner": "hercules-ci",
"repo": "gitignore",
"rev": "211907489e9f198594c0eb0ca9256a1949c9d412",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore",
"type": "github"
}
},
"mozillapkgs": {
"flake": false,
"locked": {
@ -97,7 +81,6 @@
"root": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"mozillapkgs": "mozillapkgs",
"naersk": "naersk",
"nixpkgs": "nixpkgs_2",

114
flake.nix
View File

@ -6,71 +6,75 @@
url = "github:mozilla/nixpkgs-mozilla";
flake = false;
};
gitignore = {
url = "github:hercules-ci/gitignore";
flake = false;
};
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, utils, naersk, mozillapkgs, gitignore, ... }:
outputs =
{ self
, nixpkgs
, utils
, naersk
, mozillapkgs
, ...
}:
utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}";
inherit (import gitignore { inherit (pkgs) lib; }) gitignoreSource;
let
pkgs = nixpkgs.legacyPackages."${system}";
# Get a specific rust version
mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") { };
chanspec = {
date = "2021-03-31";
channel = "nightly";
sha256 = "oK5ebje09MRn988saJMT3Zze/tRE7u9zTeFPV1CEeLc="; # set zeros after modifying channel or date
};
# Get a specific rust version
mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") { };
chanspec = {
date = "2021-03-31";
channel = "nightly";
sha256 = "oK5ebje09MRn988saJMT3Zze/tRE7u9zTeFPV1CEeLc="; # set zeros after modifying channel or date
};
rustChannel = mozilla.rustChannelOf chanspec;
rust = rustChannel.rust;
rust-src = rustChannel.rust-src;
rustChannel = mozilla.rustChannelOf chanspec;
rust = rustChannel.rust;
rust-src = rustChannel.rust-src;
naersk-lib = naersk.lib."${system}".override {
cargo = rust;
rustc = rust;
};
naersk-lib = naersk.lib."${system}".override {
cargo = rust;
rustc = rust;
};
nativeBuildInputs = with pkgs; [ ];
nativeBuildInputs = with pkgs; [ ];
in
rec {
packages.nix-analyzer = naersk-lib.buildPackage {
pname = "nix-analyzer";
version = "0.1.0";
root = gitignoreSource ./.;
inherit nativeBuildInputs;
};
defaultPackage = packages.nix-analyzer;
apps.nix-analyzer = utils.lib.mkApp {
drv = packages.nix-analyzer;
};
apps.check = {
type = "app";
program = "${pkgs.cargo-watch}/bin/cargo-watch";
};
defaultApp = apps.nix-analyzer;
devShell = pkgs.mkShell {
nativeBuildInputs = nativeBuildInputs ++ [
rust
rust-src
pkgs.rust-analyzer
pkgs.rustfmt
pkgs.cargo
pkgs.cargo-watch
pkgs.cargo-tarpaulin
];
RUST_SRC_PATH = "${rust-src}/lib/rustlib/src/rust/library";
RUST_LOG = "info";
RUST_BACKTRACE = 1;
};
});
in
rec {
packages.statix = naersk-lib.buildPackage {
pname = "statix";
version = "0.1.0";
root = ./.;
inherit nativeBuildInputs;
};
defaultPackage = packages.statix;
apps.statix = utils.lib.mkApp {
drv = packages.statix;
};
apps.check = {
type = "app";
program = "${pkgs.cargo-watch}/bin/cargo-watch";
};
defaultApp = apps.statix;
devShell = pkgs.mkShell {
nativeBuildInputs = nativeBuildInputs ++ [
rust
rust-src
pkgs.rust-analyzer
pkgs.rustfmt
pkgs.cargo
pkgs.cargo-watch
];
RUST_SRC_PATH = "${rust-src}/lib/rustlib/src/rust/library";
RUST_LOG = "info";
RUST_BACKTRACE = 1;
};
});
}

View File

@ -1,15 +1,15 @@
## nix-analyzer
## statix
`nix-analyzer` intends to be a static analysis tool for the
`statix` intends to be a static analysis tool for the
Nix programming language.
For the time-being, `nix-analyzer` works only with ASTs
For the time-being, `statix` works only with ASTs
produced by the `rnix-parser` crate and does not evaluate
any nix code.
any nix code (imports, attr sets etc.).
## Architecture
`nix-analyzer` has the following components:
`statix` has the following components:
- `bin`: the CLI/entrypoint
- `lib`: library of lints and utilities to define these
@ -18,7 +18,7 @@ any nix code.
### `bin`
This is the main point of interaction between `nix-analyzer`
This is the main point of interaction between `statix`
and the end user. It's output is human-readable and should
also support JSON/errorfmt outputs for external tools to
use.