From 2dfc594aadff776a00eec74f72e108eefdd4a053 Mon Sep 17 00:00:00 2001 From: Victor Date: Tue, 25 Apr 2023 09:50:25 +0200 Subject: [PATCH] more dedup --- nixos/common/default.nix | 3 +- nixos/common/hm-modules/catppuccin.nix | 40 ++++++++ nixos/common/hm-modules/default.nix | 4 +- nixos/common/hm-modules/nvim.nix | 101 ++++++++++++++++++++ nixos/common/modules/gnome/default.nix | 1 + nixos/hosts/thalassa/aoife/home/default.nix | 15 ++- nixos/hosts/thalassa/aoife/home/neovim.nix | 94 ------------------ nixos/hosts/thalassa/aoife/home/nvim.lua | 0 nixos/hosts/thalassa/aoife/home/theme.nix | 32 ------- nixos/hosts/thalassa/eevee/home/default.nix | 8 +- nixos/hosts/thalassa/eevee/home/neovim.nix | 94 ------------------ nixos/hosts/thalassa/eevee/home/nvim.lua | 0 12 files changed, 159 insertions(+), 233 deletions(-) create mode 100644 nixos/common/hm-modules/catppuccin.nix create mode 100644 nixos/common/hm-modules/nvim.nix delete mode 100644 nixos/hosts/thalassa/aoife/home/neovim.nix delete mode 100644 nixos/hosts/thalassa/aoife/home/nvim.lua delete mode 100644 nixos/hosts/thalassa/aoife/home/theme.nix delete mode 100644 nixos/hosts/thalassa/eevee/home/neovim.nix delete mode 100644 nixos/hosts/thalassa/eevee/home/nvim.lua diff --git a/nixos/common/default.nix b/nixos/common/default.nix index 09ef92a..7d08263 100644 --- a/nixos/common/default.nix +++ b/nixos/common/default.nix @@ -6,7 +6,8 @@ nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; nix.registry.nixpkgs.flake = inputs.nixpkgs; - home-manager.sharedModules = [ ./hm-modules ]; + home-manager.sharedModules = + [ ./hm-modules inputs.nixvim.homeManagerModules.nixvim ]; vault-secrets = let inherit (config.networking) domain hostName; diff --git a/nixos/common/hm-modules/catppuccin.nix b/nixos/common/hm-modules/catppuccin.nix new file mode 100644 index 0000000..a60b67b --- /dev/null +++ b/nixos/common/hm-modules/catppuccin.nix @@ -0,0 +1,40 @@ +{ config, pkgs, lib, ... }: +with lib; +let cfg = config.themes.v.catppuccin; +in { + options.themes.v.catppuccin = { + enable = mkEnableOption "catppuccin"; + }; + config = let + theme = "Catppuccin-Pink-Dark"; + cursorTheme = config.home.pointerCursor.name; + in mkIf cfg.enable { + home.pointerCursor = { + name = "Bibata_Ghost"; + size = 24; + package = pkgs.bibata-cursors-translucent; + }; + + gtk = { + enable = true; + theme = { + name = theme; + package = pkgs.catppuccin-gtk; + }; + iconTheme = { + name = "Papirus-Dark"; + package = pkgs.papirus-icon-theme.override { color = "violet"; }; + }; + cursorTheme = { + name = cursorTheme; + inherit (config.home.pointerCursor) package size; + }; + }; + + programs.vscode = { + userSettings."workbench.colorTheme" = "Catppuccin Frappé"; + extensions = [ pkgs.vscode-extensions.catppuccin.catppuccin-vsc ]; + }; + }; +} + diff --git a/nixos/common/hm-modules/default.nix b/nixos/common/hm-modules/default.nix index 9676a72..844e7b6 100644 --- a/nixos/common/hm-modules/default.nix +++ b/nixos/common/hm-modules/default.nix @@ -1,5 +1,7 @@ { ... }: { imports = [ + ./catppuccin.nix + ./nvim.nix ./riff.nix ]; -} \ No newline at end of file +} diff --git a/nixos/common/hm-modules/nvim.nix b/nixos/common/hm-modules/nvim.nix new file mode 100644 index 0000000..2541697 --- /dev/null +++ b/nixos/common/hm-modules/nvim.nix @@ -0,0 +1,101 @@ +{ config, pkgs, lib, ... }: +with lib; +let cfg = config.programs.v.nvim; +in { + options.programs.v.nvim = { + enable = mkEnableOption "nvim"; + }; + config = mkIf cfg.enable { + programs.nixvim = { + enable = true; + package = pkgs.neovim-unwrapped; + vimAlias = true; + + globals = { mapleader = " "; }; + + maps.normal = { + "ff" = "lua require('telescope.builtin').find_files()"; + "fg" = "lua require('telescope.builtin').live_grep()"; + "" = + "lua require('Comment.api').toggle.linewise.current()"; # map ctrl+/ to commenting code + }; + + extraPlugins = with pkgs.vimPlugins; [ catppuccin-nvim luasnip ]; + + colorscheme = "catppuccin-frappe"; + + extraConfigLua = ""; + + plugins = { + bufferline.enable = true; + nix.enable = true; + treesitter = { + enable = true; + nixGrammars = true; + # ensureInstalled = [ ]; + }; + surround.enable = true; + fugitive.enable = true; + gitgutter.enable = true; + lualine = { + enable = true; + theme = "catppuccin"; + }; + telescope = { + enable = true; + extensions.fzf-native.enable = true; + extensions.fzf-native.fuzzy = true; + }; + comment-nvim = { enable = true; }; + lsp = { + enable = true; + servers.rust-analyzer.enable = true; + servers.rnix-lsp.enable = true; + servers.pyright.enable = true; + servers.elixirls.enable = true; + servers.clangd.enable = true; + }; + trouble.enable = true; + lspkind.enable = true; + nvim-cmp = { + enable = true; + autoEnableSources = true; + sources = [ + { name = "nvim_lsp"; } + { name = "cmp-latex-symbols"; } + { + name = "luasnip"; + option = { show_autosnippets = true; }; + } + { name = "cmp-spell"; } + { name = "cmp-rg"; } + { name = "path"; } + { name = "buffer"; } + ]; + snippet.expand = "luasnip"; + mappingPresets = [ "insert" "cmdline" ]; + mapping = { + "" = "cmp.mapping.confirm({ select = true })"; + "" = { + modes = [ "i" "s" ]; + action = '' + function(fallback) + local luasnip = require('luasnip') + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end + ''; + }; + }; + }; + }; + }; + }; +} diff --git a/nixos/common/modules/gnome/default.nix b/nixos/common/modules/gnome/default.nix index 4b72f6b..b4040dc 100644 --- a/nixos/common/modules/gnome/default.nix +++ b/nixos/common/modules/gnome/default.nix @@ -9,6 +9,7 @@ in { services.xserver.enable = true; services.xserver.excludePackages = [ pkgs.xterm ]; + # Add Home-manager dconf stuff home-manager.sharedModules = [ ./dconf.nix ]; diff --git a/nixos/hosts/thalassa/aoife/home/default.nix b/nixos/hosts/thalassa/aoife/home/default.nix index 84adb33..14b3411 100644 --- a/nixos/hosts/thalassa/aoife/home/default.nix +++ b/nixos/hosts/thalassa/aoife/home/default.nix @@ -8,15 +8,20 @@ let in { programs.home-manager.enable = true; + imports = []; + home.username = "victor"; home.homeDirectory = "/home/victor"; home.stateVersion = "23.05"; - imports = [ ./theme.nix ./neovim.nix ]; + # Enable catppuccin theme + themes.v.catppuccin.enable = true; # Custom dconf settings dconf.settings."org/gnome/desktop/input-sources".xkb-options = [ "caps:swapescape"]; + programs.v.nvim.enable = true; + home.packages = with pkgs; [ btop calibre @@ -188,13 +193,5 @@ in { templates = "${home}/.templates"; videos = "${home}/cloud/Videos"; }; - - # xdg.configFile."electron-flags.conf".text = '' - # --enable-features=UseOzonePlatform - # --ozone-platform=wayland - # --enable-features=WaylandWindowDecorations - # --ozone-platform-hint=auto - # ''; - services.syncthing.enable = true; } diff --git a/nixos/hosts/thalassa/aoife/home/neovim.nix b/nixos/hosts/thalassa/aoife/home/neovim.nix deleted file mode 100644 index 494acd2..0000000 --- a/nixos/hosts/thalassa/aoife/home/neovim.nix +++ /dev/null @@ -1,94 +0,0 @@ -{ inputs, pkgs, ... }: { - imports = [ inputs.nixvim.homeManagerModules.nixvim ]; - programs.nixvim = { - enable = true; - package = pkgs.neovim-unwrapped; - vimAlias = true; - - globals = { mapleader = " "; }; - - maps.normal = { - "ff" = "lua require('telescope.builtin').find_files()"; - "fg" = "lua require('telescope.builtin').live_grep()"; - "" = - "lua require('Comment.api').toggle.linewise.current()"; # map ctrl+/ to commenting code - }; - - extraPlugins = with pkgs.vimPlugins; [ catppuccin-nvim luasnip ]; - - colorscheme = "catppuccin-frappe"; - - extraConfigLua = builtins.readFile ./nvim.lua; - - plugins = { - bufferline.enable = true; - nix.enable = true; - treesitter = { - enable = true; - nixGrammars = true; - # ensureInstalled = [ ]; - }; - surround.enable = true; - fugitive.enable = true; - gitgutter.enable = true; - lualine = { - enable = true; - theme = "catppuccin"; - }; - telescope = { - enable = true; - extensions.fzf-native.enable = true; - extensions.fzf-native.fuzzy = true; - }; - comment-nvim = { enable = true; }; - lsp = { - enable = true; - servers.rust-analyzer.enable = true; - servers.rnix-lsp.enable = true; - servers.pyright.enable = true; - servers.elixirls.enable = true; - servers.clangd.enable = true; - }; - trouble.enable = true; - lspkind.enable = true; - nvim-cmp = { - enable = true; - autoEnableSources = true; - sources = [ - { name = "nvim_lsp"; } - { name = "cmp-latex-symbols"; } - { - name = "luasnip"; - option = { show_autosnippets = true; }; - } - { name = "cmp-spell"; } - { name = "cmp-rg"; } - { name = "path"; } - { name = "buffer"; } - ]; - snippet.expand = "luasnip"; - mappingPresets = [ "insert" "cmdline" ]; - mapping = { - "" = "cmp.mapping.confirm({ select = true })"; - "" = { - modes = [ "i" "s" ]; - action = '' - function(fallback) - local luasnip = require('luasnip') - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expandable() then - luasnip.expand() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end - ''; - }; - }; - }; - }; - }; -} diff --git a/nixos/hosts/thalassa/aoife/home/nvim.lua b/nixos/hosts/thalassa/aoife/home/nvim.lua deleted file mode 100644 index e69de29..0000000 diff --git a/nixos/hosts/thalassa/aoife/home/theme.nix b/nixos/hosts/thalassa/aoife/home/theme.nix deleted file mode 100644 index f48e44c..0000000 --- a/nixos/hosts/thalassa/aoife/home/theme.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ lib, pkgs, config, ... }: -let - theme = "Catppuccin-Pink-Dark"; - cursorTheme = config.home.pointerCursor.name; -in { - home.pointerCursor = { - name = "Bibata_Ghost"; - size = 24; - package = pkgs.bibata-cursors-translucent; - }; - - gtk = { - enable = true; - theme = { - name = theme; - package = pkgs.catppuccin-gtk; - }; - iconTheme = { - name = "Papirus-Dark"; - package = pkgs.papirus-icon-theme.override { color = "violet"; }; - }; - cursorTheme = { - name = cursorTheme; - inherit (config.home.pointerCursor) package size; - }; - }; - - programs.vscode = { - userSettings."workbench.colorTheme" = "Catppuccin Frappé"; - extensions = [ pkgs.vscode-extensions.catppuccin.catppuccin-vsc ]; - }; -} diff --git a/nixos/hosts/thalassa/eevee/home/default.nix b/nixos/hosts/thalassa/eevee/home/default.nix index 6bf9335..22b8f6d 100644 --- a/nixos/hosts/thalassa/eevee/home/default.nix +++ b/nixos/hosts/thalassa/eevee/home/default.nix @@ -11,12 +11,16 @@ in { home.homeDirectory = "/home/victor"; home.stateVersion = "23.05"; - imports = [ ./theme.nix ./neovim.nix ]; - dconf.settings."org/gnome/desktop/peripherals/mouse" = { accel-profile = "flat"; }; + # Enable my neovim config + programs.v.nvim.enable = true; + + # Enable catppuccin theme + themes.v.catppuccin.enable = true; + home.packages = with pkgs; [ btop calibre diff --git a/nixos/hosts/thalassa/eevee/home/neovim.nix b/nixos/hosts/thalassa/eevee/home/neovim.nix deleted file mode 100644 index 494acd2..0000000 --- a/nixos/hosts/thalassa/eevee/home/neovim.nix +++ /dev/null @@ -1,94 +0,0 @@ -{ inputs, pkgs, ... }: { - imports = [ inputs.nixvim.homeManagerModules.nixvim ]; - programs.nixvim = { - enable = true; - package = pkgs.neovim-unwrapped; - vimAlias = true; - - globals = { mapleader = " "; }; - - maps.normal = { - "ff" = "lua require('telescope.builtin').find_files()"; - "fg" = "lua require('telescope.builtin').live_grep()"; - "" = - "lua require('Comment.api').toggle.linewise.current()"; # map ctrl+/ to commenting code - }; - - extraPlugins = with pkgs.vimPlugins; [ catppuccin-nvim luasnip ]; - - colorscheme = "catppuccin-frappe"; - - extraConfigLua = builtins.readFile ./nvim.lua; - - plugins = { - bufferline.enable = true; - nix.enable = true; - treesitter = { - enable = true; - nixGrammars = true; - # ensureInstalled = [ ]; - }; - surround.enable = true; - fugitive.enable = true; - gitgutter.enable = true; - lualine = { - enable = true; - theme = "catppuccin"; - }; - telescope = { - enable = true; - extensions.fzf-native.enable = true; - extensions.fzf-native.fuzzy = true; - }; - comment-nvim = { enable = true; }; - lsp = { - enable = true; - servers.rust-analyzer.enable = true; - servers.rnix-lsp.enable = true; - servers.pyright.enable = true; - servers.elixirls.enable = true; - servers.clangd.enable = true; - }; - trouble.enable = true; - lspkind.enable = true; - nvim-cmp = { - enable = true; - autoEnableSources = true; - sources = [ - { name = "nvim_lsp"; } - { name = "cmp-latex-symbols"; } - { - name = "luasnip"; - option = { show_autosnippets = true; }; - } - { name = "cmp-spell"; } - { name = "cmp-rg"; } - { name = "path"; } - { name = "buffer"; } - ]; - snippet.expand = "luasnip"; - mappingPresets = [ "insert" "cmdline" ]; - mapping = { - "" = "cmp.mapping.confirm({ select = true })"; - "" = { - modes = [ "i" "s" ]; - action = '' - function(fallback) - local luasnip = require('luasnip') - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expandable() then - luasnip.expand() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end - ''; - }; - }; - }; - }; - }; -} diff --git a/nixos/hosts/thalassa/eevee/home/nvim.lua b/nixos/hosts/thalassa/eevee/home/nvim.lua deleted file mode 100644 index e69de29..0000000