Skip to content

Commit

Permalink
home-manager: use proper submodule type for settings
Browse files Browse the repository at this point in the history
  • Loading branch information
horriblename committed Dec 22, 2024
1 parent 3b73bc0 commit 2e07475
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions flake/modules/home-manager.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Home Manager module
packages: lib: {
packages: lib: inputs: {
config,
pkgs,
...
Expand All @@ -8,15 +8,19 @@ packages: lib: {
inherit (lib.modules) mkIf 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 = [
Expand Down Expand Up @@ -55,7 +59,7 @@ in {
};

settings = mkOption {
type = attrsOf anythingConcatLists;
type = nvfModule;
default = {};
description = "Attribute set of nvf preferences.";
example = literalExpression ''
Expand All @@ -78,7 +82,7 @@ in {
};

config = mkIf cfg.enable {
programs.nvf.finalPackage = neovimConfigured.neovim;
programs.nvf.finalPackage = config.programs.nvf.settings.vim.build.finalPackage;

home = {
sessionVariables = mkIf cfg.defaultEditor {EDITOR = "nvim";};
Expand Down

0 comments on commit 2e07475

Please sign in to comment.