From 1c99ffd784cc14fdab6f19717b86922033c9fb13 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Tue, 9 May 2023 11:43:25 -0400 Subject: [PATCH] nix: Modularize editor Now I know how to abstract modules into separate files instead of having one big file for everything. --- flake.nix | 41 +++++------------------------------------ modules/editor.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 36 deletions(-) create mode 100644 modules/editor.nix diff --git a/flake.nix b/flake.nix index 8f86236c..46702ee5 100644 --- a/flake.nix +++ b/flake.nix @@ -5,12 +5,14 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = inputs: { - nixosConfigurations.nixos = inputs.nixpkgs.lib.nixosSystem { + outputs = { self, nixpkgs, home-manager, ... }@attrs: { + nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; + specialArgs = attrs; modules = [ ./configuration.nix - inputs.home-manager.nixosModules.home-manager + ./modules/editor.nix + home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; users.users.user = { @@ -80,39 +82,6 @@ fade-in = 1; }; }; - programs.neovim = { - enable = true; - plugins = with pkgs.vimPlugins; [{ - plugin = nvim-tree-lua; - type = "lua"; - config = '' - vim.g.loaded_netrw = 1 - vim.g.loaded_netrwPlugin = 1 - vim.opt.termguicolors = true - require("nvim-tree").setup() - ''; - } - { - plugin = indent-blankline-nvim; - type = "lua"; - config = '' - vim.cmd [[highlight IndentBlanklineIndent1 guibg=#1f1f1f gui=nocombine]] - vim.cmd [[highlight IndentBlanklineIndent2 guibg=#1a1a1a gui=nocombine]] - require("indent_blankline").setup { - char = "", - char_highlight_list = { - "IndentBlanklineIndent1", - "IndentBlanklineIndent2", - }, - space_char_highlight_list = { - "IndentBlanklineIndent1", - "IndentBlanklineIndent2", - }, - show_trailing_blankline_indent = false, - } - ''; - }]; - }; editorconfig = { enable = true; settings = { diff --git a/modules/editor.nix b/modules/editor.nix new file mode 100644 index 00000000..ed44c12d --- /dev/null +++ b/modules/editor.nix @@ -0,0 +1,40 @@ +{ config, lib, nixpkgs, home-manager, ... }: { + imports = [ home-manager.nixosModule ]; + home-manager.users.user = { pkgs, ... }: { + programs.neovim = { + enable = true; + plugins = with pkgs.vimPlugins; [ + { + plugin = nvim-tree-lua; + type = "lua"; + config = '' + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + vim.opt.termguicolors = true + require("nvim-tree").setup() + ''; + } + { + plugin = indent-blankline-nvim; + type = "lua"; + config = '' + vim.cmd [[highlight IndentBlanklineIndent1 guibg=#1f1f1f gui=nocombine]] + vim.cmd [[highlight IndentBlanklineIndent2 guibg=#1a1a1a gui=nocombine]] + require("indent_blankline").setup { + char = "", + char_highlight_list = { + "IndentBlanklineIndent1", + "IndentBlanklineIndent2", + }, + space_char_highlight_list = { + "IndentBlanklineIndent1", + "IndentBlanklineIndent2", + }, + show_trailing_blankline_indent = false, + } + ''; + } + ]; + }; + }; +}