From 072b07330975ba8e147baef49719861adb669b4e Mon Sep 17 00:00:00 2001 From: figsoda Date: Tue, 26 Oct 2021 20:58:26 -0400 Subject: [PATCH 1/3] statix: init at 0.3.1 --- pkgs/tools/nix/statix/default.nix | 26 ++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 pkgs/tools/nix/statix/default.nix diff --git a/pkgs/tools/nix/statix/default.nix b/pkgs/tools/nix/statix/default.nix new file mode 100644 index 000000000000..cffc2b0029df --- /dev/null +++ b/pkgs/tools/nix/statix/default.nix @@ -0,0 +1,26 @@ +{ lib, rustPlatform, fetchFromGitHub, withJson ? true }: + +rustPlatform.buildRustPackage rec { + pname = "statix"; + 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 bfe7a41c4b7e..da84202c601d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15167,6 +15167,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 { }; From cf5da073954204e72539d7cc4b32fcb830c80751 Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 27 Oct 2021 17:29:45 -0400 Subject: [PATCH 2/3] vimPlugins.statix: init at 0.1.0 --- pkgs/misc/vim-plugins/overrides.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/misc/vim-plugins/overrides.nix b/pkgs/misc/vim-plugins/overrides.nix index cc12ff401fae..1d415919070f 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,17 @@ self: super: { ''; }); + statix = buildVimPluginFrom2Nix { + inherit (statix) pname src meta; + version = "0.1.0"; + dependencies = with self; [ statix ]; + postPatch = '' + 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 From 19fec7306e6f6bfc447ce04cbbcfe3ac255afd2f Mon Sep 17 00:00:00 2001 From: figsoda Date: Fri, 29 Oct 2021 10:02:36 -0400 Subject: [PATCH 3/3] vimPlugisn.statix: add simple check and note for version --- pkgs/misc/vim-plugins/overrides.nix | 6 +++++- pkgs/tools/nix/statix/default.nix | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/misc/vim-plugins/overrides.nix b/pkgs/misc/vim-plugins/overrides.nix index 1d415919070f..bf79e1dc25de 100644 --- a/pkgs/misc/vim-plugins/overrides.nix +++ b/pkgs/misc/vim-plugins/overrides.nix @@ -528,11 +528,15 @@ self: super: { ''; }); - statix = buildVimPluginFrom2Nix { + 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 diff --git a/pkgs/tools/nix/statix/default.nix b/pkgs/tools/nix/statix/default.nix index cffc2b0029df..944abac0d34d 100644 --- a/pkgs/tools/nix/statix/default.nix +++ b/pkgs/tools/nix/statix/default.nix @@ -2,6 +2,8 @@ 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 {