From a61bfe3c5098d82df379d6bcb60750741d7e3a0b Mon Sep 17 00:00:00 2001 From: Filippo Berto Date: Tue, 1 Jun 2021 22:19:24 +0200 Subject: [PATCH] Large module update --- configs/terminator/config | 2 +- custom/default.nix | 15 +++ custom/gallery-tagger/default.nix | 23 ++++ home.nix | 43 +++++-- modules/alacritty.nix | 4 +- modules/bash.nix | 7 +- modules/git.nix | 194 ++++++++++++++++++++++++++++-- modules/kakoune.nix | 54 +++++---- modules/kitty.nix | 17 +++ modules/lf.nix | 13 ++ modules/picom.nix | 1 + modules/screen_locker.nix | 3 +- modules/ssh.nix | 8 +- modules/sxhkd.nix | 68 +++++------ modules/syncthing.nix | 5 + modules/update_background.nix | 45 +++++++ modules/zoxide.nix | 10 ++ modules/zsh.nix | 38 ++++++ 18 files changed, 463 insertions(+), 87 deletions(-) create mode 100644 custom/default.nix create mode 100644 custom/gallery-tagger/default.nix create mode 100644 modules/kitty.nix create mode 100644 modules/lf.nix create mode 100644 modules/syncthing.nix create mode 100644 modules/update_background.nix create mode 100644 modules/zoxide.nix create mode 100644 modules/zsh.nix diff --git a/configs/terminator/config b/configs/terminator/config index 0aa5ae0..4acdefb 100644 --- a/configs/terminator/config +++ b/configs/terminator/config @@ -12,7 +12,7 @@ background_darkness = 0.95 background_type = transparent cursor_color = "#d8dee9" - font = FuraCode Nerd Font Mono weight=450 10 + font = FuraCode Nerd Font Mono weight=450 9 foreground_color = "#d8dee9" show_titlebar = False scrollbar_position = hidden diff --git a/custom/default.nix b/custom/default.nix new file mode 100644 index 0000000..54879c0 --- /dev/null +++ b/custom/default.nix @@ -0,0 +1,15 @@ +{ system ? builtins.currentSystem }: + +let + pkgs = import { inherit system; }; + # pkgs = import (builtins.fetchTarball { + # name = "nixos-unstable-2021-05-26"; + # url = "https://github.com/nixos/nixpkgs/archive/9b7fb215d4d8399772a4f3d6f00fab3747136f53.tar.gz"; + # sha256 = "02d1841j7jg161q7cwh7vryxhv7x3bmnhd1jczx14ggfa66vqfhm"; + # }) { inherit system; }; + callPackage = pkgs.lib.callPackageWith ( pkgs // self ); + self = { + gallery-tagger = callPackage ./gallery-tagger {}; + }; +in self + diff --git a/custom/gallery-tagger/default.nix b/custom/gallery-tagger/default.nix new file mode 100644 index 0000000..4552d62 --- /dev/null +++ b/custom/gallery-tagger/default.nix @@ -0,0 +1,23 @@ +{ lib, stdenv, + cargo, + rustc, + rustPlatform, + gexiv2, + glib, + gcc, + pkg-config +}: + +rustPlatform.buildRustPackage rec { + version = "0.1.2"; + pname = "gallery-tagger"; + nativeBuildInputs = [ cargo rustc gcc pkg-config ]; + buildInputs = [ gexiv2.dev glib.dev ]; + src = builtins.fetchGit { + url = "git@gitlab.com:bertof/galllery-tagger.git"; + ref = "5389813e62dfa790cf20441242d8a7d89f345fa9"; + }; + doCheck = true; + cargoSha256 = "sha256:0nskc778m8nj2v4qidq4jzrb3ac8yg9bjc1l546c1k984321k187"; +} + diff --git a/home.nix b/home.nix index 961edad..d9a0f56 100644 --- a/home.nix +++ b/home.nix @@ -1,7 +1,9 @@ { pkgs, ... }: let + callPackage = pkgs.lib.callPackageWith pkgs; nixpkgs = import {}; + custom = import ./custom/default.nix {}; colorscheme.theme = import ./packages/nord.nix; in { fonts.fontconfig = { @@ -13,43 +15,61 @@ in { keyboard.layout = "it"; keyboard.options = ["terminate:ctrl_alt_bksp" "compose:rctrl"]; packages = (with pkgs; [ + authy + blender discord evolution firefox gallery-dl + gnome3.dconf-editor + gnome3.easytag + gnome3.eog gnome3.evince gnome3.file-roller + gnome3.ghex + gnome3.gitg gnome3.gnome-screenshot + gnome3.gnome-system-monitor gnome3.gnome-tweaks gnome3.nautilus + gnome3.seahorse + gnome3.sushi htop jetbrains.datagrip + keepassxc + krita libreoffice-fresh lutris megasync mpv neofetch nerdfonts + nix-prefetch-git obsidian openvpn pavucontrol pcmanfm + pentablet-driver polybarFull procps-ng shotwell - skypeforlinux slack spotify - steam - wireguard - ]) ++ (with nixpkgs; [ - authy - keepassxc tdesktop teams + transmission-gtk + wireguard + zotero + ]) ++ (with nixpkgs; [ + # steam + skypeforlinux + ]) ++ (with custom; [ + gallery-tagger ]); }; + programs.zsh.enable = true; + imports = [ ./extralib.nix @@ -58,8 +78,8 @@ in { ./modules/alacritty.nix ./modules/bash.nix ./modules/bat.nix - ./modules/broot.nix ./modules/bottom.nix + ./modules/broot.nix ./modules/dircolors.nix ./modules/dunst.nix # ./modules/fzf.nix @@ -70,20 +90,25 @@ in { ./modules/jq.nix ./modules/kakoune.nix ./modules/keychain.nix + # ./modules/kitty.nix + ./modules/lf.nix ./modules/man.nix # ./modules/nix-index.nix ./modules/noti.nix ./modules/obs-studio.nix - ./modules/pazi.nix + # ./modules/pazi.nix ./modules/picom.nix ./modules/qogir_theme.nix ./modules/rofi.nix - ./modules/ssh.nix ./modules/screen_locker.nix ./modules/ssh.nix ./modules/sxhkd.nix + ./modules/syncthing.nix ./modules/terminator.nix ./modules/tmux.nix + ./modules/update_background.nix + ./modules/zoxide.nix + ./modules/zsh.nix ]; # Autolock services: xss-lock.service xautolock-session.service diff --git a/modules/alacritty.nix b/modules/alacritty.nix index a894bf3..823ed58 100644 --- a/modules/alacritty.nix +++ b/modules/alacritty.nix @@ -9,13 +9,13 @@ in { settings = { scrolling.history = 3000; font = { - normal.family = "FuraCode Nerd Font"; + normal.family = "FuraCode Nerd Font Mono"; size = 9.0; }; background_opacity = 0.95; mouse = { hide_when_typing = true; - url.modifiers = "Control"; + hints.modifiers = "Control"; }; # NORD Theme: https://github.com/arcticicestudio/nord-alacritty diff --git a/modules/bash.nix b/modules/bash.nix index 84ed197..c48119f 100644 --- a/modules/bash.nix +++ b/modules/bash.nix @@ -7,5 +7,10 @@ "la" = "ls -la"; ".." = "cd .."; }; - }; + + bashrcExtra = '' + source $HOME/.profile + ''; + }; + } diff --git a/modules/git.nix b/modules/git.nix index 5a0c890..2ad0971 100644 --- a/modules/git.nix +++ b/modules/git.nix @@ -1,8 +1,180 @@ { config, pkgs, lib, ... }: let - kakouneCommand = "${pkgs.kakoune}/bin/kak"; - meldCommand = "${pkgs.meld}/bin/meld"; -in { + kak = "${pkgs.kakoune}/bin/kak"; + meld = "${pkgs.meld}/bin/meld"; + shellAliases = { + "g" = "git"; + "ga" = "git add"; + "gaa" = "git add --all"; + # "gapa"="git add --patch"; + "gau" = "git add --update"; + "gav" = "git add --verbose"; + # "gap"="git apply"; + # "gapt"="git apply --3way"; + "gb" = "git branch"; + "gba" = "git branch -a"; + "gbd" = "git branch -d"; + # "gbda"="git branch --no-color --merged \| command grep -vE"^(\+\|\*\|\s*($(git_main_branch)\|development\|develop\|devel\|dev)\s*$)"\| command xargs -n 1 git branch -d"; + "gbD" = "git branch -D"; + "gbl" = "git blame -b -w"; + "gbnm" = "git branch --no-merged"; + "gbr" = "git branch --remote"; + "gbs" = "git bisect"; + "gbsb" = "git bisect bad"; + "gbsg" = "git bisect good"; + "gbsr" = "git bisect reset"; + "gbss" = "git bisect start"; + "gc" = "git commit -v"; + "gc!" = "git commit -v --amend"; + "gcn!" = "git commit -v --no-edit --amend"; + "gca" = "git commit -v -a"; + "gca!" = "git commit -v -a --amend"; + "gcan!" = "git commit -v -a --no-edit --amend"; + "gcans!" = "git commit -v -a -s --no-edit --amend"; + # "gcam"="git commit -a -m"; + "gcas" = "git commit -a -s"; + # "gcasm"="git commit -a -s -m"; + # "gcsm"="git commit -s -m"; + "gcb" = "git checkout -b"; + # "gcf"="git config --list"; + "gcl" = "git clone --recurse-submodules"; + "gclean" = "git clean -id"; + "gpristine" = "git reset --hard && git clean -dffx"; + # "gcm"="git checkout $(git_main_branch)"; + # "gcd"="git checkout develop"; + # "gcmsg"="git commit -m"; + "gco" = "git checkout"; + "gcount" = "git shortlog -sn"; + "gcp" = "git cherry-pick"; + "gcpa" = "git cherry-pick --abort"; + "gcpc" = "git cherry-pick --continue"; + # "gcs"="git commit -S"; + "gd" = "git diff"; + "gdca" = "git diff --cached"; + "gdcw" = "git diff --cached --word-diff"; + "gdct" = "git describe --tags $(git rev-list --tags --max-count=1)"; + "gds" = "git diff --staged"; + "gdt" = "git diff-tree --no-commit-id --name-only -r"; + # "gdnolock"="git diff $@":(exclude)package-lock.json"":(exclude)*.lock""; + # "gdv"="git diff -w $@ \| view -"; + "gdw" = "git diff --word-diff"; + "gf" = "git fetch"; + "gfa" = "git fetch --all --prune"; + "gfg" = "git ls-files \| grep"; + # "gfo"="git fetch origin"; + # "gg"="git gui citool"; + # "gga"="git gui citool --amend"; + # "ggf"="git push --force origin $(current_branch)"; + # "ggfl"="git push --force-with-lease origin $(current_branch)"; + # "ggl"="git pull origin $(current_branch)"; + # "ggp"="git push origin $(current_branch)"; + # "ggpnp"="ggl && ggp"; + # "ggpull"="git pull origin"$(git_current_branch)""; + # "ggpur"="ggu"; + # "ggpush"="git push origin"$(git_current_branch)""; + # "ggsup"="git branch --set-upstream-to=origin/$(git_current_branch)"; + # "ggu"="git pull --rebase origin $(current_branch)"; + # "gpsup"="git push --set-upstream origin $(git_current_branch)"; + # "ghh"="git help"; + # "gignore"="git update-index --assume-unchanged"; + "gignored" = ''git ls-files -v \| grep"^[[ :lower: ]]"''; + # "git-svn-dcommit-push"="git svn dcommit && git push github $(git_main_branch):svntrunk"; + # "gk"="gitk --all --branches"; + # "gke"="gitk --all $(git log -g --pretty=%h)"; + # "gl"="git pull"; + # "glg"="git log --stat"; + # "glgp"="git log --stat -p"; + # "glgg"="git log --graph"; + # "glgga"="git log --graph --decorate --all"; + # "glgm"="git log --graph --max-count=10"; + "glo" = "git log --oneline --decorate"; + # "glol"="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'"; + "glols" = "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat"; + # "glod"="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'"; + # "glods"="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"; + "glola" = "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all"; + "glog" = "git log --oneline --decorate --graph"; + "gloga" = "git log --oneline --decorate --graph --all"; + # "glp"="git log --pretty=\"; + "gm" = "git merge"; + # "gmom"="git merge origin/$(git_main_branch)"; + # "gmt"="git mergetool --no-prompt"; + # "gmtvim"="git mergetool --no-prompt --tool=vimdiff"; + # "gmum"="git merge upstream/$(git_main_branch)"; + "gma" = "git merge --abort"; + "gp" = "git push"; + # "gpd"="git push --dry-run"; + # "gpf"="git push --force-with-lease"; + "gpf!" = "git push --force"; + "gpoat" = "git push origin --all && git push origin --tags"; + "gpu" = "git push upstream"; + "gpv" = "git push -v"; + "gr" = "git remote"; + "gra" = "git remote add"; + "grb" = "git rebase"; + "grba" = "git rebase --abort"; + "grbc" = "git rebase --continue"; + # "grbd"="git rebase develop"; + "grbi" = "git rebase -i"; + # "grbm"="git rebase $(git_main_branch)"; + # "grbo"="git rebase --onto"; + # "grbs"="git rebase --skip"; + "grev" = "git revert"; + "grh" = "git reset"; + "grhh" = "git reset --hard"; + # "groh"="git reset origin/$(git_current_branch) --hard"; + "grm" = "git rm"; + "grmc" = "git rm --cached"; + # "grmv"="git remote rename"; + # "grrm"="git remote remove"; + "grs" = "git restore"; + # "grset"="git remote set-url"; + # "grss"="git restore --source"; + # "grst"="git restore --staged"; + # "grt"="cd"$(git rev-parse --show-toplevel \|\| echo .)""; + # "gru"="git reset --"; + # "grup"="git remote update"; + "grv" = "git remote -v"; + # "gsb"="git status -sb"; + # "gsd"="git svn dcommit"; + # "gsh"="git show"; + # "gsi"="git submodule init"; + # "gsps"="git show --pretty=short --show-signature"; + # "gsr"="git svn rebase"; + "gss" = "git status -s"; + "gst" = "git status"; + "gsta" = "git stash push"; + "gstas" = "git stash save"; + "gstaa" = "git stash apply"; + "gstc" = "git stash clear"; + "gstd" = "git stash drop"; + "gstl" = "git stash list"; + "gstp" = "git stash pop"; + "gsts" = "git stash show --text"; + # "gstu"="git stash --include-untracked"; + # "gstall"="git stash --all"; + # "gsu"="git submodule update"; + # "gsw"="git switch"; + # "gswc"="git switch -c"; + # "gts"="git tag -s"; + # "gtv"="git tag \| sort -V"; + # "gtl"="gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl"; + # "gunignore"="git update-index --no-assume-unchanged"; + # "gunwip"="git log -n 1 \| grep -q -c"\-\-wip\-\-"&& git reset HEAD~1"; + "gup" = "git pull --rebase"; + "gupv" = "git pull --rebase -v"; + # "gupa"="git pull --rebase --autostash"; + # "gupav"="git pull --rebase --autostash -v"; + # "glum"="git pull upstream $(git_main_branch)"; + # "gwch"="git whatchanged -p --abbrev-commit --pretty=medium"; + # "gwip"="git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m"--wip-- [skip ci]""; + # "gam"="git am"; + # "gamc"="git am --continue"; + # "gams"="git am --skip"; + # "gama"="git am --abort"; + # "gamscp"="git am --show-current-patch"; + }; +in{ programs.git = { enable = true; userName = "Filippo Berto"; @@ -12,15 +184,17 @@ in { 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"; + core.editor = kak; + credential.helper = "cache --timeout = 3600 "; + diff.guitool = meld; + merge.guitool = meld; + pull.rebase = true; + rebase.autostash = true; + init.defaultBranch = "master"; }; lfs.enable = true; delta.enable = true; }; + programs.bash.shellAliases = shellAliases; + programs.zsh.shellAliases = shellAliases; } diff --git a/modules/kakoune.nix b/modules/kakoune.nix index bde6ea9..2ef59ca 100644 --- a/modules/kakoune.nix +++ b/modules/kakoune.nix @@ -1,19 +1,14 @@ { config, lib, pkgs, ... }: let nixpkgs = import {}; + kakCmd = "kak"; in { - home.packages = with pkgs; [ - kak-lsp - rnix-lsp - gocode - gogetdoc - jq - aspell - aspellDicts.it - aspellDicts.en - aspellDicts.en-computers - aspellDicts.en-science - ]; + home.sessionVariables = { + EDITOR = kakCmd; + VISUAL = kakCmd; + }; + programs.bash.shellAliases = { k = kakCmd; }; + programs.zsh.shellAliases = { k = kakCmd; }; programs.kakoune = { enable = true; @@ -21,6 +16,7 @@ in { colorScheme = "nord"; tabStop = 2; indentWidth = 2; + alignWithTabs = true; scrollOff = { lines = 5; columns = 3; @@ -55,8 +51,8 @@ in { { 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 = "WinSetOption"; option = "filetype=(rust|python|c|cpp|latex|javascript|go|nix)"; commands = builtins.concatStringsSep "\n" [ "lsp-enable-window" ]; } + # { name = "BufCreate"; option = ".*"; commands = "editorconfig-load"; } { name = "ModuleLoaded"; option = "powerline"; commands = builtins.concatStringsSep "\n" [ "powerline-enable" ]; } { name = "ModuleLoaded"; option = "auto-pairs"; commands = "auto-pairs-enable"; } { name = "InsertCompletionShow"; option = ".*"; commands = builtins.concatStringsSep "\n" [ "map window insert " "map window insert " ]; } @@ -64,20 +60,30 @@ in { ]; }; 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} # Start kak-lsp" - "require-module auto-pairs" - "require-module powerline" + "# Custom commands" + "define-command -docstring 'save and quit' x 'write-all; quit' # Save and quit with 'x'" + "add-highlighter global/ regex \\h+$ 0:Error # Highlight trailing spaces" + "eval %sh{kak-lsp --kakoune -s \$kak_session} # Start kak-lsp" + "# require-module auto-pairs" + "require-module powerline" ]; - plugins = (with pkgs.kakounePlugins; [ - kak-auto-pairs - ]) ++ (with nixpkgs; [ - kakounePlugins.prelude-kak + plugins = (with pkgs; [ + aspell + aspellDicts.en + aspellDicts.en-computers + aspellDicts.en-science + aspellDicts.it + kak-lsp kakounePlugins.powerline-kak + rnix-lsp + ]) ++ (with nixpkgs; [ + # kakounePlugins.kak-lsp + # kakounePlugins.prelude-kak + # kakounePlugins.auto-pairs-kak ]); }; xdg.configFile."kak-lsp/kak-lsp.toml".source = ../configs/kak-lsp/kak-lsp.toml; } + + diff --git a/modules/kitty.nix b/modules/kitty.nix new file mode 100644 index 0000000..bef212e --- /dev/null +++ b/modules/kitty.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: +let + nord = import ../configs/themes/nord.nix; +in { + home.packages = [ pkgs.nerdfonts ]; + programs.kitty = { + enable = true; + settings = { + # font = { + # package = pkgs.nerdfonts; + # name = "Fira Code Retina Nerd Font Complete"; + # size = 9; + # }; + font = "FuraCode Nerd Font Mono 10"; + }; + }; +} diff --git a/modules/lf.nix b/modules/lf.nix new file mode 100644 index 0000000..47dd859 --- /dev/null +++ b/modules/lf.nix @@ -0,0 +1,13 @@ +{ + programs.lf = { + enable = true; + settings = { + dircounts = true; + icons = true; + # mouse = true; + number = true; + # scrollof = 3; + tabstop = 2; + }; + }; +} diff --git a/modules/picom.nix b/modules/picom.nix index 7063e20..f7cbe9c 100644 --- a/modules/picom.nix +++ b/modules/picom.nix @@ -6,5 +6,6 @@ fade = true; shadow = true; vSync = true; + # backend = "xrender"; }; } diff --git a/modules/screen_locker.nix b/modules/screen_locker.nix index 524b9e5..06390c4 100644 --- a/modules/screen_locker.nix +++ b/modules/screen_locker.nix @@ -1,9 +1,8 @@ { pkgs, ... }: { - home.packages = [ pkgs.betterlockscreen ]; services.screen-locker = { enable = true; - lockCmd = "${pkgs.betterlockscreen}/bin/betterlockscreen -l"; + lockCmd = ''i3lock-color -B 10 --greetertext="Welcome back $USER"''; inactiveInterval = 10; # miutes }; } diff --git a/modules/ssh.nix b/modules/ssh.nix index 84434ff..b91a264 100644 --- a/modules/ssh.nix +++ b/modules/ssh.nix @@ -28,13 +28,13 @@ identityFile = "~/.ssh/heroku"; identitiesOnly = true; }; - "*ngrok.io" = { - hostname = "*ngrok.io"; + "ngrok.io" = { + hostname = "ngrok.io"; identityFile = "~/.ssh/local"; identitiesOnly = true; }; - "172.27.108.*" = { - hostname = "172.27.108.*"; + "172.27.108.?" = { + hostname = "172.27.108.?"; identityFile = "~/.ssh/local"; identitiesOnly = true; }; diff --git a/modules/sxhkd.nix b/modules/sxhkd.nix index 312a537..50e7fbe 100644 --- a/modules/sxhkd.nix +++ b/modules/sxhkd.nix @@ -5,56 +5,56 @@ bash betterlockscreen bspwm - dunst + # dunst findutils gnome3.nautilus - playerctl - pulseaudio-ctl rofi sxhkd terminator + i3lock-color ]; services.sxhkd = let alacritty = "${pkgs.alacritty}/bin/alacritty"; - terminator = "${pkgs.terminator}/bin/terminator"; bspc = "${pkgs.bspwm}/bin/bspc"; - betterlockscreen = "${pkgs.betterlockscreen}/bin/betterlockscreen"; + dunstify = "${pkgs.dunst}/bin/dunstify"; + i3lock-color = "${pkgs.i3lock-color}/bin/i3lock-color"; + playerctl = "${pkgs.playerctl}/bin/playerctl"; + pulseaudio-ctl = "${pkgs.pulseaudio-ctl}/bin/pulseaudio-ctl"; + rofi = "${pkgs.rofi}/bin/rofi"; + terminator = "${pkgs.terminator}/bin/terminator"; in { enable = true; keybindings = { - "super + alt + {h,j,k,l}" = "${bspc} node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}"; - "super + alt + {q,r}" = "${bspc} {quit,wm -r}"; - "super + alt + shift + {h,j,k,l}" = "${bspc} node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}"; - "super + alt + {,+ shift} + m" = ''${betterlockscreen} {-l,-s} -t "Welcome back $USER"''; - "super + bracket{left,right}" = "${bspc} desktop -f {prev,next}.local"; - "super + ctrl + {1-9}" = "${bspc} node -o 0.{1-9}"; - "super + ctrl + {h,j,k,l}" = "${bspc} node -p {west,south,north,east}"; - "super + ctrl + {m,x,y,z}" = "${bspc} node -g {marked,locked,sticky,private}"; - "super + ctrl + shift + space" = "${bspc} query -N -d | xargs -I id -n 1 ${bspc} node id -p cancel"; - "super + ctrl + space" = "${bspc} node -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 + {q,r}" = "bspc {quit,wm -r}"; + "super + alt + shift + {h,j,k,l}" = "bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}"; + "super + alt + m" = ''i3lock-color -B 10 --greetertext="Welcome back $USER"''; + "super + bracket{left,right}" = "bspc desktop -f {prev,next}.local"; + "super + ctrl + {1-9}" = "bspc node -o 0.{1-9}"; + "super + ctrl + {h,j,k,l}" = "bspc node -p {west,south,north,east}"; + "super + ctrl + {m,x,y,z}" = "bspc node -g {marked,locked,sticky,private}"; + "super + ctrl + shift + space" = "bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel"; + "super + ctrl + space" = "bspc node -p cancel"; "super + e" = "nautilus -w"; "super + Escape" = "pkill -USR1 -x sxhkd"; - "super + g" = "${bspc} node -s biggest"; - "super + {grave,Tab}" = "${bspc} {node,desktop} -f last"; - "super + {Left,Down,Up,Right}" = "${bspc} node -v {-20 0,0 20,0 -20,20 0}"; - "super + m" = "${bspc} desktop -l next"; - "super + {o,i}" = "${bspc} wm -h off;${bspc} node {older,newer} -f;${bspc} wm -h on"; - "super + {p,b,comma,period}" = "${bspc} node -f @{parent,brother,first,second}"; - "super + {_,shift + } Return" = "{${alacritty},${terminator}}"; - "super + {_,shift + }{1-9,0}" = "${bspc} {desktop -f,node -d} 'focused:^{1-9,10}'"; - "super + {_,shift + }c" = "${bspc} node -f {next,prev}.local"; - "super + {_,shift + }{h,j,k,l}" = "${bspc} node -{f,s} {west,south,north,east}"; - "super + {_,shift + }w" = "${bspc} node -{c,k}"; + "super + g" = "bspc node -s biggest"; + "super + {grave,Tab}" = "bspc {node,desktop} -f last"; + "super + {Left,Down,Up,Right}" = "bspc node -v {-20 0,0 20,0 -20,20 0}"; + "super + m" = "bspc desktop -l next"; + "super + {o,i}" = "bspc wm -h off;bspc node {older,newer} -f;bspc wm -h on"; + "super + {p,b,comma,period}" = "bspc node -f @{parent,brother,first,second}"; + "super + {_,shift + } Return" = "{alacritty,terminator}"; + "super + {_,shift + }{1-9,0}" = "bspc {desktop -f,node -d} 'focused:^{1-9,10}'"; + "super + {_,shift + }c" = "bspc node -f {next,prev}.local"; + "super + {_,shift + }{h,j,k,l}" = "bspc node -{f,s} {west,south,north,east}"; + "super + {_,shift + }w" = "bspc node -{c,k}"; "super + @space" = "rofi -show drun"; - "super + {t,shift + t,s,f}" = "${bspc} node -t {tiled,pseudo_tiled,floating,fullscreen}"; - "super + y" = "${bspc} node newest.marked.local -n newest.!automatic.local"; - "XF86AudioLowerVolume" = "pulseaudio-ctl down"; - "XF86AudioMute" = "pulseaudio-ctl mute"; - "XF86AudioNext" = "playerctl next"; - "XF86AudioPlay" = "playerctl play-pause"; - "XF86AudioPrev" = "playerctl previous"; - "XF86AudioRaiseVolume" = "pulseaudio-ctl up"; + "super + {t,shift + t,s,f}" = "bspc node -t {tiled,pseudo_tiled,floating,fullscreen}"; + "super + y" = "bspc node newest.marked.local -n newest.!automatic.local"; + "{XF86AudioLowerVolume,XF86AudioMute,XF86AudioRaiseVolume}" = "${dunstify} ${pulseaudio-ctl} {down,mute,up}"; + # "XF86Audio{LowerVolume,Mute,RaiseVolume}" = "${pulseaudio-ctl} {down,mute,up}"; + "XF86Audio{Next,Play,Prev}" = "${playerctl} {next,play-pause,previous}"; }; }; } diff --git a/modules/syncthing.nix b/modules/syncthing.nix new file mode 100644 index 0000000..2ab81c9 --- /dev/null +++ b/modules/syncthing.nix @@ -0,0 +1,5 @@ +{ + services.syncthing = { + enable = true; + }; +} diff --git a/modules/update_background.nix b/modules/update_background.nix new file mode 100644 index 0000000..35cc8b8 --- /dev/null +++ b/modules/update_background.nix @@ -0,0 +1,45 @@ +{ pkgs, config, ... }: +let + fehCmd = "${pkgs.feh}/bin/feh"; + backgrounds_directory = ~/Immagini/Sfondi ; + update_time = 10; +in { + home.file.".local/bin/update_background.sh" = { + text = '' + #!${pkgs.bash}/bin/bash + image=`find ${backgrounds_directory} -type f | grep -v "/\." | shuf -n 1` + ${fehCmd} --bg-fill --no-fehbg "$image" + ''; + target = ".local/bin/update_background.sh"; + executable = true; + }; + + systemd.user.services."update-background" = { + Unit = { + Description = "Update the desktop background"; + After = [ "graphical-session.target" ]; + PartOf = [ "graphical-session.target" ]; + RequiresMountsFor = [ "/home/bertof/Immagini" ]; + }; + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + Service = { + ExecStart = "${config.home.homeDirectory}/${config.home.file.".local/bin/update_background.sh".target}"; + }; + }; + + systemd.user.timers."update-background" = { + Unit = { + Description="Run update-background every ${toString update_time} minutes"; + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session.target" ]; + }; + Timer = { + OnUnitActiveSec="${toString update_time}m"; + }; + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + }; +} diff --git a/modules/zoxide.nix b/modules/zoxide.nix new file mode 100644 index 0000000..560e415 --- /dev/null +++ b/modules/zoxide.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: +let + zoxideCmd = "zoxide"; +in { + programs.zoxide = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + }; +} diff --git a/modules/zsh.nix b/modules/zsh.nix new file mode 100644 index 0000000..d604d60 --- /dev/null +++ b/modules/zsh.nix @@ -0,0 +1,38 @@ +{ pkgs, ... }: +{ + programs.zsh = { + enable = true; + autocd = true; + # plugins = [{ + # name = "powerlevel10k"; + # src = pkgs.zsh-powerlevel10k; + # file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; + # }]; + # initExtraBeforeCompInit = '' + # source $HOME/.p10k.zsh + # ''; + # localVariables = { + # POWERLEVEL9K_LEFT_PROMPT_ELEMENTS = [ "os_icon" "dir" "vcs" "prompt_char" ]; + # POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS = [ "status" "command_execution_time" "background_jobs" "direnv" "nix_shell" "time" "vpn_ip" ] + # }; + }; + programs.starship = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + settings = { + # format = "[$all](inverted)"; + + directory.truncation_symbol = "…/"; + hostname.format = "[$hostname]($style) "; + line_break.disabled = true; + nix_shell.symbol = "❄️ "; + python.python_binary = "python3"; + status = { + disabled = false; + format = "[$symbol $status]($style) "; + }; + username.format = "[$user]($style)@"; + }; + }; +}