Better modules

This commit is contained in:
Filippo Berto 2021-05-12 18:06:15 +02:00
parent 85a23285b8
commit 21ed795cfd
16 changed files with 534 additions and 302 deletions

View file

@ -1,77 +1,77 @@
{ config, pkgs, lib, ... }:
{
enable = true;
settings = {
scrolling.history = 3000;
font = {
normal.family = "FuraCode Nerd Font";
size = 9.0;
};
background_opacity = 0.95;
mouse = {
hide_when_typing = true;
url.modifiers = "Control";
};
programs.alacritty = {
enable = true;
settings = {
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";
# 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";
};
};
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";
};
};
};

3
modules/bat.nix Normal file
View file

@ -0,0 +1,3 @@
{
programs.bat = { enable = true; config.theme = "Nord"; };
}

7
modules/broot.nix Normal file
View file

@ -0,0 +1,7 @@
{
programs.broot = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
}

7
modules/dircolors.nix Normal file
View file

@ -0,0 +1,7 @@
{
programs.dircolors = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
}

7
modules/direnv.nix Normal file
View file

@ -0,0 +1,7 @@
{
programs.direnv = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
}

View file

@ -3,22 +3,24 @@ 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;
programs.git = {
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;
};
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;
}

View file

@ -2,147 +2,149 @@
let
unstable = import <nixos-unstable> {};
in {
enable = true;
config = {
colorScheme = "nord";
tabStop = 2;
indentWidth = 2;
scrollOff = {
lines = 5;
columns = 3;
programs.kakoune = {
enable = true;
config = {
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 = "<c-o>";
effect = ":edit<space>";
} {
mode = "user";
docstring = "Comment block";
key = "b";
effect = ":comment-block<ret>";
} {
mode = "user";
docstring = "Comment line";
key = "l";
effect = ":comment-line<ret>";
} {
mode = "user";
docstring = "Show hover info";
key = "q";
effect = ":lsp-hover<ret>";
} {
mode = "user";
docstring = "Jump to definition";
key = "d";
effect = ":lsp-definition<ret>";
} {
mode = "user";
docstring = "List project diagnostics";
key = "i";
effect = ":lsp-diagnostics<ret>";
} {
mode = "user";
docstring = "Jump to type definition";
key = "t";
effect = ":lsp-type-definition<ret>";
} {
mode = "user";
docstring = "Code actions";
key = "a";
effect = ":lsp-code-actions<ret>";
} {
mode = "user";
docstring = "Format code";
key = "F";
effect = ":lsp-formatting-sync<ret>";
} {
mode = "user";
docstring = "Spellcheck";
key = "s";
effect = ":spell ";
} {
mode = "user";
docstring = "Spellcheck English";
key = "S";
effect = ":spell en<ret>";
} {
mode = "user";
docstring = "Copy to clipboard";
key = "y";
effect = "<a-|>${pkgs.xclip}/bin/xclip -i -selection clipboard<ret>";
} {
mode = "user";
docstring = "Paste from clipboard (before)";
key = "p";
effect = "!${pkgs.xclip}/bin/xclip -selection clipboard -o<ret>";
} {
mode = "user";
docstring = "Paste from clipboard (after)";
key = "P";
effect = "<a-!>${pkgs.xclip}/bin/xclip -selection clipboard -o<ret>";
}];
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 <tab> <c-n>"
"map window insert <s-tab> <c-p>"
];
} {
name = "InsertCompletionHide";
option = ".*";
commands = builtins.concatStringsSep "\n" [
"unmap window insert <tab> <c-n>"
"unmap window insert <s-tab> <c-p>"
];
}];
};
ui = {
setTitle = true;
changeColors = true;
enableMouse = true;
};
wrapLines = {
enable = true;
word = true;
};
numberLines = {
enable = true;
highlightCursor = true;
};
keyMappings = [{
mode = "normal";
docstring = "Open file";
key = "<c-o>";
effect = ":edit<space>";
} {
mode = "user";
docstring = "Comment block";
key = "b";
effect = ":comment-block<ret>";
} {
mode = "user";
docstring = "Comment line";
key = "l";
effect = ":comment-line<ret>";
} {
mode = "user";
docstring = "Show hover info";
key = "q";
effect = ":lsp-hover<ret>";
} {
mode = "user";
docstring = "Jump to definition";
key = "d";
effect = ":lsp-definition<ret>";
} {
mode = "user";
docstring = "List project diagnostics";
key = "i";
effect = ":lsp-diagnostics<ret>";
} {
mode = "user";
docstring = "Jump to type definition";
key = "t";
effect = ":lsp-type-definition<ret>";
} {
mode = "user";
docstring = "Code actions";
key = "a";
effect = ":lsp-code-actions<ret>";
} {
mode = "user";
docstring = "Format code";
key = "F";
effect = ":lsp-formatting-sync<ret>";
} {
mode = "user";
docstring = "Spellcheck";
key = "s";
effect = ":spell ";
} {
mode = "user";
docstring = "Spellcheck English";
key = "S";
effect = ":spell en<ret>";
} {
mode = "user";
docstring = "Copy to clipboard";
key = "y";
effect = "<a-|>${pkgs.xclip}/bin/xclip -i -selection clipboard<ret>";
} {
mode = "user";
docstring = "Paste from clipboard (before)";
key = "p";
effect = "!${pkgs.xclip}/bin/xclip -selection clipboard -o<ret>";
} {
mode = "user";
docstring = "Paste from clipboard (after)";
key = "P";
effect = "<a-!>${pkgs.xclip}/bin/xclip -selection clipboard -o<ret>";
}];
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 <tab> <c-n>"
"map window insert <s-tab> <c-p>"
];
} {
name = "InsertCompletionHide";
option = ".*";
commands = builtins.concatStringsSep "\n" [
"unmap window insert <tab> <c-n>"
"unmap window insert <s-tab> <c-p>"
];
}];
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 = with pkgs; [
kakounePlugins.kak-auto-pairs
unstable.kakounePlugins.powerline-kak
unstable.kakounePlugins.prelude-kak
];
};
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 = with pkgs; [
kakounePlugins.kak-auto-pairs
unstable.kakounePlugins.powerline-kak
unstable.kakounePlugins.prelude-kak
];
}

67
modules/qogir_theme.nix Normal file
View file

@ -0,0 +1,67 @@
{ pkgs, ... }:
{
gtk = {
enable = true;
font = {
package = pkgs.cantarell-fonts;
name = "Cantarell";
size = 9;
};
iconTheme = {
package = pkgs.qogir-icon-theme;
name = "Qogir-dark";
};
theme = {
package = pkgs.qogir-theme;
name = "Qogir-dark";
};
# gtk3.extraConfig = {
# gtk-theme-name=Drakula
# gtk-icon-theme-name=Qogir-dark
# gtk-font-name=Cantarell 9
# gtk-cursor-theme-name=capitaine-cursors
# gtk-cursor-theme-size=0
# gtk-toolbar-style=GTK_TOOLBAR_ICONS
# gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
# gtk-button-images=1
# gtk-menu-images=1
# gtk-enable-event-sounds=1
# gtk-enable-input-feedback-sounds=1
# gtk-xft-antialias=1
# gtk-xft-hinting=1
# gtk-xft-hintstyle=hintfull
# gtk-xft-rgba=none
# };
# gtk2.extraConfig = {
# gtk-theme-name="Arc-Dark"
# gtk-icon-theme-name="Qogir-dark"
# gtk-font-name="Cantarell 9"
# gtk-cursor-theme-name="capitaine-cursors"
# gtk-cursor-theme-size=0
# gtk-toolbar-style=GTK_TOOLBAR_ICONS
# gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
# gtk-button-images=1
# gtk-menu-images=1
# gtk-enable-event-sounds=1
# gtk-enable-input-feedback-sounds=1
# gtk-xft-antialias=1
# gtk-xft-hinting=1
# gtk-xft-hintstyle="hintfull"
# gtk-xft-rgba="none"
# };
};
qt = {
enable = true;
platformTheme = "gtk";
};
xsession = {
numlock.enable = true;
pointerCursor = {
package = pkgs.qogir-icon-theme;
name = "Qogir";
size = 24;
};
};
}

View file

@ -1,8 +1,11 @@
{ config, pkgs, lib, ... }:
{
enable = true;
extraConfig = {
modi = "drun,run,ssh,window";
};
programs.rofi = {
enable = true;
extraConfig = {
modi = "drun,run,ssh,window";
theme = "nord";
};
};
xdg.configFile."rofi/nord.rasi".source = ../configs/rofi/nord.rasi;
}

View file

@ -7,41 +7,47 @@ let
pulseaudioCtl = "${pkgs.pulseaudio-ctl}/bin/pulseaudio-ctl";
playerctl = "${pkgs.playerctl}/bin/playerctl";
alacritty = "${pkgs.alacritty}/bin/alacritty";
terminator= "${pkgs.terminator}/bin/terminator";
rofi = "${pkgs.rofi}/bin/rofi";
bash = "${pkgs.bash}/bin/bash";
in {
enable = true;
keybindings = {
"super + Return" = "${bash} ${alacritty}";
"super + @space" = "${rofi} -show drun";
"super + e" = "${nautilus} -w";
"super + Escape" = "pkill -USR1 -x sxhkd";
"super + {_,shift + }w" = "${bspc} node -{c,k}";
"super + m" = "${bspc} desktop -l next";
"super + y" = "${bspc} node newest.marked.local -n newest.!automatic.local";
"super + g" = "${bspc} node -s biggest";
"super + {t,shift + t,s,f}" = "${bspc} node -t {tiled,pseudo_tiled,floating,fullscreen}";
"super + ctrl + {m,x,y,z}" = "${bspc} node -g {marked,locked,sticky,private}";
"super + {_,shift + }{h,j,k,l}" = "${bspc} node -{f,s} {west,south,north,east}";
"super + {p,b,comma,period}" = "${bspc} node -f @{parent,brother,first,second}";
"super + {_,shift + }c" = "${bspc} node -f {next,prev}.local";
"super + bracket{left,right}" = "${bspc} desktop -f {prev,next}.local";
"super + {grave,Tab}" = "${bspc} {node,desktop} -f last";
"super + {o,i}" = "${bspc} wm -h off;${bspc} node {older,newer} -f;${bspc} wm -h on";
"super + {_,shift + }{1-9,0}" = "${bspc} {desktop -f,node -d} 'focused:^{1-9,10}'";
"super + ctrl + {h,j,k,l}" = "${bspc} node -p {west,south,north,east}";
"super + ctrl + {1-9}" = "${bspc} node -o 0.{1-9}";
"super + ctrl + space" = "${bspc} node -p cancel";
"super + ctrl + shift + space" = "${bspc} query -N -d | xargs -I id -n 1 ${bspc} node id -p cancel";
"super + alt + {h,j,k,l}" = "${bspc} node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}";
"super + alt + shift + {h,j,k,l}" = "${bspc} node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}";
"super + {Left,Down,Up,Right}" = "${bspc} node -v {-20 0,0 20,0 -20,20 0}";
"XF86AudioRaiseVolume" = "${pulseaudioCtl} up";
"XF86AudioLowerVolume" = "${pulseaudioCtl} down";
"XF86AudioMute" = "${pulseaudioCtl} mute";
"XF86AudioPlay" = "${playerctl} play-pause";
"XF86AudioNext" = "${playerctl} next";
"XF86AudioPrev" = "${playerctl} previous";
in
{
services.sxhkd = {
enable = true;
keybindings = {
"super + Return" = "${bash} -c ${alacritty} || ${terminator}";
"super + @space" = "${rofi} -show drun";
"super + e" = "${nautilus} -w";
"super + Escape" = "pkill -USR1 -x sxhkd";
"super + alt + {q,r}" = "${bspc} {quit,wm -r}";
"super + {_,shift + }w" = "${bspc} node -{c,k}";
"super + m" = "${bspc} desktop -l next";
"super + y" = "${bspc} node newest.marked.local -n newest.!automatic.local";
"super + g" = "${bspc} node -s biggest";
"super + {t,shift + t,s,f}" = "${bspc} node -t {tiled,pseudo_tiled,floating,fullscreen}";
"super + ctrl + {m,x,y,z}" = "${bspc} node -g {marked,locked,sticky,private}";
"super + {_,shift + }{h,j,k,l}" = "${bspc} node -{f,s} {west,south,north,east}";
"super + {p,b,comma,period}" = "${bspc} node -f @{parent,brother,first,second}";
"super + {_,shift + }c" = "${bspc} node -f {next,prev}.local";
"super + bracket{left,right}" = "${bspc} desktop -f {prev,next}.local";
"super + {grave,Tab}" = "${bspc} {node,desktop} -f last";
"super + {o,i}" = "${bspc} wm -h off;${bspc} node {older,newer} -f;${bspc} wm -h on";
"super + {_,shift + }{1-9,0}" = "${bspc} {desktop -f,node -d} 'focused:^{1-9,10}'";
"super + ctrl + {h,j,k,l}" = "${bspc} node -p {west,south,north,east}";
"super + ctrl + {1-9}" = "${bspc} node -o 0.{1-9}";
"super + ctrl + space" = "${bspc} node -p cancel";
"super + ctrl + shift + space" = "${bspc} query -N -d | xargs -I id -n 1 ${bspc} node id -p cancel";
"super + alt + {h,j,k,l}" = "${bspc} node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}";
"super + alt + shift + {h,j,k,l}" = "${bspc} node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}";
"super + {Left,Down,Up,Right}" = "${bspc} node -v {-20 0,0 20,0 -20,20 0}";
"XF86AudioRaiseVolume" = "${pulseaudioCtl} up";
"XF86AudioLowerVolume" = "${pulseaudioCtl} down";
"XF86AudioMute" = "${pulseaudioCtl} mute";
"XF86AudioPlay" = "${playerctl} play-pause";
"XF86AudioNext" = "${playerctl} next";
"XF86AudioPrev" = "${playerctl} previous";
};
};
}

8
modules/terminator.nix Normal file
View file

@ -0,0 +1,8 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
terminator
];
xdg.configFile."terminator/config".source = ../configs/terminator/config;
}