Skip to content

Commit

Permalink
format repo with alejandra
Browse files Browse the repository at this point in the history
  • Loading branch information
bandithedoge committed May 5, 2024
1 parent 4243015 commit c5bc310
Show file tree
Hide file tree
Showing 2 changed files with 239 additions and 230 deletions.
112 changes: 58 additions & 54 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,62 +16,66 @@
flake = false;
};
};
outputs =
{ self
, nixpkgs
, flake-utils
, norg
, norg-meta
, neorg
, neorg-telescope
, ...
}: {
overlays.default = final: prev:
let inherit (final.lib) attrValues elem filter filterAttrs isDerivation; in
{
vimPlugins = prev.vimPlugins.extend (f: p: {
nvim-treesitter =
let
norgGrammars = {
tree-sitter-norg = norg.defaultPackage.${final.system};
tree-sitter-norg-meta = norg-meta.defaultPackage.${final.system};
};
builtGrammars = (filterAttrs (_: isDerivation) p.nvim-treesitter.builtGrammars) // norgGrammars;
allGrammars = attrValues builtGrammars;
withPlugins = grammarFn:
p.nvim-treesitter.withPlugins (_:
let plugins = (grammarFn builtGrammars); in
plugins ++ (filter (p: !(elem p plugins)) (attrValues norgGrammars))
);
withAllGrammars = withPlugins (_: allGrammars);
in
p.nvim-treesitter.overrideAttrs (a:
{
passthru = {
inherit builtGrammars allGrammars withPlugins withAllGrammars;
};
});
neorg = final.vimUtils.buildVimPlugin {
pname = "neorg";
version = neorg.rev;
src = neorg;
dependencies = [ f.plenary-nvim (f.nvim-treesitter.withPlugins (_: [ ])) ];
outputs = {
self,
nixpkgs,
flake-utils,
norg,
norg-meta,
neorg,
neorg-telescope,
...
}:
{
overlays.default = final: prev: let
inherit (final.lib) attrValues elem filter filterAttrs isDerivation;
in {
vimPlugins = prev.vimPlugins.extend (f: p: {
nvim-treesitter = let
norgGrammars = {
tree-sitter-norg = norg.defaultPackage.${final.system};
tree-sitter-norg-meta = norg-meta.defaultPackage.${final.system};
};
neorg-telescope = final.vimUtils.buildVimPlugin {
pname = "neorg-telescope";
version = neorg-telescope.rev;
src = neorg-telescope;
dependencies = [ f.telescope-nvim f.neorg ];
};
});
};
builtGrammars = (filterAttrs (_: isDerivation) p.nvim-treesitter.builtGrammars) // norgGrammars;
allGrammars = attrValues builtGrammars;
withPlugins = grammarFn:
p.nvim-treesitter.withPlugins (
_: let
plugins = grammarFn builtGrammars;
in
plugins ++ (filter (p: !(elem p plugins)) (attrValues norgGrammars))
);
withAllGrammars = withPlugins (_: allGrammars);
in
p.nvim-treesitter.overrideAttrs (a: {
passthru = {
inherit builtGrammars allGrammars withPlugins withAllGrammars;
};
});
neorg = final.vimUtils.buildVimPlugin {
pname = "neorg";
version = neorg.rev;
src = neorg;
dependencies = [f.plenary-nvim (f.nvim-treesitter.withPlugins (_: []))];
};
neorg-telescope = final.vimUtils.buildVimPlugin {
pname = "neorg-telescope";
version = neorg-telescope.rev;
src = neorg-telescope;
dependencies = [f.telescope-nvim f.neorg];
};
});
};
# https://github.com/NixOS/nix/issues/5532
overlay = nixpkgs.lib.warn "`neorg-overlay.overlay` is deprecated; use `neorg-overlay.overlays.default` instead" self.overlays.default;
} // (flake-utils.lib.eachDefaultSystem (system: {
checks = import ./tests.nix
(import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
});
}
// (flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [self.overlays.default];
};
in {
checks = import ./tests.nix pkgs;
formatter = pkgs.alejandra;
}));
}
Loading

0 comments on commit c5bc310

Please sign in to comment.