diff --git a/config.nix b/config.nix index 69baf10..7e0a949 100644 --- a/config.nix +++ b/config.nix @@ -1 +1,4 @@ -{ allowUnfree = true; } +{ + allowUnfree = true; + allowUnsupportedSystem = true; +} diff --git a/extralib.nix b/extralib.nix new file mode 100644 index 0000000..ddfc75e --- /dev/null +++ b/extralib.nix @@ -0,0 +1,98 @@ +{ lib ? (import {}).lib, ... }: +with lib; +with builtins; +{ + lib = { + floats = rec { + _floatComponents = f: lib.strings.splitString "." (toString f); + + ceil = f: + let + comp = _floatComponents f; + int = strings.toInt (head comp); + inc = if match "[1-9][[:digit:]]*" (head (tail comp)) != null then 1 else 0; + in + assert(isFloat f); + int + inc; + + floor = f: + let + int = strings.toInt (head (_floatComponents f)); + in + assert(isFloat f); + int; + + toInt = f: + let + comp = _floatComponents f; + int = strings.toInt (head comp); + inc = if match "[5-9][[:digit:]]*" (head (tail comp)) != null then 1 else 0; + in + assert(isFloat f); + int + inc; + }; + + hex = rec { + parseDigit = c: + let + v = strings.toUpper c; + in + assert(match "[0-9A-F]" c != null); + { + "0" = 0; + "1" = 1; + "2" = 2; + "3" = 3; + "4" = 4; + "5" = 5; + "6" = 6; + "7" = 7; + "8" = 8; + "9" = 9; + "A" = 10; + "B" = 11; + "C" = 12; + "D" = 13; + "E" = 14; + "F" = 15; + }."${v}"; + + toDec = s: + let characters = stringToCharacters s; + values = map parseDigit characters; + value = foldl (acc: n: acc * 16 + n) 0 values; + in value; + + fromDec = trivial.toHexString; + + }; + + # colors = rec { + + + + # colorFromHex = s: + # let rgba = match "#([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})" s; + # rgb = match "#([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})" s; + # values = map hexToDec (if isNull rgb then rgba else rgb ++ [ "FF" ]); + # in { + # r = (head values) / 255.0; + # g = (head (tail values)) / 255.0; + # b = (head (drop 2 values)) / 255.0; + # a = (last values) / 255.0; + # }; + + # red = { r = 255.0; g = 0.0; b = 0.0; }; + # green = { r = 0.0; g = 255.0; b = 0.0; }; + # blue = { r = 0.0; g = 0.0; b = 255.0; }; + + # toRGBHex = { r, g, b, ... }: + # ''#${concatMapStrings (v: fixedWidthString 2 "0" (toHexString (v * 255))) [ r g b ]}''; + # toRGBAHex = { r, g, b, a }: + # ''#${concatMapStrings (v: fixedWidthString 2 "0" (toHexString v)) [ r g b a ]}''; + + # toRgbHex = c: strings.toLower (toRGBHex c); + # toRgbaHex = c: strings.toLower (toRGBAHex c); + # }; + }; +} diff --git a/home.nix b/home.nix index cc2f7a6..19ab9a2 100644 --- a/home.nix +++ b/home.nix @@ -13,34 +13,50 @@ in { keyboard.layout = "it"; keyboard.options = ["terminate:ctrl_alt_bksp" "compose:rctrl"]; packages = (with pkgs; [ - htop - neofetch discord - evolutionWithPlugins + evolution firefox + gallery-dl gnome3.evince + gnome3.file-roller gnome3.nautilus + gnome3.gnome-screenshot + gnome3.gnome-tweaks + htop jetbrains.datagrip + lutris megasync mpv + libreoffice-fresh + neofetch nerdfonts + obsidian + openvpn pavucontrol pcmanfm polybarFull procps-ng + shotwell skypeforlinux slack spotify - teams + steam + wireguard ]) ++ (with nixpkgs; [ authy keepassxc tdesktop + teams ]); }; imports = [ + # ./extralib.nix + + ./modules/configurations.nix + ./modules/alacritty.nix + ./modules/bash.nix ./modules/bat.nix ./modules/broot.nix ./modules/bottom.nix @@ -50,13 +66,23 @@ in { ./modules/git.nix ./modules/go.nix ./modules/gpg.nix + ./modules/info.nix + ./modules/jq.nix ./modules/kakoune.nix + ./modules/keychain.nix + ./modules/man.nix + # ./modules/nix-index.nix + ./modules/noti.nix + ./modules/obs-studio.nix + ./modules/pazi.nix ./modules/picom.nix ./modules/qogir_theme.nix ./modules/rofi.nix + ./modules/ssh.nix ./modules/screen_locker.nix ./modules/sxhkd.nix ./modules/terminator.nix + ./modules/tmux.nix ]; programs = { diff --git a/modules/alacritty.nix b/modules/alacritty.nix index 2fe3f5c..a894bf3 100644 --- a/modules/alacritty.nix +++ b/modules/alacritty.nix @@ -48,7 +48,7 @@ in { }; }; normal = { - black = nord.n1; + black = nord.n0; red = nord.n11; green = nord.n14; yellow = nord.n13; @@ -75,7 +75,7 @@ in { blue = "#68809a"; magenta = "#8c738c"; cyan = "#6d96a5"; - white = "#aeb3bb"; + white = nord.n4; }; }; }; diff --git a/modules/bash.nix b/modules/bash.nix new file mode 100644 index 0000000..84ed197 --- /dev/null +++ b/modules/bash.nix @@ -0,0 +1,11 @@ +{ + programs.bash = { + enable = true; + enableVteIntegration = true; + shellAliases = { + "ll" = "ls -l"; + "la" = "ls -la"; + ".." = "cd .."; + }; + }; +} diff --git a/modules/bottom.nix b/modules/bottom.nix index 2d111e8..5688b27 100644 --- a/modules/bottom.nix +++ b/modules/bottom.nix @@ -7,6 +7,7 @@ in { xdg.configFile."bottom/bottom.toml".source = tomlGenerate { "flags" = { "left_legend" = true; + "color" = "nord"; }; }; } diff --git a/modules/configurations.nix b/modules/configurations.nix new file mode 100644 index 0000000..5dee611 --- /dev/null +++ b/modules/configurations.nix @@ -0,0 +1,6 @@ +{ + home.file.".editorconfig" = { + source = ../configs/editorconfig; + target = ".editorconfig"; + }; +} diff --git a/modules/info.nix b/modules/info.nix new file mode 100644 index 0000000..3f0ee2a --- /dev/null +++ b/modules/info.nix @@ -0,0 +1,5 @@ +{ + programs.info = { + enable = true; + }; +} diff --git a/modules/jq.nix b/modules/jq.nix new file mode 100644 index 0000000..9d9f199 --- /dev/null +++ b/modules/jq.nix @@ -0,0 +1,5 @@ +{ + programs.jq = { + enable = true; + }; +} diff --git a/modules/keychain.nix b/modules/keychain.nix new file mode 100644 index 0000000..5d3502b --- /dev/null +++ b/modules/keychain.nix @@ -0,0 +1,10 @@ +{ + programs.keychain = { + enable = true; + keys = [ "id_ed25519" "bitbucket" "github" "gitlab" "heroku" "local" ]; + agents = [ "gpg" "ssh" ]; + enableBashIntegration = true; + enableZshIntegration = true; + enableXsessionIntegration = true; + }; +} diff --git a/modules/man.nix b/modules/man.nix new file mode 100644 index 0000000..f462180 --- /dev/null +++ b/modules/man.nix @@ -0,0 +1,5 @@ +{ + programs.man = { + enable = true; + }; +} diff --git a/modules/nix-index.nix b/modules/nix-index.nix new file mode 100644 index 0000000..c38d223 --- /dev/null +++ b/modules/nix-index.nix @@ -0,0 +1,7 @@ +{ + programs.nix-index = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + }; +} diff --git a/modules/noti.nix b/modules/noti.nix new file mode 100644 index 0000000..d15112c --- /dev/null +++ b/modules/noti.nix @@ -0,0 +1,5 @@ +{ + programs.noti = { + enable = true; + }; +} diff --git a/modules/obs-studio.nix b/modules/obs-studio.nix new file mode 100644 index 0000000..e734af3 --- /dev/null +++ b/modules/obs-studio.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: +{ + programs.obs-studio = { + enable = true; + plugins = with pkgs; [ + # obs-linuxbrowser + obs-v4l2sink + obs-gstreamer + obs-move-transition + ]; + }; +} diff --git a/modules/pazi.nix b/modules/pazi.nix new file mode 100644 index 0000000..01701a9 --- /dev/null +++ b/modules/pazi.nix @@ -0,0 +1,7 @@ +{ + programs.pazi = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + }; +} diff --git a/modules/rofi.nix b/modules/rofi.nix index 03b5f39..813c57a 100644 --- a/modules/rofi.nix +++ b/modules/rofi.nix @@ -1,14 +1,14 @@ { programs.rofi = { enable = true; - # extraConfig = { - # modi = "drun,run,ssh,window"; - # theme = "nord"; - # }; - extraConfig = " - modi = drun,run,ssh,window - theme = nord - "; + # # extraConfig = { + # # modi = "drun,run,ssh,window"; + # # theme = "nord"; + # # }; + # extraConfig = " + # modi = drun,run,ssh,window + # theme = nord + # "; }; xdg.configFile."rofi/nord.rasi".source = ../configs/rofi/nord.rasi; diff --git a/modules/screen_locker.nix b/modules/screen_locker.nix index d8f0108..524b9e5 100644 --- a/modules/screen_locker.nix +++ b/modules/screen_locker.nix @@ -1,9 +1,9 @@ { pkgs, ... }: { - # home.packages = [ pkgs.betterlockscreen ]; + home.packages = [ pkgs.betterlockscreen ]; services.screen-locker = { enable = true; - lockCmd = "/usr/bin/betterlockscreen -l"; - inactiveInterval = 5; # miutes + lockCmd = "${pkgs.betterlockscreen}/bin/betterlockscreen -l"; + inactiveInterval = 10; # miutes }; } diff --git a/modules/ssh.nix b/modules/ssh.nix new file mode 100644 index 0000000..84434ff --- /dev/null +++ b/modules/ssh.nix @@ -0,0 +1,46 @@ +{ + programs.ssh = { + enable = true; + compression = true; + matchBlocks = { + "gitlab.com" = { + hostname = "gitlab.com"; + identityFile = "~/.ssh/gitlab"; + identitiesOnly = true; + }; + "github.com" = { + hostname = "github.com"; + identityFile = "~/.ssh/github"; + identitiesOnly = true; + }; + "bitbucket.com" = { + hostname = "bitbucket.com"; + identityFile = "~/.ssh/bitbucket"; + identitiesOnly = true; + }; + "aur.archlinux.org" = { + hostname = "aur.archlinux.org"; + identityFile = "~/.ssh/aur"; + identitiesOnly = true; + }; + "heroku.com" = { + hostname = "heroku.com"; + identityFile = "~/.ssh/heroku"; + identitiesOnly = true; + }; + "*ngrok.io" = { + hostname = "*ngrok.io"; + identityFile = "~/.ssh/local"; + identitiesOnly = true; + }; + "172.27.108.*" = { + hostname = "172.27.108.*"; + identityFile = "~/.ssh/local"; + identitiesOnly = true; + }; + "*" = { + identityFile = "~/.ssh/id_ed25519"; + }; + }; + }; +} diff --git a/modules/sxhkd.nix b/modules/sxhkd.nix index 3703874..9004cd3 100644 --- a/modules/sxhkd.nix +++ b/modules/sxhkd.nix @@ -1,66 +1,62 @@ { config, pkgs, lib, ... }: { - home.packages = with pkgs; [ - bspwm - findutils - gnome3.nautilus - pulseaudio-ctl - playerctl - alacritty - terminator - rofi - bash - betterlockscreen - ]; + home.packages = with pkgs; [ + alacritty + bash + betterlockscreen + bspwm + dunst + findutils + gnome3.nautilus + playerctl + pulseaudio-ctl + rofi + sxhkd + terminator + ]; - services.sxhkd = let - sxhkd = "${pkgs.sxhkd}/bin/sxhkd"; - bspc = "${pkgs.bspwm}/bin/bspc"; - xarg = "${pkgs.findutils}/bin/xargs"; - nautilus = "${pkgs.gnome3.nautilus}/bin/nautilus"; - 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"; - betterlockscreen = "betterlockscreen"; - in { - enable = true; - keybindings = { - "super + Return" = "${bash} -c ${alacritty} || /usr/bin/alacritty || ${terminator}"; - "super + @space" = "${rofi} -show drun"; - "super + e" = "${nautilus} -w"; - "super + alt + {,+ shift} + m" = ''${betterlockscreen} {-l,-s} -t "Welcome back $USER"''; - "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"; - }; - }; + services.sxhkd = let + alacritty = "${pkgs.alacritty}/bin/alacritty"; + bash = "${pkgs.bash}/bin/bash"; + rofi = "${pkgs.rofi}/bin/rofi"; + terminator = "${pkgs.terminator}/bin/terminator"; + in { + enable = true; + keybindings = { + "super + Return" = ''${alacritty} -c "${alacritty} || /usr/bin/alacritty || ${terminator}"''; + "super + @space" = "${rofi} -show drun"; + "super + e" = "nautilus -w"; + "super + alt + e" = ''dunstify "Welcome back $USER"''; + "super + alt + {,+ shift} + m" = ''betterlockscreen {-l,-s} -t "Welcome back $USER"''; + "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" = "pulseaudio-ctl up"; + "XF86AudioLowerVolume" = "pulseaudio-ctl down"; + "XF86AudioMute" = "pulseaudio-ctl mute"; + "XF86AudioPlay" = "playerctl play-pause"; + "XF86AudioNext" = "playerctl next"; + "XF86AudioPrev" = "playerctl previous"; + }; + }; } diff --git a/modules/tmux.nix b/modules/tmux.nix new file mode 100644 index 0000000..a2b8cec --- /dev/null +++ b/modules/tmux.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: +{ + programs.tmux = { + enable = true; + clock24 = true; + escapeTime = 25; + plugins = with pkgs; [ + tmuxPlugins.continuum + tmuxPlugins.prefix-highlight + tmuxPlugins.nord + ]; + extraConfig = '' + set -g mouse on + ''; + + # set -g default-terminal "screen" + # set -ga terminal-overrides ",col:Tc" + + }; +}