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-11-01 05:54:19 +03:00
|
|
|
fenix = {
|
|
|
|
url = "github:nix-community/fenix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2021-09-10 17:12:30 +03:00
|
|
|
};
|
2021-10-19 18:09:11 +03:00
|
|
|
|
2021-11-01 05:54:19 +03:00
|
|
|
gitignore = {
|
|
|
|
url = "github:hercules-ci/gitignore.nix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2021-10-19 18:09:11 +03:00
|
|
|
|
2021-09-10 17:12:30 +03:00
|
|
|
};
|
|
|
|
|
2021-10-02 08:22:22 +03:00
|
|
|
outputs =
|
|
|
|
{ self
|
|
|
|
, nixpkgs
|
2021-11-01 05:54:19 +03:00
|
|
|
, fenix
|
2021-10-31 20:15:42 +03:00
|
|
|
, gitignore
|
2021-10-02 08:22:22 +03:00
|
|
|
}:
|
|
|
|
let
|
2021-10-31 20:15:42 +03:00
|
|
|
inherit (gitignore.lib) gitignoreSource;
|
2021-10-23 10:48:03 +03:00
|
|
|
|
2021-10-28 18:09:10 +03:00
|
|
|
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
2021-10-19 18:09:11 +03:00
|
|
|
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-02 08:22:22 +03:00
|
|
|
chanspec = {
|
2021-11-01 05:54:19 +03:00
|
|
|
date = "2021-11-01";
|
2021-10-02 08:22:22 +03:00
|
|
|
channel = "nightly";
|
2021-11-01 05:54:19 +03:00
|
|
|
sha256 = "2BmxGawDNjXHJvnQToxmErMGgEPOfVzUvxhkvuixHYU="; # set zeros after modifying channel or date
|
2021-10-02 08:22:22 +03:00
|
|
|
};
|
2021-11-01 05:54:19 +03:00
|
|
|
rustChannel = p: (fenix.overlay p p).fenix.toolchainOf chanspec;
|
2021-10-23 10:48:03 +03:00
|
|
|
|
2021-10-19 18:09:11 +03:00
|
|
|
in
|
|
|
|
{
|
2021-10-02 08:22:22 +03:00
|
|
|
|
2021-11-01 05:54:19 +03:00
|
|
|
overlay = final: prev: {
|
|
|
|
statix = with final; (makeRustPlatform {
|
|
|
|
inherit (rustChannel final) cargo rustc;
|
|
|
|
}).buildRustPackage rec {
|
|
|
|
pname = "statix";
|
|
|
|
version = (lib.importTOML ./bin/Cargo.toml).package.version;
|
|
|
|
|
|
|
|
src = gitignoreSource ./.;
|
2021-09-10 17:12:30 +03:00
|
|
|
|
2021-11-01 05:54:19 +03:00
|
|
|
cargoLock.lockFile = ./Cargo.lock;
|
2021-10-27 14:40:42 +03:00
|
|
|
|
2021-11-01 05:54:19 +03:00
|
|
|
meta = with 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-11-01 05:54:19 +03:00
|
|
|
statix-vim =
|
|
|
|
with final; vimUtils.buildVimPlugin {
|
|
|
|
pname = "statix-vim";
|
|
|
|
version = "0.1.0";
|
|
|
|
src = ./vim-plugin;
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
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-19 18:09:11 +03:00
|
|
|
devShell = forAllSystems (system:
|
|
|
|
let
|
2021-10-28 05:23:40 +03:00
|
|
|
pkgs = nixpkgsFor."${system}";
|
2021-11-01 05:54:19 +03:00
|
|
|
toolchain = (rustChannel pkgs).withComponents [
|
|
|
|
"rustc"
|
|
|
|
"cargo"
|
|
|
|
"rust-std"
|
|
|
|
"rustfmt"
|
|
|
|
"clippy"
|
|
|
|
"rust-src"
|
|
|
|
];
|
2021-10-19 18:09:11 +03:00
|
|
|
in
|
|
|
|
with pkgs;
|
|
|
|
mkShell rec {
|
2021-11-01 05:54:19 +03:00
|
|
|
nativeBuildInputs = [
|
2021-10-24 15:25:57 +03:00
|
|
|
cargo-watch
|
2021-11-01 05:54:19 +03:00
|
|
|
toolchain
|
2021-10-24 15:25:57 +03:00
|
|
|
];
|
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
|
|
|
}
|