mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
plugins: Fetch the plugin sources from flake inputs (#247)
This commit is contained in:
parent
b3ca52110f
commit
416c719f47
5 changed files with 310 additions and 72 deletions
35
flake.nix
35
flake.nix
|
@ -75,7 +75,10 @@
|
|||
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||
src = ./.;
|
||||
hooks = {
|
||||
alejandra.enable = true;
|
||||
alejandra = {
|
||||
enable = true;
|
||||
excludes = ["plugins/_sources"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -114,6 +117,8 @@
|
|||
'';
|
||||
})
|
||||
{};
|
||||
# Used to updates plugins, launch 'nix run .#nvfetcher' in the 'plugins' directory
|
||||
nvfetcher = pkgs.nvfetcher;
|
||||
};
|
||||
legacyPackages = rec {
|
||||
makeNixvimWithModule = import ./wrappers/standalone.nix pkgs modules;
|
||||
|
@ -124,7 +129,33 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
formatter = pkgs.alejandra;
|
||||
formatter = let
|
||||
# We need to exclude the plugins/_sources/* files as they are autogenerated
|
||||
# nix formatter only takes a derivation so we need to make a proxy that passes
|
||||
# the correct flags
|
||||
excludeWrapper = {
|
||||
stdenv,
|
||||
alejandra,
|
||||
writeShellScript,
|
||||
...
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
pname = "alejandra-excludes";
|
||||
version = alejandra.version;
|
||||
|
||||
dontUnpack = true;
|
||||
dontBuild = true;
|
||||
installPhase = let
|
||||
script = writeShellScript "alejandra-excludes.sh" ''
|
||||
${alejandra}/bin/alejandra --exclude ./plugins/_sources "$@"
|
||||
'';
|
||||
in ''
|
||||
mkdir -p $out/bin
|
||||
cp ${script} $out/bin/alejandra-excludes
|
||||
'';
|
||||
};
|
||||
in
|
||||
pkgs.callPackage excludeWrapper {};
|
||||
|
||||
lib = import ./lib {
|
||||
inherit pkgs;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue