From 088559eedd40b16fff2ce97e48006580be39dd03 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sat, 2 Oct 2021 10:52:22 +0530 Subject: update docs; nix-analyzer -> statix --- flake.lock | 17 --------- flake.nix | 114 ++++++++++++++++++++++++++++++++----------------------------- readme.md | 12 +++---- 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 @@ "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", diff --git a/flake.nix b/flake.nix index ceccfc8..82d7a1f 100644 --- a/flake.nix +++ b/flake.nix @@ -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 + }; + + rustChannel = mozilla.rustChannelOf chanspec; + rust = rustChannel.rust; + rust-src = rustChannel.rust-src; + + naersk-lib = naersk.lib."${system}".override { + cargo = rust; + rustc = rust; + }; - # 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 - }; + nativeBuildInputs = with pkgs; [ ]; - rustChannel = mozilla.rustChannelOf chanspec; - rust = rustChannel.rust; - rust-src = rustChannel.rust-src; + in + rec { + packages.statix = naersk-lib.buildPackage { + pname = "statix"; + version = "0.1.0"; + root = ./.; + inherit nativeBuildInputs; + }; - naersk-lib = naersk.lib."${system}".override { - cargo = rust; - rustc = rust; - }; + defaultPackage = packages.statix; + apps.statix = utils.lib.mkApp { + drv = packages.statix; + }; - nativeBuildInputs = with pkgs; [ ]; + apps.check = { + type = "app"; + program = "${pkgs.cargo-watch}/bin/cargo-watch"; + }; - 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; - }; - }); + 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; + }; + }); } diff --git a/readme.md b/readme.md index 9a9e0ca..76c633a 100644 --- a/readme.md +++ b/readme.md @@ -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. -- cgit v1.2.3