2021-09-10 17:12:30 +03:00
|
|
|
{
|
|
|
|
inputs = {
|
2021-10-19 18:09:11 +03:00
|
|
|
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
|
|
|
|
2021-09-10 17:12:30 +03:00
|
|
|
mozillapkgs = {
|
|
|
|
url = "github:mozilla/nixpkgs-mozilla";
|
|
|
|
flake = false;
|
|
|
|
};
|
2021-10-19 18:09:11 +03:00
|
|
|
|
|
|
|
import-cargo.url = github:edolstra/import-cargo;
|
|
|
|
|
2021-09-10 17:12:30 +03:00
|
|
|
};
|
|
|
|
|
2021-10-02 08:22:22 +03:00
|
|
|
outputs =
|
|
|
|
{ self
|
|
|
|
, nixpkgs
|
|
|
|
, mozillapkgs
|
2021-10-19 18:09:11 +03:00
|
|
|
, import-cargo
|
2021-10-02 08:22:22 +03:00
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
let
|
2021-10-19 18:09:11 +03:00
|
|
|
inherit (import-cargo.builders) importCargo;
|
2021-10-23 10:48:03 +03:00
|
|
|
|
2021-10-19 18:09:11 +03:00
|
|
|
supportedSystems = [ "x86_64-linux" ];
|
|
|
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
|
|
|
nixpkgsFor = forAllSystems (system:
|
|
|
|
import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
overlays = [ self.overlay ];
|
|
|
|
});
|
2021-10-23 10:48:03 +03:00
|
|
|
|
2021-10-19 18:09:11 +03:00
|
|
|
mozilla = p: p.callPackage (mozillapkgs + "/package-set.nix") { };
|
2021-10-02 08:22:22 +03:00
|
|
|
chanspec = {
|
2021-10-19 18:09:11 +03:00
|
|
|
date = "2021-09-30";
|
2021-10-02 08:22:22 +03:00
|
|
|
channel = "nightly";
|
2021-10-19 18:09:11 +03:00
|
|
|
sha256 = "Elqn7GDBDE/QT1XTDyj0EvivbC//uwjWX8d+J3Pi0dY="; # set zeros after modifying channel or date
|
2021-10-02 08:22:22 +03:00
|
|
|
};
|
2021-10-23 10:48:03 +03:00
|
|
|
rustChannel = p: (mozilla p).rustChannelOf chanspec;
|
|
|
|
|
2021-10-19 18:09:11 +03:00
|
|
|
in
|
|
|
|
{
|
2021-10-02 08:22:22 +03:00
|
|
|
|
2021-10-19 18:09:11 +03:00
|
|
|
overlay = final: prev:
|
|
|
|
let
|
2021-10-23 10:48:03 +03:00
|
|
|
inherit (rustChannel final.pkgs) rust rust-src;
|
2021-10-19 18:09:11 +03:00
|
|
|
in
|
|
|
|
{
|
2021-10-02 08:22:22 +03:00
|
|
|
|
2021-10-19 18:09:11 +03:00
|
|
|
statix = with final; pkgs.stdenv.mkDerivation {
|
|
|
|
pname = "statix";
|
2021-10-27 17:20:52 +03:00
|
|
|
version = "v0.2.3";
|
2021-10-23 10:48:03 +03:00
|
|
|
src = builtins.path {
|
|
|
|
path = ./.;
|
|
|
|
name = "statix";
|
|
|
|
};
|
2021-10-19 18:09:11 +03:00
|
|
|
nativeBuildInputs = [
|
|
|
|
(importCargo { lockFile = ./Cargo.lock; inherit pkgs; }).cargoHome
|
|
|
|
rust
|
|
|
|
cargo
|
|
|
|
];
|
|
|
|
buildPhase = ''
|
2021-10-24 15:25:57 +03:00
|
|
|
cargo build -p statix --all-features --release --offline
|
2021-10-19 18:09:11 +03:00
|
|
|
'';
|
2021-10-24 15:25:57 +03:00
|
|
|
# statix does not have any tests currently
|
|
|
|
doCheck = false;
|
2021-10-19 18:09:11 +03:00
|
|
|
installPhase = ''
|
|
|
|
install -Dm775 ./target/release/statix $out/bin/statix
|
|
|
|
'';
|
2021-10-27 05:32:57 +03:00
|
|
|
|
|
|
|
meta = with pkgs.lib; {
|
|
|
|
description = "Lints and suggestions for the Nix programming language";
|
|
|
|
homepage = "https://git.peppe.rs/languages/statix/about";
|
|
|
|
license = licenses.mit;
|
|
|
|
};
|
2021-10-19 18:09:11 +03:00
|
|
|
};
|
2021-09-10 17:12:30 +03:00
|
|
|
|
2021-10-27 14:40:42 +03:00
|
|
|
statix-vim =
|
|
|
|
with final; pkgs.vimUtils.buildVimPlugin {
|
|
|
|
pname = "statix-vim";
|
|
|
|
version = "0.1.0";
|
|
|
|
src = ./vim-plugin;
|
|
|
|
};
|
|
|
|
|
2021-10-19 18:09:11 +03:00
|
|
|
};
|
2021-09-10 17:12:30 +03:00
|
|
|
|
2021-10-19 18:09:11 +03:00
|
|
|
packages = forAllSystems (system: {
|
2021-10-27 14:40:42 +03:00
|
|
|
inherit (nixpkgsFor."${system}") statix statix-vim;
|
2021-10-19 18:09:11 +03:00
|
|
|
});
|
2021-09-10 17:12:30 +03:00
|
|
|
|
2021-10-19 18:09:11 +03:00
|
|
|
defaultPackage =
|
|
|
|
forAllSystems (system: self.packages."${system}".statix);
|
2021-09-10 17:12:30 +03:00
|
|
|
|
2021-10-23 11:46:44 +03:00
|
|
|
defaultApp = forAllSystems (system:
|
|
|
|
{
|
|
|
|
type = "app";
|
|
|
|
program = "${self.packages."${system}".statix}/bin/statix";
|
|
|
|
});
|
|
|
|
|
2021-10-19 18:09:11 +03:00
|
|
|
devShell = forAllSystems (system:
|
|
|
|
let
|
|
|
|
pkgs = nixpkgsFor.${system};
|
2021-10-24 15:25:57 +03:00
|
|
|
inherit (rustChannel pkgs) rust rust-src rust-analysis;
|
2021-10-19 18:09:11 +03:00
|
|
|
in
|
|
|
|
with pkgs;
|
|
|
|
mkShell rec {
|
2021-10-24 15:25:57 +03:00
|
|
|
buildInputs = [
|
|
|
|
rustfmt
|
|
|
|
cargo
|
|
|
|
cargo-watch
|
|
|
|
rust
|
|
|
|
rust-src
|
|
|
|
];
|
2021-10-23 10:48:03 +03:00
|
|
|
RUST_SRC_PATH = "${rust-src}/lib/rustlib/src/rust/library";
|
2021-10-19 18:09:11 +03:00
|
|
|
RUST_LOG = "info";
|
|
|
|
RUST_BACKTRACE = 1;
|
|
|
|
});
|
2021-09-10 17:12:30 +03:00
|
|
|
|
2021-10-19 18:09:11 +03:00
|
|
|
|
|
|
|
};
|
2021-09-10 17:12:30 +03:00
|
|
|
}
|