commit bee359e19d9382ba6f0806892ecc2b492b7ad0b9 Author: Filippo Berto Date: Sat Apr 17 18:36:54 2021 +0200 Nix dotfiles diff --git a/alacritty.nix b/alacritty.nix new file mode 100644 index 0000000..33bbdf0 --- /dev/null +++ b/alacritty.nix @@ -0,0 +1,73 @@ +{ + scrolling.history = 3000; + font = { + normal.family = "FuraCode Nerd Font"; + size = 9.0; + }; + background_opacity = 0.95; + mouse = { + hide_when_typing = true; + url.modifiers = "Control"; + }; + + # NORD Theme: https://github.com/arcticicestudio/nord-alacritty + colors = { + primary = { + background = "#2e3440"; + foreground = "#d8dee9"; + dim_foreground = "#a5abb6"; + }; + cursor = { + text = "#2e3440"; + cursor = "#d8dee9"; + }; + vi_mode_cursor = { + text = "#2e3440"; + cursor = "#d8dee9"; + }; + selection = { + text = "CellForeground"; + background = "#4c566a"; + }; + search = { + matches = { + foreground = "CellForeground"; + background = "#88c0d0"; + }; + bar = { + background = "#434c5e"; + foreground = "#d8dee9"; + }; + }; + normal = { + black = "#3b4252"; + red = "#bf616a"; + green = "#a3be8c"; + yellow = "#ebcb8b"; + blue = "#81a1c1"; + magenta = "#b48ead"; + cyan = "#88c0d0"; + white = "#e5e9f0"; + }; + bright = { + black = "#4c566a"; + red = "#bf616a"; + green = "#a3be8c"; + yellow = "#ebcb8b"; + blue = "#81a1c1"; + magenta = "#b48ead"; + cyan = "#8fbcbb"; + white = "#eceff4"; + }; + dim = { + black = "#373e4d"; + red = "#94545d"; + green = "#809575"; + yellow = "#b29e75"; + blue = "#68809a"; + magenta = "#8c738c"; + cyan = "#6d96a5"; + white = "#aeb3bb"; + }; + }; +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..c4b7514 --- /dev/null +++ b/home.nix @@ -0,0 +1,108 @@ +{ pkgs, ... }: + +{ + fonts.fontconfig = { + enable = true; + }; + + home = { + language.base = "it_IT.UTF-8"; + keyboard.layout = "it"; + keyboard.options = ["terminate:ctrl_alt_bksp" "compose:rctrl"]; + packages = with pkgs; [ + nerdfonts + ]; + }; + + programs = { + alacritty = { + enable = false; + settings = import ./alacritty.nix; + }; + + bat = { + enable = true; + config = { + theme = "Nord"; + }; + }; + + command-not-found.enable = true; + + broot = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + }; + + dircolors = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + }; + + direnv = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + enableNixDirenvIntegration = true; + }; + + git = + let kakouneCommand = "${pkgs.kakoune}/bin/kak"; + meldCommand = "${pkgs.meld}/bin/meld"; + in { + enable = true; + userName = "Filippo Berto"; + userEmail = "berto.f@protonmail.com"; + signing = { + key = "berto.f@protonmail.com"; + signByDefault = true; + }; + extraConfig = { + core.editor = kakouneCommand; + credential.helper = "cache --timeout=3600"; + diff.guitool = meldCommand; + merge.guitool = meldCommand; + pull.rebase = true; + rebase.autostash = true; + init.defaultBranch = "master"; + }; + lfs.enable = true; + delta.enable = true; + }; + + info.enable = true; + + kakoune = { + enable = true; + config = import ./kakoune.nix pkgs; + extraConfig = builtins.concatStringsSep "\n" [ + "# Extra" + "define-command -docstring 'save and quit' x 'write-all; quit'" + "add-highlighter global/ regex \\h+$ 0:Error" + "eval %sh{kak-lsp --kakoune -s \$kak_session}" + "require-module auto-pairs" + "require-module powerline" + ]; + plugins = [ + pkgs.kakounePlugins.kak-auto-pairs + pkgs.kakounePlugins.kak-auto-pairs + pkgs.kakounePlugins.powerline-kak + pkgs.kakounePlugins.prelude-kak + ]; + }; + + zsh = { + enableVteIntegration = true; + }; + }; + + qt = { + enable = true; + platformTheme = "gtk"; + }; + + xsession.numlock.enable = true; +} + diff --git a/kakoune.nix b/kakoune.nix new file mode 100644 index 0000000..f54fc7b --- /dev/null +++ b/kakoune.nix @@ -0,0 +1,131 @@ +{pkgs, ...} : + +{ + colorScheme = "nord"; + tabStop = 2; + indentWidth = 2; + scrollOff = { + lines = 5; + columns = 3; + }; + ui = { + setTitle = true; + changeColors = true; + enableMouse = true; + }; + wrapLines = { + enable = true; + word = true; + }; + numberLines = { + enable = true; + highlightCursor = true; + }; + keyMappings = [{ + mode = "normal"; + docstring = "Open file"; + key = ""; + effect = ":edit"; + } { + mode = "user"; + docstring = "Comment block"; + key = "b"; + effect = ":comment-block"; + } { + mode = "user"; + docstring = "Comment line"; + key = "l"; + effect = ":comment-line"; + } { + mode = "user"; + docstring = "Show hover info"; + key = "q"; + effect = ":lsp-hover"; + } { + mode = "user"; + docstring = "Jump to definition"; + key = "d"; + effect = ":lsp-definition"; + } { + mode = "user"; + docstring = "List project diagnostics"; + key = "i"; + effect = ":lsp-diagnostics"; + } { + mode = "user"; + docstring = "Jump to type definition"; + key = "t"; + effect = ":lsp-type-definition"; + } { + mode = "user"; + docstring = "Code actions"; + key = "a"; + effect = ":lsp-code-actions"; + } { + mode = "user"; + docstring = "Format code"; + key = "F"; + effect = ":lsp-formatting-sync"; + } { + mode = "user"; + docstring = "Spellcheck"; + key = "s"; + effect = ":spell "; + } { + mode = "user"; + docstring = "Spellcheck English"; + key = "S"; + effect = ":spell en"; + } { + mode = "user"; + docstring = "Copy to clipboard"; + key = "y"; + effect = "${pkgs.xclip}/bin/xclip -i -selection clipboard"; + } { + mode = "user"; + docstring = "Paste from clipboard (before)"; + key = "p"; + effect = "!${pkgs.xclip}/bin/xclip -selection clipboard -o"; + } { + mode = "user"; + docstring = "Paste from clipboard (after)"; + key = "P"; + effect = "${pkgs.xclip}/bin/xclip -selection clipboard -o"; + }]; + hooks = [{ + name = "WinSetOption"; + option = "filetype=(rust|python|c|cpp|latex|javascript|go)"; + commands = builtins.concatStringsSep "\n" [ + "lsp-enable-window" + ]; + } { + name = "BufCreate"; + option = ".*"; + commands = "editorconfig-load"; + } { + name = "ModuleLoaded"; + option = "powerline"; + commands = builtins.concatStringsSep "\n" [ + # "powerline-theme default" + "powerline-enable" + ]; + } { + name = "ModuleLoaded"; + option = "auto-pairs"; + commands = "auto-pairs-enable"; + } { + name = "InsertCompletionShow"; + option = ".*"; + commands = builtins.concatStringsSep "\n" [ + "map window insert " + "map window insert " + ]; + } { + name = "InsertCompletionHide"; + option = ".*"; + commands = builtins.concatStringsSep "\n" [ + "unmap window insert " + "unmap window insert " + ]; + }]; +}