diff --git a/modules/flake-parts/default.nix b/modules/flake-parts/default.nix index 0e6a6e98..724b94d0 100644 --- a/modules/flake-parts/default.nix +++ b/modules/flake-parts/default.nix @@ -10,6 +10,7 @@ ./deploy-rs-nodes.nix ./home-configurations.nix ./home-modules.nix + ./nixvim-configurations.nix ./setups ]; } diff --git a/modules/flake-parts/nixvim-configurations.nix b/modules/flake-parts/nixvim-configurations.nix new file mode 100644 index 00000000..48d583fb --- /dev/null +++ b/modules/flake-parts/nixvim-configurations.nix @@ -0,0 +1,49 @@ +{ config, lib, flake-parts-lib, ... }: + +let + inherit (flake-parts-lib) mkSubmoduleOptions mkPerSystemOption; +in +{ + options = { + flake = mkSubmoduleOptions { + nixvimConfigurations = lib.mkOption { + type = with lib.types; lazyAttrsOf (attrsOf package); + default = { }; + description = '' + An attribute set of per-system builds of + [NixVim](https://github.com/nix-community/nixvim) configurations + similar to `packages` flake output. + ''; + }; + }; + + perSystem = mkPerSystemOption { + options = { + nixvimConfigurations = lib.mkOption { + type = with lib.types; attrsOf package; + default = { }; + description = '' + An attribute set of per-system builds of + [NixVim](https://github.com/nix-community/nixvim) configurations + similar to `packages` flake output. + ''; + }; + }; + }; + }; + + config = { + flake.nixvimConfigurations = + lib.mapAttrs + (k: v: v.nixvimConfigurations) + (lib.filterAttrs + (k: v: v.nixvimConfigurations != { }) + config.allSystems + ); + + perInput = system: flake: + lib.optionalAttrs (flake ? nixvimConfigurations.${system}) { + nixvimConfigurations = flake.nixvimConfigurations.${system}; + }; + }; +}