diff options
| author | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2024-09-24 23:13:51 +0530 |
|---|---|---|
| committer | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2024-09-24 23:13:51 +0530 |
| commit | c0c5087218c27e31c3e6f66f3937bff22fa0f647 (patch) | |
| tree | dede2292db1423cef901932a7898ec951c9d2345 /modules/tools | |
| parent | 21265ba643f1c12ad40e5195de8a3a97682adbde (diff) | |
| download | home-manager-config-c0c5087218c27e31c3e6f66f3937bff22fa0f647.tar.gz home-manager-config-c0c5087218c27e31c3e6f66f3937bff22fa0f647.zip | |
Using nix flake modules to manage the configurations.
Diffstat (limited to 'modules/tools')
21 files changed, 695 insertions, 0 deletions
diff --git a/modules/tools/default.nix b/modules/tools/default.nix new file mode 100644 index 0000000..bf96557 --- /dev/null +++ b/modules/tools/default.nix @@ -0,0 +1,11 @@ +{ lib, config, ... }: + +{ + imports = [ + ./editor + ./file-manager + ./git + ./system-monitor + ./viewer + ]; +} diff --git a/modules/tools/editor/default.nix b/modules/tools/editor/default.nix new file mode 100644 index 0000000..1a146bf --- /dev/null +++ b/modules/tools/editor/default.nix @@ -0,0 +1,7 @@ +{ lib, config, ... }: + +{ + imports = [ + ./neovim + ]; +} diff --git a/modules/tools/editor/neovim/default.nix b/modules/tools/editor/neovim/default.nix new file mode 100644 index 0000000..e06ec88 --- /dev/null +++ b/modules/tools/editor/neovim/default.nix @@ -0,0 +1,43 @@ +{ pkgs, config, lib, ... }: + +{ + options = { + neovim.enable = lib.mkEnableOption "Enables neovim."; + }; + + config = lib.mkIf config.neovim.enable { + programs.neovim.enable = true; + programs.neovim.viAlias = true; + programs.neovim.vimAlias = true; + programs.neovim.vimdiffAlias = true; + programs.neovim.defaultEditor = true; + + programs.neovim.extraPackages = with pkgs; [ + gcc # Required for treesitter + ]; + + programs.neovim.extraLuaConfig = + '' + ${builtins.readFile ./options.lua} + ${builtins.readFile ./keybindings.lua} + + -- Plugins configuration + ${builtins.readFile ./plugins/comment.lua} + ${builtins.readFile ./plugins/lualine.lua} + ${import ./plugins/treesitter.nix config} + ${builtins.readFile ./plugins/base16.lua} + ${builtins.readFile ./plugins/nvim-tree.lua} + ''; + + programs.neovim.plugins = with pkgs.vimPlugins; [ + comment-nvim + lualine-nvim + nvim-treesitter + nvim-web-devicons + nvim-tree-lua + (base16-vim.overrideAttrs (old: { + patchPhase = "ln -s ${config.scheme base16-vim} colors/base16-scheme.vim"; + })) + ]; + }; +} diff --git a/modules/tools/editor/neovim/keybindings.lua b/modules/tools/editor/neovim/keybindings.lua new file mode 100644 index 0000000..3e8e0fa --- /dev/null +++ b/modules/tools/editor/neovim/keybindings.lua @@ -0,0 +1,8 @@ +-- Navigate splits +vim.keymap.set("n", "<C-h>", ":wincmd h<CR>", { silent = true }); +vim.keymap.set("n", "<C-j>", ":wincmd j<CR>", { silent = true }); +vim.keymap.set("n", "<C-k>", ":wincmd k<CR>", { silent = true }); +vim.keymap.set("n", "<C-l>", ":wincmd l<CR>", { silent = true }); + +-- NvimTree +vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<CR>", { silent = true }); diff --git a/modules/tools/editor/neovim/options.lua b/modules/tools/editor/neovim/options.lua new file mode 100644 index 0000000..b1fe9cb --- /dev/null +++ b/modules/tools/editor/neovim/options.lua @@ -0,0 +1,21 @@ +vim.g.mapleader = " "; +vim.g.maplocalleader = " "; + +vim.o.clipboard = "unnamedplus"; + +vim.o.number = true; +vim.o.list = true; +vim.o.listchars = "tab:| ,trail:_,lead:_"; + +vim.o.laststatus = 3; + +vim.o.signcolumn = "auto"; +vim.opt.fillchars = { eob = " " }; + +vim.o.tabstop = 2; +vim.o.shiftwidth = 2; +vim.o.expandtab = false; + +vim.o.updatetime = 300; + +vim.o.mouse = "a"; diff --git a/modules/tools/editor/neovim/plugins/base16.lua b/modules/tools/editor/neovim/plugins/base16.lua new file mode 100644 index 0000000..9843b76 --- /dev/null +++ b/modules/tools/editor/neovim/plugins/base16.lua @@ -0,0 +1,6 @@ +vim.o.termguicolors = true; +vim.opt.termguicolors = true; +vim.o.background = "dark"; +vim.g.base16colorspace = 256 +vim.cmd.colorscheme("base16-scheme"); +vim.api.nvim_set_hl(0, "LineNr", { link = "Normal" }); -- disable the background of line numbers diff --git a/modules/tools/editor/neovim/plugins/comment.lua b/modules/tools/editor/neovim/plugins/comment.lua new file mode 100644 index 0000000..9086261 --- /dev/null +++ b/modules/tools/editor/neovim/plugins/comment.lua @@ -0,0 +1 @@ +require("Comment").setup(); diff --git a/modules/tools/editor/neovim/plugins/lualine.lua b/modules/tools/editor/neovim/plugins/lualine.lua new file mode 100644 index 0000000..ba2eda6 --- /dev/null +++ b/modules/tools/editor/neovim/plugins/lualine.lua @@ -0,0 +1,5 @@ +require("lualine").setup { + options = { + globalstatus = true, + }, +}; diff --git a/modules/tools/editor/neovim/plugins/nvim-tree.lua b/modules/tools/editor/neovim/plugins/nvim-tree.lua new file mode 100644 index 0000000..c6c4102 --- /dev/null +++ b/modules/tools/editor/neovim/plugins/nvim-tree.lua @@ -0,0 +1,13 @@ +require("nvim-tree").setup { + filters = { + enable = false + }, + renderer = { + indent_markers = { + enable = true + }, + root_folder_label = function(path) + return vim.fn.fnamemodify(path, ":t") + end, + }, +}; diff --git a/modules/tools/editor/neovim/plugins/treesitter.nix b/modules/tools/editor/neovim/plugins/treesitter.nix new file mode 100644 index 0000000..05f1f2a --- /dev/null +++ b/modules/tools/editor/neovim/plugins/treesitter.nix @@ -0,0 +1,13 @@ +config: + +'' +require("nvim-treesitter.configs").setup { + auto_install = true, + highlight = { + enable = true, + }, + parser_install_dir = "${config.xdg.dataHome}/nvim", +}; + +vim.opt.runtimepath:append("${config.xdg.dataHome}/nvim"); +'' diff --git a/modules/tools/file-manager/default.nix b/modules/tools/file-manager/default.nix new file mode 100644 index 0000000..d127a66 --- /dev/null +++ b/modules/tools/file-manager/default.nix @@ -0,0 +1,8 @@ +{ lib, config, ... }: + +{ + imports = [ + ./lf + ./lsd + ]; +} diff --git a/modules/tools/file-manager/lf/default.nix b/modules/tools/file-manager/lf/default.nix new file mode 100644 index 0000000..00784cf --- /dev/null +++ b/modules/tools/file-manager/lf/default.nix @@ -0,0 +1,21 @@ +{ config, pkgs, lib, ... }: + +{ + options = { + lf.enable = lib.mkEnableOption "Enables lf."; + }; + + config = lib.mkIf config.lf.enable { + programs.lf.enable = true; + programs.lf.settings = { + hidden = true; + }; + programs.lf.previewer.source = pkgs.writeShellScript + "previewer.sh" + (builtins.readFile ./scripts/previewer.sh); + + programs.lf.extraConfig = "set icons"; + + xdg.configFile."lf/icons".source = ./icons; + }; +} diff --git a/modules/tools/file-manager/lf/icons b/modules/tools/file-manager/lf/icons new file mode 100644 index 0000000..2e9d8a2 --- /dev/null +++ b/modules/tools/file-manager/lf/icons @@ -0,0 +1,334 @@ +# vim:ft=conf + +# These examples require Nerd Fonts or a compatible font to be used. +# See https://www.nerdfonts.com for more information. + +# file types (with matching order) +ln # LINK +or # ORPHAN +tw t # STICKY_OTHER_WRITABLE +ow # OTHER_WRITABLE +st t # STICKY +di # DIR +pi p # FIFO +so s # SOCK +bd b # BLK +cd c # CHR +su u # SETUID +sg g # SETGID +ex # EXEC +fi # FILE + +# file extensions (vim-devicons) +*.styl +*.sass +*.scss +*.htm +*.html +*.slim +*.haml +*.ejs +*.css +*.less +*.md +*.mdx +*.markdown +*.rmd +*.json +*.webmanifest +*.js +*.mjs +*.jsx +*.rb +*.gemspec +*.rake +*.php +*.py +*.pyc +*.pyo +*.pyd +*.coffee +*.mustache +*.hbs +*.conf +*.ini +*.yml +*.yaml +*.toml +*.bat +*.mk +*.jpg +*.jpeg +*.bmp +*.png +*.webp +*.gif +*.ico +*.twig +*.cpp +*.c++ +*.cxx +*.cc +*.cp +*.c +*.cs +*.h +*.hh +*.hpp +*.hxx +*.hs +*.lhs +*.nix +*.lua +*.java +*.sh +*.fish +*.bash +*.zsh +*.ksh +*.csh +*.awk +*.ps1 +*.ml λ +*.mli λ +*.diff +*.db +*.sql +*.dump +*.clj +*.cljc +*.cljs +*.edn +*.scala +*.go +*.dart +*.xul +*.sln +*.suo +*.pl +*.pm +*.t +*.rss +'*.f#' +*.fsscript +*.fsx +*.fs +*.fsi +*.rs +*.rlib +*.d +*.erl +*.hrl +*.ex +*.exs +*.eex +*.leex +*.heex +*.vim +*.ai +*.psd +*.psb +*.ts +*.tsx +*.jl +*.pp +*.vue +*.elm +*.swift +*.xcplayground +*.tex +*.r +*.rproj +*.sol +*.pem + +# file names (vim-devicons) (case-insensitive not supported in lf) +*gruntfile.coffee +*gruntfile.js +*gruntfile.ls +*gulpfile.coffee +*gulpfile.js +*gulpfile.ls +*mix.lock +*dropbox +*.ds_store +*.gitconfig +*.gitignore +*.gitattributes +*.gitlab-ci.yml +*.bashrc +*.zshrc +*.zshenv +*.zprofile +*.vimrc +*.gvimrc +*_vimrc +*_gvimrc +*.bashprofile +*favicon.ico +*license +*node_modules +*react.jsx +*procfile +*dockerfile +*docker-compose.yml +*docker-compose.yaml +*compose.yml +*compose.yaml +*rakefile +*config.ru +*gemfile +*makefile +*cmakelists.txt +*robots.txt + +# file names (case-sensitive adaptations) +*Gruntfile.coffee +*Gruntfile.js +*Gruntfile.ls +*Gulpfile.coffee +*Gulpfile.js +*Gulpfile.ls +*Dropbox +*.DS_Store +*LICENSE +*React.jsx +*Procfile +*Dockerfile +*Docker-compose.yml +*Docker-compose.yaml +*Rakefile +*Gemfile +*Makefile +*CMakeLists.txt + +# file patterns (file name adaptations) +*jquery.min.js +*angular.min.js +*backbone.min.js +*require.min.js +*materialize.min.js +*materialize.min.css +*mootools.min.js +*vimrc +Vagrantfile + +# archives or compressed (extensions from dircolors defaults) +*.tar +*.tgz +*.arc +*.arj +*.taz +*.lha +*.lz4 +*.lzh +*.lzma +*.tlz +*.txz +*.tzo +*.t7z +*.zip +*.z +*.dz +*.gz +*.lrz +*.lz +*.lzo +*.xz +*.zst +*.tzst +*.bz2 +*.bz +*.tbz +*.tbz2 +*.tz +*.deb +*.rpm +*.jar +*.war +*.ear +*.sar +*.rar +*.alz +*.ace +*.zoo +*.cpio +*.7z +*.rz +*.cab +*.wim +*.swm +*.dwm +*.esd + +# image formats (extensions from dircolors defaults) +*.jpg +*.jpeg +*.mjpg +*.mjpeg +*.gif +*.bmp +*.pbm +*.pgm +*.ppm +*.tga +*.xbm +*.xpm +*.tif +*.tiff +*.png +*.svg +*.svgz +*.mng +*.pcx +*.mov +*.mpg +*.mpeg +*.m2v +*.mkv +*.webm +*.ogm +*.mp4 +*.m4v +*.mp4v +*.vob +*.qt +*.nuv +*.wmv +*.asf +*.rm +*.rmvb +*.flc +*.avi +*.fli +*.flv +*.gl +*.dl +*.xcf +*.xwd +*.yuv +*.cgm +*.emf +*.ogv +*.ogx + +# audio formats (extensions from dircolors defaults) +*.aac +*.au +*.flac +*.m4a +*.mid +*.midi +*.mka +*.mp3 +*.mpc +*.ogg +*.ra +*.wav +*.oga +*.opus +*.spx +*.xspf + +# other formats +*.pdf diff --git a/modules/tools/file-manager/lf/scripts/previewer.sh b/modules/tools/file-manager/lf/scripts/previewer.sh new file mode 100644 index 0000000..407e0a0 --- /dev/null +++ b/modules/tools/file-manager/lf/scripts/previewer.sh @@ -0,0 +1,3 @@ +#!/bin/sh +unset COLORTERM +bat -pp --line-range=:500 --color=always "$1" diff --git a/modules/tools/file-manager/lsd/default.nix b/modules/tools/file-manager/lsd/default.nix new file mode 100644 index 0000000..0f57e6b --- /dev/null +++ b/modules/tools/file-manager/lsd/default.nix @@ -0,0 +1,17 @@ +{ pkgs, lib, config, ... }: + +{ + options = { + lsd.enable = lib.mkEnableOption "Enables lsd."; + }; + + config = lib.mkIf config.lsd.enable { + programs.lsd.enable = true; + programs.lsd.enableAliases = true; + programs.bash.shellAliases."tree" = "${pkgs.lsd}/bin/lsd -a --tree"; + + programs.lsd.settings = { + icons.separator = " "; + }; + }; +} diff --git a/modules/tools/git/default.nix b/modules/tools/git/default.nix new file mode 100644 index 0000000..7396cb8 --- /dev/null +++ b/modules/tools/git/default.nix @@ -0,0 +1,20 @@ +{ lib, config, ... }: + +{ + options = { + git.enable = lib.mkEnableOption "Enables git."; + }; + + config = lib.mkIf config.git.enable { + programs.git.enable = true; + programs.git.userEmail = "54011232+arpitchakladar@users.noreply.github.com"; + programs.git.userName = "Arpit Chakladar"; + programs.git.extraConfig = { + credential.helper = "store --file ${config.xdg.cacheHome}/git/credential"; + core.askPass = ""; + }; + + # The base directory of the credential file must exist + home.activation.createGitCacheDirectory = lib.hm.dag.entryAfter [ "writeBoundary" ] "mkdir -p ${config.xdg.cacheHome}/git"; + }; +} diff --git a/modules/tools/system-monitor/default.nix b/modules/tools/system-monitor/default.nix new file mode 100644 index 0000000..a5b569c --- /dev/null +++ b/modules/tools/system-monitor/default.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + imports = [ + ./htop + ]; +} diff --git a/modules/tools/system-monitor/htop/default.nix b/modules/tools/system-monitor/htop/default.nix new file mode 100644 index 0000000..f27174a --- /dev/null +++ b/modules/tools/system-monitor/htop/default.nix @@ -0,0 +1,12 @@ +{ pkgs, lib, config, ... }: + +{ + options = { + htop.enable = lib.mkEnableOption "Enables htop."; + }; + + config = lib.mkIf config.htop.enable { + programs.htop.enable = true; + programs.htop.package = pkgs.htop-vim; + }; +} diff --git a/modules/tools/viewer/bat/default.nix b/modules/tools/viewer/bat/default.nix new file mode 100644 index 0000000..cc01f82 --- /dev/null +++ b/modules/tools/viewer/bat/default.nix @@ -0,0 +1,14 @@ +{ config, lib, ... }: + +{ + options = { + bat.enable = lib.mkEnableOption "Enables bat."; + }; + + config = lib.mkIf config.bat.enable { + programs.bat.enable = true; + programs.bat.config.theme = "customTheme"; + xdg.configFile."bat/themes/customTheme.tmTheme".text + = import ./theme.nix config; + }; +} diff --git a/modules/tools/viewer/bat/theme.nix b/modules/tools/viewer/bat/theme.nix new file mode 100644 index 0000000..e345ee4 --- /dev/null +++ b/modules/tools/viewer/bat/theme.nix @@ -0,0 +1,124 @@ +config: + +with config.scheme.withHashtag; +'' +<?xml version="1.0" encoding="UTF-8"?> +<plist version="1.0"> +<dict> + <key>name</key> + <string>customTheme</string> + <key>settings</key> + <array> + <!-- General Colors --> + <dict> + <key>settings</key> + <dict> + <key>background</key> + <string>#0F1419</string> <!-- Background (base00) --> + <key>foreground</key> + <string>#E6E1CF</string> <!-- Foreground (base05) --> + <key>caret</key> + <string>#F3F4F5</string> <!-- Caret (base07) --> + <key>invisibles</key> + <string>#3E4B59</string> <!-- Invisibles (base03) --> + <key>lineHighlight</key> + <string>#272D38</string> <!-- Line highlight (base02) --> + <key>selection</key> + <string>#3E4B59</string> <!-- Selection (base03) --> + </dict> + </dict> + + <!-- Syntax-Specific Colors --> + <dict> + <key>scope</key> + <string>comment</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#BFBDB6</string> <!-- Comments (base04) --> + </dict> + </dict> + + <dict> + <key>scope</key> + <string>string</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#FFB454</string> <!-- Strings (base0A) --> + </dict> + </dict> + + <dict> + <key>scope</key> + <string>constant.numeric</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#FF8F40</string> <!-- Numbers (base09) --> + </dict> + </dict> + + <dict> + <key>scope</key> + <string>variable</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#F07178</string> <!-- Variables (base08) --> + </dict> + </dict> + + <dict> + <key>scope</key> + <string>keyword</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#59C2FF</string> <!-- Keywords (base0D) --> + </dict> + </dict> + + <dict> + <key>scope</key> + <string>support.function</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#D2A6FF</string> <!-- Functions (base0E) --> + </dict> + </dict> + + <dict> + <key>scope</key> + <string>constant.language</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#B8CC52</string> <!-- Constants (base0B) --> + </dict> + </dict> + + <dict> + <key>scope</key> + <string>entity.name.tag</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#95E6CB</string> <!-- Tags (base0C) --> + </dict> + </dict> + + <dict> + <key>scope</key> + <string>invalid</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#E6B673</string> <!-- Invalid (base0F) --> + </dict> + </dict> + </array> +</dict> +</plist> +'' diff --git a/modules/tools/viewer/default.nix b/modules/tools/viewer/default.nix new file mode 100644 index 0000000..dde782b --- /dev/null +++ b/modules/tools/viewer/default.nix @@ -0,0 +1,7 @@ +{ lib, config, ... }: + +{ + imports = [ + ./bat + ]; +} |
