From 6dc07ba5c158b086744909bd1a7cddd23519948c Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sun, 22 Dec 2024 23:05:06 +0100 Subject: [PATCH] nixos: use proper submodule type for settings --- flake.nix | 2 +- flake/modules/nixos.nix | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/flake.nix b/flake.nix index 3a177517..095419d5 100644 --- a/flake.nix +++ b/flake.nix @@ -42,7 +42,7 @@ }; nixosModules = { - nvf = import ./flake/modules/nixos.nix self.packages lib; + nvf = import ./flake/modules/nixos.nix self.packages lib inputs; default = self.nixosModules.nvf; neovim-flake = lib.warn '' diff --git a/flake/modules/nixos.nix b/flake/modules/nixos.nix index 022b3d94..3ca8e544 100644 --- a/flake/modules/nixos.nix +++ b/flake/modules/nixos.nix @@ -1,5 +1,5 @@ # NixOS module -packages: lib: { +packages: lib: inputs: { config, pkgs, ... @@ -8,15 +8,19 @@ packages: lib: { inherit (lib.modules) mkIf mkOverride mkAliasOptionModule; inherit (lib.lists) optional; inherit (lib.options) mkOption mkEnableOption literalExpression; - inherit (lib.types) attrsOf anything bool; - inherit (lib.nvim) neovimConfiguration; - inherit (lib.nvim.types) anythingConcatLists; + inherit (lib.types) anything bool submoduleWith; cfg = config.programs.nvf; - neovimConfigured = neovimConfiguration { - inherit pkgs; - modules = [cfg.settings]; + nvfModule = submoduleWith { + description = "Nvf module"; + class = "nvf"; + specialArgs = { + inherit pkgs lib inputs; + }; + modules = [ + {imports = import ../../modules/modules.nix {inherit pkgs lib;};} + ]; }; in { imports = [ @@ -55,7 +59,7 @@ in { }; settings = mkOption { - type = attrsOf anythingConcatLists; + type = nvfModule; default = {}; description = "Attribute set of nvf preferences."; example = literalExpression '' @@ -78,7 +82,7 @@ in { }; config = mkIf cfg.enable { - programs.nvf.finalPackage = neovimConfigured.neovim; + programs.nvf.finalPackage = config.programs.nvf.settings.vim.build.finalPackage; environment = { variables.EDITOR = mkIf cfg.defaultEditor (mkOverride 900 "nvim");