flake.nix: refactoring using flake-parts

This commit is contained in:
Gaetan Lepage 2023-12-06 13:09:26 +01:00 committed by Gaétan Lepage
parent 1f1065df1e
commit 31284ddabe
13 changed files with 320 additions and 202 deletions

47
flake-modules/modules.nix Normal file
View file

@ -0,0 +1,47 @@
{
modules,
inputs,
...
}: {
_module.args = let
nixvimModules = with builtins;
map
(f: ../modules + "/${f}")
(
attrNames (readDir ../modules)
);
in {
modules = pkgs: let
nixpkgsMaintainersList = pkgs.path + "/nixos/modules/misc/meta.nix";
nixvimExtraArgsModule = rec {
_file = ./flake.nix;
key = _file;
config = {
_module.args = {
pkgs = pkgs.lib.mkForce pkgs;
inherit (pkgs) lib;
helpers = import ../lib/helpers.nix {inherit (pkgs) lib;};
# TODO: Not sure why the modules need to access the whole flake inputs...
inherit inputs;
};
};
};
in
nixvimModules
++ [
nixpkgsMaintainersList
nixvimExtraArgsModule
];
};
perSystem = {
pkgs,
config,
...
}: {
_module.args = {
modules = modules pkgs;
};
};
}