diff --git a/pkgs/misc/vim-plugins/overrides.nix b/pkgs/misc/vim-plugins/overrides.nix index cc12ff401fae..bf79e1dc25de 100644 --- a/pkgs/misc/vim-plugins/overrides.nix +++ b/pkgs/misc/vim-plugins/overrides.nix @@ -30,6 +30,7 @@ , nodePackages , skim , sqlite +, statix , stylish-haskell , tabnine , vim @@ -527,6 +528,21 @@ self: super: { ''; }); + statix = buildVimPluginFrom2Nix rec { + inherit (statix) pname src meta; + version = "0.1.0"; + dependencies = with self; [ statix ]; + postPatch = '' + # check that version is up to date + grep 'pname = "statix-vim"' -A 1 flake.nix \ + | grep -F 'version = "${version}"' flake.nix + + cd vim-plugin + substituteInPlace ftplugin/nix.vim --replace statix ${statix}/bin/statix + substituteInPlace plugin/statix.vim --replace statix ${statix}/bin/statix + ''; + }; + sved = let # we put the script in its own derivation to benefit the magic of wrapGAppsHook diff --git a/pkgs/tools/nix/statix/default.nix b/pkgs/tools/nix/statix/default.nix new file mode 100644 index 000000000000..944abac0d34d --- /dev/null +++ b/pkgs/tools/nix/statix/default.nix @@ -0,0 +1,28 @@ +{ lib, rustPlatform, fetchFromGitHub, withJson ? true }: + +rustPlatform.buildRustPackage rec { + pname = "statix"; + # also update version of the vim plugin in pkgs/misc/vim-plugins/overrides.nix + # the version can be found in flake.nix of the source code + version = "0.3.1"; + + src = fetchFromGitHub { + owner = "nerdypepper"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-Jh3ErzK8vqEdDtZP7O/PAmHQznUTB18nCQwfckFxyLA="; + }; + + cargoSha256 = "sha256-y+vBHAHTe++tYOWWQ5ioFlprRfDximZE8KSGNNBSPAk="; + + cargoBuildFlags = lib.optionals withJson [ "--features" "json" ]; + + cargoCheckFlags = cargoBuildFlags; + + meta = with lib; { + description = "Lints and suggestions for the nix programming language"; + homepage = "https://github.com/nerdypepper/statix"; + license = licenses.mit; + maintainers = with maintainers; [ figsoda nerdypepper ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9865a76b7b12..fb6c832884c1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15183,6 +15183,8 @@ with pkgs; sselp = callPackage ../tools/X11/sselp{ }; + statix = callPackage ../tools/nix/statix { }; + stm32cubemx = callPackage ../development/embedded/stm32/stm32cubemx { }; stm32flash = callPackage ../development/embedded/stm32/stm32flash { };