diff --git a/.gitconfig b/.gitconfig deleted file mode 100644 index 28efabe..0000000 --- a/.gitconfig +++ /dev/null @@ -1,39 +0,0 @@ -[user] - email = bulavintsev.sergey@gmail.com - name = Sergei Bulavintsev - signingkey = 7C43420F61CEC7FB -[alias] - st = status -sb - lga = log --oneline --all --decorate --graph --color - lg = log --pretty=lg - glg = log --graph --pretty=lg - slg = stash list --pretty=reflg - hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short -[push] - default = simple - autoSetupRemote = true -[core] - pager = bat -[merge] - tool = nvimdiff - conflictstyle = diff3 -[diff] - tool = nvimdiff -[difftool] - prompt = false -[mergetool] - prompt = false -[difftool "nvimdiff"] - cmd = nvim -d $LOCAL $REMOTE -[mergetool "nvimdiff"] - cmd = nvim -d $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J' -[init] - templatedir = ~/.git_template -[pull] - rebase = false -[commit] - gpgsign = true -[includeIf "gitdir:~/git_pagaya/"] - path = .gitconfig-pagaya -[includeIf "hasconfig:remote.*.url:*pagaya/*"] - path = .gitconfig-pagaya diff --git a/.gitconfig-pagaya b/.gitconfig-pagaya deleted file mode 100644 index a93fd7d..0000000 --- a/.gitconfig-pagaya +++ /dev/null @@ -1,3 +0,0 @@ -[user] - email = sergei.bulavintsev@pagaya.com - signingKey = 154F12F0D4D73FE2 diff --git a/.github/workflows/update-readme.yml b/.github/workflows/update-readme.yml deleted file mode 100644 index 1b701b1..0000000 --- a/.github/workflows/update-readme.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Update README - -on: - push: - paths: - - 'Makefile' - workflow_dispatch: - -jobs: - auto-readme-update: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@master - - - name: Re-generate readme - working-directory: ./${{ matrix.module }} - run: | - cat templates/README.md > README.md - make >> README.md - echo "\`\`\`" >>README.md - - - - uses: stefanzweifel/git-auto-commit-action@v4 - env: - GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_PAT }} - with: - commit_message: "doc: Update generated README" - branch: master - commit_user_name: sbulavs readme-update 🤖 - commit_user_email: actions@github.com - commit_author: auto-readme-update 🤖 diff --git a/.gitignore b/.gitignore index 38222cf..c5277e4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ nvim/.netrwhist nvim/plugin/ .DS_Store -nix/home-manager/desktop/hypr/hyprpaper.conf diff --git a/.vim_help b/.vim_help deleted file mode 100644 index ab4f819..0000000 --- a/.vim_help +++ /dev/null @@ -1,210 +0,0 @@ -VIM general tips -nmap ] :write:!%:p -set ts=4 sw=4 sts=4 -!!!! - . точка повторить предыдую команду -set mouse=a - включить мышь - -В NORMAL MODE -SHIFT+V - выбрать блок visual line -CONTROL+V - выбрать блок в visual block -<< >> подвинуть выбранный блок на один shiftwidth -5> 5< подвинуть выбранный блок на 5 shiftwidth -CTRL+V, 5j, SHIFT+i, #, ESC - закомментировать 5 строк -CTRL+V, 5j, SHIFT+i, x, ESC - удалить первый символ у 5 строк -di> или yi} или di) удалить/скопировать строки внутри блока <> {} () -H', 'M' и "L" перемещают курсор на верхнюю, среднюю и нижнюю линии экрана соответственно. -'zt', 'zz', 'zb' не перемещают курсор, но скролят текст так, чтобы курсор оказался вверху, в середине, либо в низу экрана. -'*' ищет следующее появление слова, на котором находится курсор вперед по тексту, -'#' делает тоже самое назад -% - переместить курсор на открывающую или закрывающую скобку ()[]{} -:read file считать из файла -c = ce,c3w - заменить n слов и перейти в режим редактирования -C - заменить до конца строки -s - удалить символ под курсором, перейти to insert -S - удалить строку под курсором, перейти to insert -A - move to eol, switch to insert mode -I - move to start of line, switch to insert mode -{,} - переместить курсор к концу/началу параграфа -(,) - переместить курсор к концу/началу предложения - -В INSERT MODE -ctrl+o, move - выполнить одну команду и перейти назад в insert mode - -1.Показывать спецсимволы -:set list - показывать спецсимволы -:set nolist - не показывать спецсимволы -:set list! - инверсировать показ - -nmap l :set list! переключать отображение по \l - -set listchars=tab:>\ ,eol:¬ - -можно изменить цвет у спецсимволов -highlight NonText guifg=#4a4a59 -highlight SpecialKey guifg=#4a4a59 - -:help 'list' -:help listchars -:help hl-NonText -:help hl-SpecialKey -:help i_CTRL-V_digit - inserting special characters - -2. Табуляция -:set ts=4 - количество символов(ширина) -:set sts=4 - softtabstop количество пробелов, за которые считается при вставке (работает при noexpandtab если хотим вставлять меньше чем sts) -:set sw=4 - количество пробелов при вставке или удалении в нормальном режиме -:set expandtab - заменять символ табуляции пробелами - -Если пользуетесь : -:set noexpandtab -:set ts=4 sts=0 sw=4 - -Если пользуетесь пробелами -:set expandtab -:set ts=4 sts=4 sw=4 - -:help tabstop -:help softtabstop -:help shiftwidth -:help expandtab - -4. Замена пробелов табуляцией -:retab! - Замена пробелов табуляцией -Vjjjj:retab! - выделить визуальный блок в 4 строки и применить к нему retab - -:%s/\s\+$//e - удалить все пробелы в конце строк во всем файле: - :%s - режим замены - \s - символ пробела - \+ - один или больше - $ - конец строки - //e заменить на пусто, игнорировать ошибки - - -:g/^$/d - удалить пустые строки - :g - выполнить команду для подходящих строк - ^$ - начало конец строки - /d - удалить строку - -5. Отступы -<<,>> - отступ ts на текущей строке -5>> отступ ts на 5 строках -shift+v, выбор количества строк, <,> - отступ на выделенном блоке "." повторить еще раз предыдущую команду - -== - автоотступ строки по вышестоящей строке -5== - автоотступ на 5 строчек -== в visual автоотступ на блок - -= -=G - расставить автоотступы до конца файла - -vi} - выбрать текст визуальный режим внутри {} () и т.д. -=i} - автоотступ внутри блока - -6. Работа с буферами - -Когда мы открываем файл, он поменяется в буфер -Можно считать несколько файлов vim 1.txt 2.txt - -:ls Вывести список файлов в буфере -:bn открыть следующий буфер в этом окне -:bp открыть предыдущий буфер в этом окне -CTRL-^ перепрыгруть в альтернативный файл - -Если в буфер были внесены изменения, то он считается hidden -:w записать в файл -:e! восстановить оригинальный файл -:bd! удалить буфер, отбросив все изменения -:q! выйти не сохраняя все буферы -:b переключиться на буфер с определенным именем - -7. Работа с окнами - -Можно просматривать несколько буферов одновременно, разделяя их на окна -Разделить экран на окна: -ctrl-w s Разделить текущее окно горизонтально, открываяя в новом окне текущий файл -ctrl-w v Разделить текущее окно вертикально, открываяя в новом окне текущий файл -:sp[lit] filename Разделить текущее окно горизонтально, открывая filename в новом окне -:vsp[lit] filename Разделить текущее окно вертикально, открывая filename в новом окне - -:q[uit] закрыть текущее окно -:on[ly] - оставить открытым только текущее окно - -Изменить фокус текущего окна -ctrl-w w Перевести фокус на следующее окно -ctrl-w h[j,k,l] Перевести фокус налево[вниз, вверх, вправо] - -Изменить размер окна -ctrl-w + Увеличить высоту текущего окна на 1 строку -ctrl-w - Уменьшить высоту текущего окна на 1 строку -ctrl-w < Увеличить ширину текущего окна на 1 столбец -ctrl-w > Уменьшить ширину текущего окна на 1 столбец -ctrl-w _ Максимизировать ширину текущего окна -ctrl-w | Максимизировать высоту текущего окна - -Перемещение окон -ctrl-w r Прокрутить все окна -ctrl-w x поменять местами текущее окно и соседское -ctrl-w H[J,K,L] поместить текущее окно на самое левое[правое, нижнее, верхнее, левое] место -Ctrl-w K — вертикальные окна, сделает горизонтальными. -Ctrl-w H — горизонтальные окна, сделает вертикальными. - -8. Работа с табами - -Открытие и закрытие табов -:tabe[dit] filename открыть файл в новом табе -ctrl-w T переместить разбитые окна в табы -:q закрыть окно, закроет таб если в табе одно окно -:tabc[lose] закрыть текущий таб и все его окна -:tabo[nly] закрыть все табы, кроме текущего - -Переключение между табами -gt перейти на следующий таб -gT перейти на предыдущий таб -#gt перейти на таб номер # - -Перемещение табов -:tabmove переместить текущий таб в конец -:tabmove 0 переместить текущий таб в начало -:tabmove 1 переместить текущий таб на место второго таба - -9. Работа с табами -По умолчанию вим не открывает файлы в новом табе. Он открывает файл в новом буфере, и делает буфер активным в текущем табе. -Буферы отображают список открытых файлов. -У каждого таба есть свой рабочий каталог -:pwd посмотреть текущий каталог для активного таба -:vimgrep pattern ** поиск по всем файлам в текущем каталоге, при этом в активном табе будет отображен первый файл с вхождением(и добавит файл в буфер если его там нет) -:cd изменить текущий рабочий каталог для активного таба - -11. Работа с Changelist -vim ведет список всех позиций курсора, где производились изменения -Можно по этому листу перемещать курсор -g; - переместить курсор на предыдущую позицию редактирования -g, - переместить курсор на следующую позицию редактирования -:changes - список всех позиций где производились изменения - -vim также ведет список всех прыжков по файлу, включая перемещение при поиске, H M L, {}, () -ctrl-o - переместиться на предыдуее место прыжка -ctrl-i - переместиться в следующее место прыжка -:jumps - вывести список перемещений по экрану. - - - -12. Сворачивание блоков кода -То, как vim будет сворачивать блоки кода, определяется методом folding'a, :help fold-methods -zi отключить folding -za развернуть текущий fold -zc свернуть текущий fold -zf - создать ручной блок fold, размером - - -13. netrw -:e. - открыть explorer во все окно - -i - поменять тип отображения в Explorer -- перейти на уровень выше - - перейти на уровень ниже - -% - создать новый файл в текущей папке -d - создать директорию в текущей папке при открытом Explorer, ESC для отмены -D - удалить директорию в текущей папке при открытом Explorer -R - переименьвать файл/папку diff --git a/README.md b/README.md index e313714..b0c14ce 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,15 @@ -# My configuration files +# My configuration files managed with NixOS flake -![Always wip](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRrgUjNod0ETGyHau0Tkn-WAnFjXLP493ryUQ&usqp=CAU) +[![Nix](https://img.shields.io/badge/NIX-5277C3.svg?style=for-the-badge&logo=NixOS&logoColor=white)](https://builtwithnix.org/) +[![NixOS](https://img.shields.io/badge/NIXOS-5277C3.svg?style=for-the-badge&logo=NixOS&logoColor=white)](https://nixos.org/) +[![Snowfall](https://img.shields.io/static/v1?logoColor=d8dee9&label=Built%20With&labelColor=5e81ac&message=Snowfall&color=d8dee9&style=for-the-badge)](https://github.com/snowfallorg/lib) +[![Neovim](https://img.shields.io/badge/NeoVim-%2357A143.svg?&style=for-the-badge&logo=neovim&logoColor=white)](https://github.com/neovim/neovim) [![GitGuardian scan](https://github.com/sbulav/dotfiles/actions/workflows/gitguardian.yml/badge.svg)](https://github.com/sbulav/dotfiles/actions/workflows/gitguardian.yml) [![release-please](https://github.com/sbulav/dotfiles/actions/workflows/please_release.yml/badge.svg)](https://github.com/sbulav/dotfiles/actions/workflows/please_release.yml) -This file is auto-generated, do not modify it! - ## Nix -I am currently in the process of migration to [Nix](https://nixos.org/) - - MacOS - [Nix Flakes](https://nixos.wiki/wiki/Flakes) - [Nix-Darwin](https://github.com/LnL7/nix-darwin) @@ -20,10 +19,27 @@ I am currently in the process of migration to [Nix](https://nixos.org/) - [Home-Manager](https://nix-community.github.io/home-manager/) - [Hyprland](https://wiki.hyprland.org) + Waybar, Swaylock, Rofi, mako, hyprpaper -To trigger a new build both on Mac and Nix, run - -```sh -./bin/build +Nix flakes following arbitrary Snowfall lib conventions: + +```text +nix/ +│ +│ Nix flake. +├─ flake.nix +│ +│ An optional custom library. +├─ lib/ +│ +│ An optional set of packages to export. +├─ packages/ +│ +├─ modules/ (optional modules) +│ +├─ overlays/ (optional overlays) +│ +├─ systems/ (optional system configurations) +│ +└─ homes/ (optional homes configurations) ``` Kudos for config inspiration to: @@ -31,6 +47,7 @@ Kudos for config inspiration to: - [Introduction to Nix & NixOS](https://nixos-and-flakes.thiscute.world/introduction/) - [Nix for MacOS by dustinlyons](https://github.com/dustinlyons/nixos-config) - [Nix starter configs by Misterio77](https://github.com/Misterio76/nix-starter-configs) +- [Nix configs with snowlake by Jake Hamilton](https://github.com/jakehamilton/config) You might also want to check out my blog with [#Nix category](https://sbulav.github.io/categories/#nix) @@ -42,6 +59,30 @@ Quickly try out new package in the shell without installing it: nix shell nixpkgs#glow ``` +List all generations: + +```sh +sudo nix-env --list-generations --profile /nix/var/nix/profiles/system +``` + +Rollback to previous generation: + +```sh +sudo nixos-rebuild switch --flake ~/dotfiles/nix#nz --rollback +``` + +Rollback to previous generation: + +```sh +sudo nixos-rebuild switch --flake ~/dotfiles/nix#nz --rollback +``` + +Activate specific generation: + +```sh +sudo nix-env --profile /nix/var/nix/profiles/system --switch-generation 210 +``` + ## Automated workflows I'm using following workflows to automate management of my dotfiles: @@ -55,34 +96,3 @@ I'm using following workflows to automate management of my dotfiles: releases based on conventional commits - [update-readme.yml](.github/workflows/update-readme.yml) - Workflow to generate this README - - -## Tools installation(Obsolete) - -Run make and specify tool to install: - -```bash -> make - tools : Install neovim, rg, fzf, stylua, etc.. - neovim : Update neovim to nightly version - fzf : Update fzf to nightly version - k9s : Update k9s to nightly version - gh : Update gh to nightly version - ripgrep : Update ripgrep to latest release - terraform : Update terraform to latest release - stylua : Update stylua to latest release - dotfiles : Update dotfiles to latest version - alpine : Run alpine container for tests - nginx-conf : Get ingress configuration for host - kk-tools : Run tools containers in current cluster - colemak : Install colemak-dhm - symlinks : Create symliks to configs - fonts : Install nerd-fonts - /tmp/nvim.appimage : Download nightly nvim appimage - /tmp/fzf.tgz : Download latest fzf release - /tmp/k9s.tgz : Download latest k9s release - /tmp/gh.tgz : Download latest gh release - /tmp/ripgrep.deb : Download latest ripgrep release - /tmp/terraform.zip : Download latest terraform release - /tmp/stylua.zip : Download latest stylua release -``` diff --git a/fish/conf.d/tmux.fish b/fish/conf.d/tmux.fish index eb2d3c4..bfdc398 100644 --- a/fish/conf.d/tmux.fish +++ b/fish/conf.d/tmux.fish @@ -1,5 +1,5 @@ if not set -q TMUX; and status --is-interactive; set -g TMUX tmux new-session -d -s base eval $TMUX - tmux attach-session -d -t base + # tmux attach-session -d -t base end diff --git a/fish/config.fish b/fish/config.fish index 8b1c327..c61e7ce 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -1,10 +1,11 @@ # Append paths -set -a PATH "$HOME/bin/" "$HOME/.local/bin" "/opt/homebrew/bin" "$HOME/./go/bin/" "$HOME/Library/Python/3.8/bin/" +set -a PATH "$HOME/bin/" "$HOME/.local/bin" "/opt/homebrew/bin" "$HOME/./go/bin/" # Initialize FZF keybindings fzf_key_bindings if status --is-interactive; atuin init fish --disable-up-arrow | source + zoxide init fish | source end @@ -18,11 +19,8 @@ set -x LANG en_US.UTF-8 set -gx EDITOR nvim set -gx VISUAL nvim -# Use python3 as default on Mac -set -gx PATH "/usr/local/opt/python/libexec/bin" $PATH - # Set KUBECONFIG -set -gx KUBECONFIG "$HOME/.kube/all-merged" +set -gx KUBECONFIG "$HOME/.kube/config" # Add krew to path set -gx PATH $PATH $HOME/.krew/bin @@ -31,11 +29,11 @@ set -gx PATH $PATH $HOME/.krew/bin set -gx FISH_KUBECTL_COMPLETION_COMPLETE_CRDS 0 # Load ssh keys into ssh-agent -load_keys +#load_keys # Load env credentials if begin; test -f ~/.ssh/env-credentials;end -posix-source ~/.ssh/env-credentials + posix-source ~/.ssh/env-credentials end # git_prompt diff --git a/fish/fish_variables b/fish/fish_variables index ea732ad..a617fa0 100644 --- a/fish/fish_variables +++ b/fish/fish_variables @@ -4,8 +4,8 @@ SETUVAR __fish_initialized:3400 SETUVAR _fish_abbr_kbuectl:kubectl SETUVAR _fish_abbr_ks:kubens SETUVAR _fish_abbr_kx:kubectx -SETUVAR _fisher_danhper_2F_fish_2D_ssh_2D_agent_files:/Users/sab/\x2econfig/fish/functions/__ssh_agent_is_started\x2efish\x1e/Users/sab/\x2econfig/fish/functions/__ssh_agent_start\x2efish\x1e/Users/sab/\x2econfig/fish/conf\x2ed/fish\x2dssh\x2dagent\x2efish -SETUVAR _fisher_evanlucas_2F_fish_2D_kubectl_2D_completions_files:/Users/sab/\x2econfig/fish/completions/kubectl\x2efish +SETUVAR _fisher_danhper_2F_fish_2D_ssh_2D_agent_files:\x7e/\x2econfig/fish/functions/__ssh_agent_is_started\x2efish\x1e\x7e/\x2econfig/fish/functions/__ssh_agent_start\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/fish\x2dssh\x2dagent\x2efish +SETUVAR _fisher_evanlucas_2F_fish_2D_kubectl_2D_completions_files:\x7e/\x2econfig/fish/completions/kubectl\x2efish SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish SETUVAR _fisher_plugins:jorgebucaran/fisher\x1eevanlucas/fish\x2dkubectl\x2dcompletions\x1edanhper/fish\x2dssh\x2dagent SETUVAR _fisher_upgraded_to_4_4:\x1d diff --git a/fish/functions/fisher.fish b/fish/functions/fisher.fish index 833b9db..b1513d3 100644 --- a/fish/functions/fisher.fish +++ b/fish/functions/fisher.fish @@ -1,6 +1,6 @@ function fisher --argument-names cmd --description "A plugin manager for Fish" set --query fisher_path || set --local fisher_path $__fish_config_dir - set --local fisher_version 4.4.3 + set --local fisher_version 4.4.4 set --local fish_plugins $__fish_config_dir/fish_plugins switch "$cmd" @@ -98,7 +98,7 @@ function fisher --argument-names cmd --description "A plugin manager for Fish" echo Fetching (set_color --underline)\$url(set_color normal) - if command curl --silent -L \$url | command tar -xzC \$temp -f - 2>/dev/null + if command curl -q --silent -L \$url | command tar -xzC \$temp -f - 2>/dev/null command cp -Rf \$temp/*/* $source else echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2 diff --git a/fish/functions/y.fish b/fish/functions/y.fish new file mode 100644 index 0000000..58e620b --- /dev/null +++ b/fish/functions/y.fish @@ -0,0 +1,8 @@ +function y + set tmp (mktemp -t "yazi-cwd.XXXXX") + yazi --cwd-file="$tmp" + if set cwd (cat -- "$tmp") && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ] + cd -- "$cwd" + end + rm -f -- "$tmp" +end diff --git a/gnupg/gpg-agent.conf b/gnupg/gpg-agent.conf deleted file mode 100644 index b774ab5..0000000 --- a/gnupg/gpg-agent.conf +++ /dev/null @@ -1,3 +0,0 @@ -default-cache-ttl 28800 -max-cache-ttl 28800 -allow-loopback-pinentry diff --git a/gnupg/gpg.conf b/gnupg/gpg.conf deleted file mode 100644 index 5ed4b88..0000000 --- a/gnupg/gpg.conf +++ /dev/null @@ -1,2 +0,0 @@ -use-agent -pinentry-mode loopback diff --git a/kitty/kitty.conf b/kitty/kitty.conf deleted file mode 100644 index a02c226..0000000 --- a/kitty/kitty.conf +++ /dev/null @@ -1,1349 +0,0 @@ -# vim:fileencoding=utf-8:ft=conf:foldmethod=marker - -#: Fonts {{{ - -#: kitty has very powerful font management. You can configure -#: individual font faces and even specify special fonts for particular -#: characters. - -# font_family Cascadia Code -font_family CaskaydiaCove Nerd Font -# bold_font auto -# italic_font auto -# bold_italic_font auto - -#: You can specify different fonts for the bold/italic/bold-italic -#: variants. To get a full list of supported fonts use the `kitty -#: list-fonts` command. By default they are derived automatically, by -#: the OSes font system. Setting them manually is useful for font -#: families that have many weight variants like Book, Medium, Thick, -#: etc. For example:: - -#: font_family Operator Mono Book -#: bold_font Operator Mono Medium -#: italic_font Operator Mono Book Italic -#: bold_italic_font Operator Mono Medium Italic - -font_size 14.0 - -#: Font size (in pts) - -# force_ltr no - -#: kitty does not support BIDI (bidirectional text), however, for RTL -#: scripts, words are automatically displayed in RTL. That is to say, -#: in an RTL script, the words "HELLO WORLD" display in kitty as -#: "WORLD HELLO", and if you try to select a substring of an RTL- -#: shaped string, you will get the character that would be there had -#: the the string been LTR. For example, assuming the Hebrew word -#: ירושלים, selecting the character that on the screen appears to be ם -#: actually writes into the selection buffer the character י. - -#: kitty's default behavior is useful in conjunction with a filter to -#: reverse the word order, however, if you wish to manipulate RTL -#: glyphs, it can be very challenging to work with, so this option is -#: provided to turn it off. Furthermore, this option can be used with -#: the command line program GNU FriBidi -#: to get BIDI -#: support, because it will force kitty to always treat the text as -#: LTR, which FriBidi expects for terminals. - -# adjust_line_height 0 -# adjust_column_width 0 - -#: Change the size of each character cell kitty renders. You can use -#: either numbers, which are interpreted as pixels or percentages -#: (number followed by %), which are interpreted as percentages of the -#: unmodified values. You can use negative pixels or percentages less -#: than 100% to reduce sizes (but this might cause rendering -#: artifacts). - -# symbol_map U+E0A0-U+E0A3,U+E0C0-U+E0C7 PowerlineSymbols - -#: Map the specified unicode codepoints to a particular font. Useful -#: if you need special rendering for some symbols, such as for -#: Powerline. Avoids the need for patched fonts. Each unicode code -#: point is specified in the form U+. You -#: can specify multiple code points, separated by commas and ranges -#: separated by hyphens. symbol_map itself can be specified multiple -#: times. Syntax is:: - -#: symbol_map codepoints Font Family Name - -# disable_ligatures never - -#: Choose how you want to handle multi-character ligatures. The -#: default is to always render them. You can tell kitty to not render -#: them when the cursor is over them by using cursor to make editing -#: easier, or have kitty never render them at all by using always, if -#: you don't like them. The ligature strategy can be set per-window -#: either using the kitty remote control facility or by defining -#: shortcuts for it in kitty.conf, for example:: - -#: map alt+1 disable_ligatures_in active always -#: map alt+2 disable_ligatures_in all never -#: map alt+3 disable_ligatures_in tab cursor - -#: Note that this refers to programming ligatures, typically -#: implemented using the calt OpenType feature. For disabling general -#: ligatures, use the font_features setting. - -# font_features none - -#: Choose exactly which OpenType features to enable or disable. This -#: is useful as some fonts might have features worthwhile in a -#: terminal. For example, Fira Code Retina includes a discretionary -#: feature, zero, which in that font changes the appearance of the -#: zero (0), to make it more easily distinguishable from Ø. Fira Code -#: Retina also includes other discretionary features known as -#: Stylistic Sets which have the tags ss01 through ss20. - -#: Note that this code is indexed by PostScript name, and not the font -#: family. This allows you to define very precise feature settings; -#: e.g. you can disable a feature in the italic font but not in the -#: regular font. - -#: On Linux, these are read from the FontConfig database first and -#: then this, setting is applied, so they can be configured in a -#: single, central place. - -#: To get the PostScript name for a font, use kitty + list-fonts -#: --psnames: - -#: .. code-block:: sh - -#: $ kitty + list-fonts --psnames | grep Fira -#: Fira Code -#: Fira Code Bold (FiraCode-Bold) -#: Fira Code Light (FiraCode-Light) -#: Fira Code Medium (FiraCode-Medium) -#: Fira Code Regular (FiraCode-Regular) -#: Fira Code Retina (FiraCode-Retina) - -#: The part in brackets is the PostScript name. - -#: Enable alternate zero and oldstyle numerals:: - -#: font_features FiraCode-Retina +zero +onum - -#: Enable only alternate zero:: - -#: font_features FiraCode-Retina +zero - -#: Disable the normal ligatures, but keep the calt feature which (in -#: this font) breaks up monotony:: - -#: font_features TT2020StyleB-Regular -liga +calt - -#: In conjunction with force_ltr, you may want to disable Arabic -#: shaping entirely, and only look at their isolated forms if they -#: show up in a document. You can do this with e.g.:: - -#: font_features UnifontMedium +isol -medi -fina -init - -# box_drawing_scale 0.001, 1, 1.5, 2 - -#: Change the sizes of the lines used for the box drawing unicode -#: characters These values are in pts. They will be scaled by the -#: monitor DPI to arrive at a pixel value. There must be four values -#: corresponding to thin, normal, thick, and very thick lines. - -#: }}} - -#: Cursor customization {{{ - -# cursor #cccccc - -#: Default cursor color - -# cursor_text_color #111111 - -#: Choose the color of text under the cursor. If you want it rendered -#: with the background color of the cell underneath instead, use the -#: special keyword: background - -# cursor_shape block - -#: The cursor shape can be one of (block, beam, underline) - -# cursor_beam_thickness 1.5 - -#: Defines the thickness of the beam cursor (in pts) - -# cursor_underline_thickness 2.0 - -#: Defines the thickness of the underline cursor (in pts) - -# cursor_blink_interval -1 - -#: The interval (in seconds) at which to blink the cursor. Set to zero -#: to disable blinking. Negative values mean use system default. Note -#: that numbers smaller than repaint_delay will be limited to -#: repaint_delay. - -# cursor_stop_blinking_after 15.0 - -#: Stop blinking cursor after the specified number of seconds of -#: keyboard inactivity. Set to zero to never stop blinking. - -#: }}} - -#: Scrollback {{{ - -# scrollback_lines 2000 - -#: Number of lines of history to keep in memory for scrolling back. -#: Memory is allocated on demand. Negative numbers are (effectively) -#: infinite scrollback. Note that using very large scrollback is not -#: recommended as it can slow down performance of the terminal and -#: also use large amounts of RAM. Instead, consider using -#: scrollback_pager_history_size. - -# scrollback_pager less --chop-long-lines --RAW-CONTROL-CHARS +INPUT_LINE_NUMBER - -#: Program with which to view scrollback in a new window. The -#: scrollback buffer is passed as STDIN to this program. If you change -#: it, make sure the program you use can handle ANSI escape sequences -#: for colors and text formatting. INPUT_LINE_NUMBER in the command -#: line above will be replaced by an integer representing which line -#: should be at the top of the screen. Similarly CURSOR_LINE and -#: CURSOR_COLUMN will be replaced by the current cursor position. - -# scrollback_pager_history_size 0 - -#: Separate scrollback history size, used only for browsing the -#: scrollback buffer (in MB). This separate buffer is not available -#: for interactive scrolling but will be piped to the pager program -#: when viewing scrollback buffer in a separate window. The current -#: implementation stores the data in UTF-8, so approximatively 10000 -#: lines per megabyte at 100 chars per line, for pure ASCII text, -#: unformatted text. A value of zero or less disables this feature. -#: The maximum allowed size is 4GB. - -# wheel_scroll_multiplier 5.0 - -#: Modify the amount scrolled by the mouse wheel. Note this is only -#: used for low precision scrolling devices, not for high precision -#: scrolling on platforms such as macOS and Wayland. Use negative -#: numbers to change scroll direction. - -# touch_scroll_multiplier 1.0 - -#: Modify the amount scrolled by a touchpad. Note this is only used -#: for high precision scrolling devices on platforms such as macOS and -#: Wayland. Use negative numbers to change scroll direction. - -#: }}} - -#: Mouse {{{ - -# mouse_hide_wait 0.0 - -#: Hide mouse cursor after the specified number of seconds of the -#: mouse not being used. Set to zero to disable mouse cursor hiding. -#: Set to a negative value to hide the mouse cursor immediately when -#: typing text. Disabled by default on macOS as getting it to work -#: robustly with the ever-changing sea of bugs that is Cocoa is too -#: much effort. - -# url_color #0087bd -# url_style curly - -#: The color and style for highlighting URLs on mouse-over. url_style -#: can be one of: none, single, double, curly - -# open_url_modifiers kitty_mod - -#: The modifier keys to press when clicking with the mouse on URLs to -#: open the URL - -# open_url_with default - -#: The program with which to open URLs that are clicked on. The -#: special value default means to use the operating system's default -#: URL handler. - -# url_prefixes http https file ftp - -#: The set of URL prefixes to look for when detecting a URL under the -#: mouse cursor. - -# detect_urls yes - -#: Detect URLs under the mouse. Detected URLs are highlighted with an -#: underline and the mouse cursor becomes a hand over them. Even if -#: this option is disabled, URLs are still clickable. - -# copy_on_select no - -#: Copy to clipboard or a private buffer on select. With this set to -#: clipboard, simply selecting text with the mouse will cause the text -#: to be copied to clipboard. Useful on platforms such as macOS that -#: do not have the concept of primary selections. You can instead -#: specify a name such as a1 to copy to a private kitty buffer -#: instead. Map a shortcut with the paste_from_buffer action to paste -#: from this private buffer. For example:: - -#: map cmd+shift+v paste_from_buffer a1 - -#: Note that copying to the clipboard is a security risk, as all -#: programs, including websites open in your browser can read the -#: contents of the system clipboard. - -# strip_trailing_spaces never - -#: Remove spaces at the end of lines when copying to clipboard. A -#: value of smart will do it when using normal selections, but not -#: rectangle selections. always will always do it. - -# rectangle_select_modifiers ctrl+alt - -#: The modifiers to use rectangular selection (i.e. to select text in -#: a rectangular block with the mouse) - -# terminal_select_modifiers shift - -#: The modifiers to override mouse selection even when a terminal -#: application has grabbed the mouse - -# select_by_word_characters @-./_~?&=%+# - -#: Characters considered part of a word when double clicking. In -#: addition to these characters any character that is marked as an -#: alphanumeric character in the unicode database will be matched. - -# click_interval -1.0 - -#: The interval between successive clicks to detect double/triple -#: clicks (in seconds). Negative numbers will use the system default -#: instead, if available, or fallback to 0.5. - -# focus_follows_mouse no - -#: Set the active window to the window under the mouse when moving the -#: mouse around - -# pointer_shape_when_grabbed arrow - -#: The shape of the mouse pointer when the program running in the -#: terminal grabs the mouse. Valid values are: arrow, beam and hand - -# default_pointer_shape beam - -#: The default shape of the mouse pointer. Valid values are: arrow, -#: beam and hand - -# pointer_shape_when_dragging beam - -#: The default shape of the mouse pointer when dragging across text. -#: Valid values are: arrow, beam and hand - -#: }}} - -#: Performance tuning {{{ - -# repaint_delay 10 - -#: Delay (in milliseconds) between screen updates. Decreasing it, -#: increases frames-per-second (FPS) at the cost of more CPU usage. -#: The default value yields ~100 FPS which is more than sufficient for -#: most uses. Note that to actually achieve 100 FPS you have to either -#: set sync_to_monitor to no or use a monitor with a high refresh -#: rate. Also, to minimize latency when there is pending input to be -#: processed, repaint_delay is ignored. - -# input_delay 3 - -#: Delay (in milliseconds) before input from the program running in -#: the terminal is processed. Note that decreasing it will increase -#: responsiveness, but also increase CPU usage and might cause flicker -#: in full screen programs that redraw the entire screen on each loop, -#: because kitty is so fast that partial screen updates will be drawn. - -sync_to_monitor no - -#: Sync screen updates to the refresh rate of the monitor. This -#: prevents tearing (https://en.wikipedia.org/wiki/Screen_tearing) -#: when scrolling. However, it limits the rendering speed to the -#: refresh rate of your monitor. With a very high speed mouse/high -#: keyboard repeat rate, you may notice some slight input latency. If -#: so, set this to no. - -#: }}} - -#: Terminal bell {{{ - -# enable_audio_bell yes - -#: Enable/disable the audio bell. Useful in environments that require -#: silence. - -# visual_bell_duration 0.0 - -#: Visual bell duration. Flash the screen when a bell occurs for the -#: specified number of seconds. Set to zero to disable. - -# window_alert_on_bell yes - -#: Request window attention on bell. Makes the dock icon bounce on -#: macOS or the taskbar flash on linux. - -# bell_on_tab yes - -#: Show a bell symbol on the tab if a bell occurs in one of the -#: windows in the tab and the window is not the currently focused -#: window - -# command_on_bell none - -#: Program to run when a bell occurs. - -#: }}} - -#: Window layout {{{ - -# remember_window_size yes -# initial_window_width 640 -# initial_window_height 400 - -#: If enabled, the window size will be remembered so that new -#: instances of kitty will have the same size as the previous -#: instance. If disabled, the window will initially have size -#: configured by initial_window_width/height, in pixels. You can use a -#: suffix of "c" on the width/height values to have them interpreted -#: as number of cells instead of pixels. - -# enabled_layouts * - -#: The enabled window layouts. A comma separated list of layout names. -#: The special value all means all layouts. The first listed layout -#: will be used as the startup layout. Default configuration is all -#: layouts in alphabetical order. For a list of available layouts, see -#: the https://sw.kovidgoyal.net/kitty/index.html#layouts. - -# window_resize_step_cells 2 -# window_resize_step_lines 2 - -#: The step size (in units of cell width/cell height) to use when -#: resizing windows. The cells value is used for horizontal resizing -#: and the lines value for vertical resizing. - -# window_border_width 0.5pt - -#: The width of window borders. Can be either in pixels (px) or pts -#: (pt). Values in pts will be rounded to the nearest number of pixels -#: based on screen resolution. If not specified the unit is assumed to -#: be pts. Note that borders are displayed only when more than one -#: window is visible. They are meant to separate multiple windows. - -# draw_minimal_borders yes - -#: Draw only the minimum borders needed. This means that only the -#: minimum needed borders for inactive windows are drawn. That is only -#: the borders that separate the inactive window from a neighbor. Note -#: that setting a non-zero window margin overrides this and causes all -#: borders to be drawn. - -# window_margin_width 0 - -#: The window margin (in pts) (blank area outside the border). A -#: single value sets all four sides. Two values set the vertical and -#: horizontal sides. Three values set top, horizontal and bottom. Four -#: values set top, right, bottom and left. - -# single_window_margin_width -1 - -#: The window margin (in pts) to use when only a single window is -#: visible. Negative values will cause the value of -#: window_margin_width to be used instead. A single value sets all -#: four sides. Two values set the vertical and horizontal sides. Three -#: values set top, horizontal and bottom. Four values set top, right, -#: bottom and left. - -# window_padding_width 0 - -#: The window padding (in pts) (blank area between the text and the -#: window border). A single value sets all four sides. Two values set -#: the vertical and horizontal sides. Three values set top, horizontal -#: and bottom. Four values set top, right, bottom and left. - -# placement_strategy center - -#: When the window size is not an exact multiple of the cell size, the -#: cell area of the terminal window will have some extra padding on -#: the sides. You can control how that padding is distributed with -#: this option. Using a value of center means the cell area will be -#: placed centrally. A value of top-left means the padding will be on -#: only the bottom and right edges. - -# active_border_color #00ff00 - -#: The color for the border of the active window. Set this to none to -#: not draw borders around the active window. - -# inactive_border_color #cccccc - -#: The color for the border of inactive windows - -# bell_border_color #ff5a00 - -#: The color for the border of inactive windows in which a bell has -#: occurred - -# inactive_text_alpha 1.0 - -#: Fade the text in inactive windows by the specified amount (a number -#: between zero and one, with zero being fully faded). - -# hide_window_decorations no - -#: Hide the window decorations (title-bar and window borders) with -#: yes. On macOS, titlebar-only can be used to only hide the titlebar. -#: Whether this works and exactly what effect it has depends on the -#: window manager/operating system. - -# resize_debounce_time 0.1 - -#: The time (in seconds) to wait before redrawing the screen when a -#: resize event is received. On platforms such as macOS, where the -#: operating system sends events corresponding to the start and end of -#: a resize, this number is ignored. - -# resize_draw_strategy static - -#: Choose how kitty draws a window while a resize is in progress. A -#: value of static means draw the current window contents, mostly -#: unchanged. A value of scale means draw the current window contents -#: scaled. A value of blank means draw a blank window. A value of size -#: means show the window size in cells. - -# resize_in_steps no - -#: Resize the OS window in steps as large as the cells, instead of -#: with the usual pixel accuracy. Combined with an -#: initial_window_width and initial_window_height in number of cells, -#: this option can be used to keep the margins as small as possible -#: when resizing the OS window. Note that this does not currently work -#: on Wayland. - -confirm_os_window_close 0 - -#: Ask for confirmation when closing an OS window or a tab that has at -#: least this number of kitty windows in it. A value of zero disables -#: confirmation. This confirmation also applies to requests to quit -#: the entire application (all OS windows, via the quit action). - -#: }}} - -#: Tab bar {{{ - -# tab_bar_edge bottom - -#: Which edge to show the tab bar on, top or bottom - -# tab_bar_margin_width 0.0 - -#: The margin to the left and right of the tab bar (in pts) - -# tab_bar_style fade - -#: The tab bar style, can be one of: fade, separator, powerline, or -#: hidden. In the fade style, each tab's edges fade into the -#: background color, in the separator style, tabs are separated by a -#: configurable separator, and the powerline shows the tabs as a -#: continuous line. If you use the hidden style, you might want to -#: create a mapping for the select_tab action which presents you with -#: a list of tabs and allows for easy switching to a tab. - -# tab_bar_min_tabs 2 - -#: The minimum number of tabs that must exist before the tab bar is -#: shown - -# tab_switch_strategy previous - -#: The algorithm to use when switching to a tab when the current tab -#: is closed. The default of previous will switch to the last used -#: tab. A value of left will switch to the tab to the left of the -#: closed tab. A value of right will switch to the tab to the right of -#: the closed tab. A value of last will switch to the right-most tab. - -# tab_fade 0.25 0.5 0.75 1 - -#: Control how each tab fades into the background when using fade for -#: the tab_bar_style. Each number is an alpha (between zero and one) -#: that controls how much the corresponding cell fades into the -#: background, with zero being no fade and one being full fade. You -#: can change the number of cells used by adding/removing entries to -#: this list. - -# tab_separator " ┇" - -#: The separator between tabs in the tab bar when using separator as -#: the tab_bar_style. - -# tab_activity_symbol none - -#: Some text or a unicode symbol to show on the tab if a window in the -#: tab that does not have focus has some activity. - -# tab_title_template "{title}" - -#: A template to render the tab title. The default just renders the -#: title. If you wish to include the tab-index as well, use something -#: like: {index}: {title}. Useful if you have shortcuts mapped for -#: goto_tab N. In addition you can use {layout_name} for the current -#: layout name and {num_windows} for the number of windows in the tab. -#: Note that formatting is done by Python's string formatting -#: machinery, so you can use, for instance, {layout_name[:2].upper()} -#: to show only the first two letters of the layout name, upper-cased. -#: If you want to style the text, you can use styling directives, for -#: example: {fmt.fg.red}red{fmt.fg.default}normal{fmt.bg._00FF00}green -#: bg{fmt.bg.normal}. Similarly, for bold and italic: -#: {fmt.bold}bold{fmt.nobold}normal{fmt.italic}italic{fmt.noitalic}. - -# active_tab_title_template none - -#: Template to use for active tabs, if not specified falls back to -#: tab_title_template. - -# active_tab_foreground #000 -# active_tab_background #eee -# active_tab_font_style bold-italic -# inactive_tab_foreground #444 -# inactive_tab_background #999 -# inactive_tab_font_style normal - -#: Tab bar colors and styles - -# tab_bar_background none - -#: Background color for the tab bar. Defaults to using the terminal -#: background color. - -#: }}} - -#: Color scheme {{{ - -# foreground #dddddd -# background #000000 - -#: The foreground and background colors - -# background_opacity 1.0 - -#: The opacity of the background. A number between 0 and 1, where 1 is -#: opaque and 0 is fully transparent. This will only work if -#: supported by the OS (for instance, when using a compositor under -#: X11). Note that it only sets the background color's opacity in -#: cells that have the same background color as the default terminal -#: background. This is so that things like the status bar in vim, -#: powerline prompts, etc. still look good. But it means that if you -#: use a color theme with a background color in your editor, it will -#: not be rendered as transparent. Instead you should change the -#: default background color in your kitty config and not use a -#: background color in the editor color scheme. Or use the escape -#: codes to set the terminals default colors in a shell script to -#: launch your editor. Be aware that using a value less than 1.0 is a -#: (possibly significant) performance hit. If you want to dynamically -#: change transparency of windows set dynamic_background_opacity to -#: yes (this is off by default as it has a performance cost) - -# background_image none - -#: Path to a background image. Must be in PNG format. - -# background_image_layout tiled - -#: Whether to tile or scale the background image. - -# background_image_linear no - -#: When background image is scaled, whether linear interpolation -#: should be used. - -# dynamic_background_opacity no - -#: Allow changing of the background_opacity dynamically, using either -#: keyboard shortcuts (increase_background_opacity and -#: decrease_background_opacity) or the remote control facility. - -# background_tint 0.0 - -#: How much to tint the background image by the background color. The -#: tint is applied only under the text area, not margin/borders. Makes -#: it easier to read the text. Tinting is done using the current -#: background color for each window. This setting applies only if -#: background_opacity is set and transparent windows are supported or -#: background_image is set. - -# dim_opacity 0.75 - -#: How much to dim text that has the DIM/FAINT attribute set. One -#: means no dimming and zero means fully dimmed (i.e. invisible). - -# selection_foreground #000000 - -#: The foreground for text selected with the mouse. A value of none -#: means to leave the color unchanged. - -# selection_background #fffacd - -#: The background for text selected with the mouse. - - -#: The 16 terminal colors. There are 8 basic colors, each color has a -#: dull and bright version. You can also set the remaining colors from -#: the 256 color table as color16 to color255. - -# color0 #000000 -# color8 #767676 - -#: black - -# color1 #cc0403 -# color9 #f2201f - -#: red - -# color2 #19cb00 -# color10 #23fd00 - -#: green - -# color3 #cecb00 -# color11 #fffd00 - -#: yellow - -# color4 #0d73cc -# color12 #1a8fff - -#: blue - -# color5 #cb1ed1 -# color13 #fd28ff - -#: magenta - -# color6 #0dcdcd -# color14 #14ffff - -#: cyan - -# color7 #dddddd -# color15 #ffffff - -#: white - -# mark1_foreground black - -#: Color for marks of type 1 - -# mark1_background #98d3cb - -#: Color for marks of type 1 (light steel blue) - -# mark2_foreground black - -#: Color for marks of type 2 - -# mark2_background #f2dcd3 - -#: Color for marks of type 1 (beige) - -# mark3_foreground black - -#: Color for marks of type 3 - -# mark3_background #f274bc - -#: Color for marks of type 1 (violet) - -#: }}} - -#: Advanced {{{ - -# shell . - -#: The shell program to execute. The default value of . means to use -#: whatever shell is set as the default shell for the current user. -#: Note that on macOS if you change this, you might need to add -#: --login to ensure that the shell starts in interactive mode and -#: reads its startup rc files. - -# editor . - -#: The console editor to use when editing the kitty config file or -#: similar tasks. A value of . means to use the environment variables -#: VISUAL and EDITOR in that order. Note that this environment -#: variable has to be set not just in your shell startup scripts but -#: system-wide, otherwise kitty will not see it. - -# close_on_child_death no - -#: Close the window when the child process (shell) exits. If no (the -#: default), the terminal will remain open when the child exits as -#: long as there are still processes outputting to the terminal (for -#: example disowned or backgrounded processes). If yes, the window -#: will close as soon as the child process exits. Note that setting it -#: to yes means that any background processes still using the terminal -#: can fail silently because their stdout/stderr/stdin no longer work. - -# allow_remote_control no - -#: Allow other programs to control kitty. If you turn this on other -#: programs can control all aspects of kitty, including sending text -#: to kitty windows, opening new windows, closing windows, reading the -#: content of windows, etc. Note that this even works over ssh -#: connections. You can chose to either allow any program running -#: within kitty to control it, with yes or only programs that connect -#: to the socket specified with the kitty --listen-on command line -#: option, if you use the value socket-only. The latter is useful if -#: you want to prevent programs running on a remote computer over ssh -#: from controlling kitty. - -# listen_on none - -#: Tell kitty to listen to the specified unix/tcp socket for remote -#: control connections. Note that this will apply to all kitty -#: instances. It can be overridden by the kitty --listen-on command -#: line flag. This option accepts only UNIX sockets, such as -#: unix:${TEMP}/mykitty or (on Linux) unix:@mykitty. Environment -#: variables are expanded. If {kitty_pid} is present then it is -#: replaced by the PID of the kitty process, otherwise the PID of the -#: kitty process is appended to the value, with a hyphen. This option -#: is ignored unless you also set allow_remote_control to enable -#: remote control. See the help for kitty --listen-on for more -#: details. - -# env - -#: Specify environment variables to set in all child processes. Note -#: that environment variables are expanded recursively, so if you -#: use:: - -#: env MYVAR1=a -#: env MYVAR2=${MYVAR1}/${HOME}/b - -#: The value of MYVAR2 will be a//b. - -# update_check_interval 24 - -#: Periodically check if an update to kitty is available. If an update -#: is found a system notification is displayed informing you of the -#: available update. The default is to check every 24 hrs, set to zero -#: to disable. - -# startup_session none - -#: Path to a session file to use for all kitty instances. Can be -#: overridden by using the kitty --session command line option for -#: individual instances. See -#: https://sw.kovidgoyal.net/kitty/index.html#sessions in the kitty -#: documentation for details. Note that relative paths are interpreted -#: with respect to the kitty config directory. Environment variables -#: in the path are expanded. - -# clipboard_control write-clipboard write-primary - -#: Allow programs running in kitty to read and write from the -#: clipboard. You can control exactly which actions are allowed. The -#: set of possible actions is: write-clipboard read-clipboard write- -#: primary read-primary. You can additionally specify no-append to -#: disable kitty's protocol extension for clipboard concatenation. The -#: default is to allow writing to the clipboard and primary selection -#: with concatenation enabled. Note that enabling the read -#: functionality is a security risk as it means that any program, even -#: one running on a remote server via SSH can read your clipboard. - -# allow_hyperlinks yes - -#: Process hyperlink (OSC 8) escape sequences. If disabled OSC 8 -#: escape sequences are ignored. Otherwise they become clickable -#: links, that you can click by holding down ctrl+shift and clicking -#: with the mouse. The special value of ``ask`` means that kitty will -#: ask before opening the link. - -# term xterm-kitty -term xterm-256color - -#: The value of the TERM environment variable to set. Changing this -#: can break many terminal programs, only change it if you know what -#: you are doing, not because you read some advice on Stack Overflow -#: to change it. The TERM variable is used by various programs to get -#: information about the capabilities and behavior of the terminal. If -#: you change it, depending on what programs you run, and how -#: different the terminal you are changing it to is, various things -#: from key-presses, to colors, to various advanced features may not -#: work. - -#: }}} - -#: OS specific tweaks {{{ - -# macos_titlebar_color system - -#: Change the color of the kitty window's titlebar on macOS. A value -#: of system means to use the default system color, a value of -#: background means to use the background color of the currently -#: active window and finally you can use an arbitrary color, such as -#: #12af59 or red. WARNING: This option works by using a hack, as -#: there is no proper Cocoa API for it. It sets the background color -#: of the entire window and makes the titlebar transparent. As such it -#: is incompatible with background_opacity. If you want to use both, -#: you are probably better off just hiding the titlebar with -#: hide_window_decorations. - -macos_option_as_alt yes - -#: Use the option key as an alt key. With this set to no, kitty will -#: use the macOS native Option+Key = unicode character behavior. This -#: will break any Alt+key keyboard shortcuts in your terminal -#: programs, but you can use the macOS unicode input technique. You -#: can use the values: left, right, or both to use only the left, -#: right or both Option keys as Alt, instead. - -# macos_hide_from_tasks no - -#: Hide the kitty window from running tasks (Option+Tab) on macOS. - -macos_quit_when_last_window_closed no - -#: Have kitty quit when all the top-level windows are closed. By -#: default, kitty will stay running, even with no open windows, as is -#: the expected behavior on macOS. - -# macos_window_resizable yes - -#: Disable this if you want kitty top-level (OS) windows to not be -#: resizable on macOS. - -# macos_thicken_font 0 - -#: Draw an extra border around the font with the given width, to -#: increase legibility at small font sizes. For example, a value of -#: 0.75 will result in rendering that looks similar to sub-pixel -#: antialiasing at common font sizes. - -# macos_traditional_fullscreen no - -#: Use the traditional full-screen transition, that is faster, but -#: less pretty. - -# macos_show_window_title_in all - -#: Show or hide the window title in the macOS window or menu-bar. A -#: value of window will show the title of the currently active window -#: at the top of the macOS window. A value of menubar will show the -#: title of the currently active window in the macOS menu-bar, making -#: use of otherwise wasted space. all will show the title everywhere -#: and none hides the title in the window and the menu-bar. - -# macos_custom_beam_cursor no - -#: Enable/disable custom mouse cursor for macOS that is easier to see -#: on both light and dark backgrounds. WARNING: this might make your -#: mouse cursor invisible on dual GPU machines. - -# linux_display_server auto - -#: Choose between Wayland and X11 backends. By default, an appropriate -#: backend based on the system state is chosen automatically. Set it -#: to x11 or wayland to force the choice. - -#: }}} - -#: Keyboard shortcuts {{{ - -#: For a list of key names, see: the GLFW key macros -#: . -#: The name to use is the part after the GLFW_KEY_ prefix. For a list -#: of modifier names, see: GLFW mods -#: - -#: On Linux you can also use XKB key names to bind keys that are not -#: supported by GLFW. See XKB keys -#: for a list of key names. The name to use is the part -#: after the XKB_KEY_ prefix. Note that you can only use an XKB key -#: name for keys that are not known as GLFW keys. - -#: Finally, you can use raw system key codes to map keys, again only -#: for keys that are not known as GLFW keys. To see the system key -#: code for a key, start kitty with the kitty --debug-keyboard option. -#: Then kitty will output some debug text for every key event. In that -#: text look for ``native_code`` the value of that becomes the key -#: name in the shortcut. For example: - -#: .. code-block:: none - -#: on_key_input: glfw key: 65 native_code: 0x61 action: PRESS mods: 0x0 text: 'a' - -#: Here, the key name for the A key is 0x61 and you can use it with:: - -#: map ctrl+0x61 something - -#: to map ctrl+a to something. - -#: You can use the special action no_op to unmap a keyboard shortcut -#: that is assigned in the default configuration:: - -#: map kitty_mod+space no_op - -#: You can combine multiple actions to be triggered by a single -#: shortcut, using the syntax below:: - -#: map key combine action1 action2 action3 ... - -#: For example:: - -#: map kitty_mod+e combine : new_window : next_layout - -#: this will create a new window and switch to the next available -#: layout - -#: You can use multi-key shortcuts using the syntax shown below:: - -#: map key1>key2>key3 action - -#: For example:: - -#: map ctrl+f>2 set_font_size 20 - -kitty_mod ctrl+shift - -#: The value of kitty_mod is used as the modifier for all default -#: shortcuts, you can change it in your kitty.conf to change the -#: modifiers for all the default shortcuts. - -# clear_all_shortcuts no - -#: You can have kitty remove all shortcut definition seen up to this -#: point. Useful, for instance, to remove the default shortcuts. - -# kitten_alias hints hints --hints-offset=0 - -#: You can create aliases for kitten names, this allows overriding the -#: defaults for kitten options and can also be used to shorten -#: repeated mappings of the same kitten with a specific group of -#: options. For example, the above alias changes the default value of -#: kitty +kitten hints --hints-offset to zero for all mappings, -#: including the builtin ones. - -#: Clipboard {{{ - -# map kitty_mod+c copy_to_clipboard - -#: There is also a copy_or_interrupt action that can be optionally -#: mapped to Ctrl+c. It will copy only if there is a selection and -#: send an interrupt otherwise. Similarly, copy_and_clear_or_interrupt -#: will copy and clear the selection or send an interrupt if there is -#: no selection. - -# map cmd+c copy_to_clipboard -# map kitty_mod+v paste_from_clipboard -# map cmd+v paste_from_clipboard -# map kitty_mod+s paste_from_selection -# map shift+insert paste_from_selection -# map kitty_mod+o pass_selection_to_program - -#: You can also pass the contents of the current selection to any -#: program using pass_selection_to_program. By default, the system's -#: open program is used, but you can specify your own, the selection -#: will be passed as a command line argument to the program, for -#: example:: - -#: map kitty_mod+o pass_selection_to_program firefox - -#: You can pass the current selection to a terminal program running in -#: a new kitty window, by using the @selection placeholder:: - -#: map kitty_mod+y new_window less @selection - -#: }}} - -#: Scrolling {{{ - -# map kitty_mod+up scroll_line_up -# map alt+cmd+page_up scroll_line_up -# map cmd+up scroll_line_up -# map kitty_mod+k scroll_line_up -# map kitty_mod+down scroll_line_down -# map kitty_mod+j scroll_line_down -# map alt+cmd+page_down scroll_line_down -# map cmd+down scroll_line_down -# map kitty_mod+page_up scroll_page_up -# map cmd+page_up scroll_page_up -# map kitty_mod+page_down scroll_page_down -# map cmd+page_down scroll_page_down -# map kitty_mod+home scroll_home -# map cmd+home scroll_home -# map kitty_mod+end scroll_end -# map cmd+end scroll_end -# map kitty_mod+h show_scrollback - -#: You can pipe the contents of the current screen + history buffer as -#: STDIN to an arbitrary program using the ``launch`` function. For -#: example, the following opens the scrollback buffer in less in an -#: overlay window:: - -#: map f1 launch --stdin-source=@screen_scrollback --stdin-add-formatting --type=overlay less +G -R - -#: For more details on piping screen and buffer contents to external -#: programs, see launch. - -#: }}} - -#: Window management {{{ - -# map kitty_mod+enter new_window - -#: You can open a new window running an arbitrary program, for -#: example:: - -#: map kitty_mod+y launch mutt - -#: You can open a new window with the current working directory set to -#: the working directory of the current window using:: - -#: map ctrl+alt+enter launch --cwd=current - -#: You can open a new window that is allowed to control kitty via the -#: kitty remote control facility by prefixing the command line with @. -#: Any programs running in that window will be allowed to control -#: kitty. For example:: - -#: map ctrl+enter launch --allow-remote-control some_program - -#: You can open a new window next to the currently active window or as -#: the first window, with:: - -#: map ctrl+n launch --location=neighbor some_program -#: map ctrl+f launch --location=first some_program - -#: For more details, see launch. - -# map cmd+enter new_window -# map kitty_mod+n new_os_window - -#: Works like new_window above, except that it opens a top level OS -#: kitty window. In particular you can use new_os_window_with_cwd to -#: open a window with the current working directory. - -# map cmd+n new_os_window -# map kitty_mod+w close_window -# map shift+cmd+d close_window -# map kitty_mod+] next_window -# map kitty_mod+[ previous_window -# map kitty_mod+f move_window_forward -# map kitty_mod+b move_window_backward -# map kitty_mod+` move_window_to_top -# map kitty_mod+r start_resizing_window -# map cmd+r start_resizing_window -# map kitty_mod+1 first_window -# map cmd+1 first_window -# map kitty_mod+2 second_window -# map cmd+2 second_window -# map kitty_mod+3 third_window -# map cmd+3 third_window -# map kitty_mod+4 fourth_window -# map cmd+4 fourth_window -# map kitty_mod+5 fifth_window -# map cmd+5 fifth_window -# map kitty_mod+6 sixth_window -# map cmd+6 sixth_window -# map kitty_mod+7 seventh_window -# map cmd+7 seventh_window -# map kitty_mod+8 eighth_window -# map cmd+8 eighth_window -# map kitty_mod+9 ninth_window -# map cmd+9 ninth_window -# map kitty_mod+0 tenth_window -#: }}} - -#: Tab management {{{ - -# map kitty_mod+right next_tab -# map ctrl+tab next_tab -# map shift+cmd+] next_tab -# map kitty_mod+left previous_tab -# map shift+ctrl+tab previous_tab -# map shift+cmd+[ previous_tab -# map kitty_mod+t new_tab -# map cmd+t new_tab -# map kitty_mod+q close_tab -# map cmd+w close_tab -# map shift+cmd+w close_os_window -# map kitty_mod+. move_tab_forward -# map kitty_mod+, move_tab_backward -# map kitty_mod+alt+t set_tab_title -# map shift+cmd+i set_tab_title - -#: You can also create shortcuts to go to specific tabs, with 1 being -#: the first tab, 2 the second tab and -1 being the previously active -#: tab, and any number larger than the last tab being the last tab:: - -#: map ctrl+alt+1 goto_tab 1 -#: map ctrl+alt+2 goto_tab 2 - -#: Just as with new_window above, you can also pass the name of -#: arbitrary commands to run when using new_tab and use -#: new_tab_with_cwd. Finally, if you want the new tab to open next to -#: the current tab rather than at the end of the tabs list, use:: - -#: map ctrl+t new_tab !neighbor [optional cmd to run] -#: }}} - -#: Layout management {{{ - -# map kitty_mod+l next_layout - -#: You can also create shortcuts to switch to specific layouts:: - -#: map ctrl+alt+t goto_layout tall -#: map ctrl+alt+s goto_layout stack - -#: Similarly, to switch back to the previous layout:: - -#: map ctrl+alt+p last_used_layout -#: }}} - -#: Font sizes {{{ - -#: You can change the font size for all top-level kitty OS windows at -#: a time or only the current one. - -# map kitty_mod+equal change_font_size all +2.0 -# map cmd+plus change_font_size all +2.0 -# map cmd+shift+equal change_font_size all +2.0 -# map kitty_mod+minus change_font_size all -2.0 -# map cmd+minus change_font_size all -2.0 -# map kitty_mod+backspace change_font_size all 0 -# map cmd+0 change_font_size all 0 - -#: To setup shortcuts for specific font sizes:: - -#: map kitty_mod+f6 change_font_size all 10.0 - -#: To setup shortcuts to change only the current OS window's font -#: size:: - -#: map kitty_mod+f6 change_font_size current 10.0 -#: }}} - -#: Select and act on visible text {{{ - -#: Use the hints kitten to select text and either pass it to an -#: external program or insert it into the terminal or copy it to the -#: clipboard. - -# map kitty_mod+e kitten hints - -#: Open a currently visible URL using the keyboard. The program used -#: to open the URL is specified in open_url_with. - -# map kitty_mod+p>f kitten hints --type path --program - - -#: Select a path/filename and insert it into the terminal. Useful, for -#: instance to run git commands on a filename output from a previous -#: git command. - -# map kitty_mod+p>shift+f kitten hints --type path - -#: Select a path/filename and open it with the default open program. - -# map kitty_mod+p>l kitten hints --type line --program - - -#: Select a line of text and insert it into the terminal. Use for the -#: output of things like: ls -1 - -# map kitty_mod+p>w kitten hints --type word --program - - -#: Select words and insert into terminal. - -# map kitty_mod+p>h kitten hints --type hash --program - - -#: Select something that looks like a hash and insert it into the -#: terminal. Useful with git, which uses sha1 hashes to identify -#: commits - -# map kitty_mod+p>n kitten hints --type linenum - -#: Select something that looks like filename:linenum and open it in -#: vim at the specified line number. - -# map kitty_mod+p>y kitten hints --type hyperlink - -#: Select a hyperlink (i.e. a URL that has been marked as such by the -#: terminal program, for example, by ls --hyperlink=auto). - - -#: The hints kitten has many more modes of operation that you can map -#: to different shortcuts. For a full description see kittens/hints. -#: }}} - -#: Miscellaneous {{{ - -map kitty_mod+f toggle_fullscreen -# map kitty_mod+f10 toggle_maximized -# map kitty_mod+u kitten unicode_input -# map kitty_mod+f2 edit_config_file -# map kitty_mod+escape kitty_shell window - -#: Open the kitty shell in a new window/tab/overlay/os_window to -#: control kitty using commands. - -# map kitty_mod+a>m set_background_opacity +0.1 -# map kitty_mod+a>l set_background_opacity -0.1 -# map kitty_mod+a>1 set_background_opacity 1 -# map kitty_mod+a>d set_background_opacity default -# map kitty_mod+delete clear_terminal reset active - -#: You can create shortcuts to clear/reset the terminal. For example:: - -#: # Reset the terminal -#: map kitty_mod+f9 clear_terminal reset active -#: # Clear the terminal screen by erasing all contents -#: map kitty_mod+f10 clear_terminal clear active -#: # Clear the terminal scrollback by erasing it -#: map kitty_mod+f11 clear_terminal scrollback active -#: # Scroll the contents of the screen into the scrollback -#: map kitty_mod+f12 clear_terminal scroll active - -#: If you want to operate on all windows instead of just the current -#: one, use all instead of active. - -#: It is also possible to remap Ctrl+L to both scroll the current -#: screen contents into the scrollback buffer and clear the screen, -#: instead of just clearing the screen:: - -#: map ctrl+l combine : clear_terminal scroll active : send_text normal,application \x0c - - -#: You can tell kitty to send arbitrary (UTF-8) encoded text to the -#: client program when pressing specified shortcut keys. For example:: - -#: map ctrl+alt+a send_text all Special text - -#: This will send "Special text" when you press the ctrl+alt+a key -#: combination. The text to be sent is a python string literal so you -#: can use escapes like \x1b to send control codes or \u21fb to send -#: unicode characters (or you can just input the unicode characters -#: directly as UTF-8 text). The first argument to send_text is the -#: keyboard modes in which to activate the shortcut. The possible -#: values are normal or application or kitty or a comma separated -#: combination of them. The special keyword all means all modes. The -#: modes normal and application refer to the DECCKM cursor key mode -#: for terminals, and kitty refers to the special kitty extended -#: keyboard protocol. - -#: Another example, that outputs a word and then moves the cursor to -#: the start of the line (same as pressing the Home key):: - -#: map ctrl+alt+a send_text normal Word\x1b[H -#: map ctrl+alt+a send_text application Word\x1bOH - -#: }}} - -# }}} diff --git a/nix/bin/build b/nix/bin/build deleted file mode 100755 index 1ae8cb0..0000000 --- a/nix/bin/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -e - -VERSION=1.0 -export args=$@ - -# Navigate to the directory of this script -cd $(dirname $(readlink -f $0)) -cd .. - -build() { - if [ "$(uname)" == "Darwin" ]; then - ./bin/darwin-build $args - elif [ "$(uname)" == "Linux" ]; then - ./bin/nixos-build $args - else - echo "Unknown platform" - fi -} - -build diff --git a/nix/bin/darwin-build b/nix/bin/darwin-build deleted file mode 100755 index 9d2c353..0000000 --- a/nix/bin/darwin-build +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -e - -VERSION=1.0 - -GREEN='\033[1;32m' -RED='\033[1;31m' -CLEAR='\033[0m' - -FLAKE="macos" -SYSTEM="darwinConfigurations.$FLAKE.system" - -export NIXPKGS_ALLOW_UNFREE=1 - -# Navigate to the directory of this script -cd $(dirname $(readlink -f $0)) -cd .. - -echo "${GREEN}Requesting sudo to set homebrew tap permissions...${CLEAR}" - -# This is reset by nix-homebrew, we need write permission to this dir to manage homebrew taps -sudo mkdir -p /opt/homebrew/Library/Taps/homebrew/ -sudo /bin/chmod +a "sab allow list,add_file,search,delete,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,writesecurity,chown" /opt/homebrew/Library/Taps/homebrew/ - -echo "${GREEN}Starting build...${CLEAR}" - -echo "nix --experimental-features 'nix-command flakes' build .#$SYSTEM $@" -nix build .#$SYSTEM $@ - -echo "${GREEN}Switching to new generation...${CLEAR}" -./result/sw/bin/darwin-rebuild switch --flake .#$FLAKE $@ - -echo "${GREEN}Cleaning up...${CLEAR}" -unlink ./result - -echo "${GREEN}Done${CLEAR}" diff --git a/nix/bin/nixos-build b/nix/bin/nixos-build deleted file mode 100755 index f431b7f..0000000 --- a/nix/bin/nixos-build +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -e - -VERSION=1.0 - -GREEN='\033[1;32m' -RED='\033[1;31m' -CLEAR='\033[0m' - -sudo echo -echo -e "${GREEN}Starting...${CLEAR}" - -sudo SSH_AUTH_SOCK=$SSH_AUTH_SOCK /run/current-system/sw/bin/nixos-rebuild switch --flake .#nixos $@ -echo -e "${GREEN}Done${CLEAR}" diff --git a/nix/darwin/casks.nix b/nix/darwin/casks.nix deleted file mode 100644 index 874966f..0000000 --- a/nix/darwin/casks.nix +++ /dev/null @@ -1,4 +0,0 @@ -{}: [ - "keycastr" - "vlc" -] diff --git a/nix/darwin/default.nix b/nix/darwin/default.nix deleted file mode 100644 index f21ebd2..0000000 --- a/nix/darwin/default.nix +++ /dev/null @@ -1,107 +0,0 @@ -{ - config, - pkgs, - ... -}: let - user = "%USER%"; -in { - imports = [ - ../shared - ../shared/cachix - ./home-manager.nix - ./skhd.nix - ./yabai.nix - ]; - - # Auto upgrade nix package and the daemon service. - services.nix-daemon.enable = true; - users.users.sab = { - shell = pkgs.fish; - }; - # programs.tmux.enable = true; - - # Setup user, packages, programs - nix = { - package = pkgs.nixUnstable; - settings = { - auto-optimise-store = true; - experimental-features = ["nix-command" "flakes"]; - trusted-users = ["@admin" "${user}"]; - warn-dirty = false; - }; - - gc = { - user = "root"; - automatic = true; - interval = { - Weekday = 0; - Hour = 2; - Minute = 0; - }; - options = "--delete-older-than 30d"; - }; - }; - - # Turn off NIX_PATH warnings now that we're using flakes - system.checks.verifyNixPath = false; - - # Load configuration that is shared across systems - environment.systemPackages = with pkgs; - [ - neofetch - ] - ++ (import ../shared/packages.nix {inherit pkgs;}); - - # Enable fonts dir - fonts.fontDir.enable = true; - - programs.fish.enable = true; - system = { - stateVersion = 4; - - defaults = { - LaunchServices = { - LSQuarantine = false; - }; - - # NSGlobalDomain = { - # AppleShowAllExtensions = true; - # ApplePressAndHoldEnabled = false; - - # # 120, 90, 60, 30, 12, 6, 2 - # KeyRepeat = 2; - - # # 120, 94, 68, 35, 25, 15 - # InitialKeyRepeat = 15; - - # "com.apple.mouse.tapBehavior" = 1; - # "com.apple.sound.beep.volume" = 0.0; - # "com.apple.sound.beep.feedback" = 0; - # }; - - # dock = { - # autohide = false; - # show-recents = false; - # launchanim = true; - # orientation = "bottom"; - # tilesize = 48; - # }; - - finder = { - _FXShowPosixPathInTitle = false; - }; - - # trackpad = { - # Clicking = true; - # TrackpadThreeFingerDrag = true; - # }; - }; - - # keyboard = { - # enableKeyMapping = true; - # remapCapsLockToControl = true; - # }; - }; - # Enable sudo authentication with Touch ID. - security.pam.enableSudoTouchIdAuth = true; -} diff --git a/nix/darwin/home-manager.nix b/nix/darwin/home-manager.nix deleted file mode 100644 index 57f3740..0000000 --- a/nix/darwin/home-manager.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ - config, - pkgs, - lib, - home-manager, - ... -}: let - user = "sab"; -in { - # It me - users.users.${user} = { - name = "${user}"; - home = "/Users/${user}"; - isHidden = false; - shell = pkgs.fish; - }; - - # This is a module from nix-darwin - # Homebrew is *installed* via the flake input nix-homebrew - homebrew.enable = true; - homebrew.casks = pkgs.callPackage ./casks.nix {}; - - # Enable home-manager - home-manager = { - useGlobalPkgs = true; - users.${user} = { - pkgs, - config, - lib, - ... - }: { - home.enableNixpkgsReleaseCheck = false; - home.packages = pkgs.callPackage ./packages.nix {}; - - home.stateVersion = "23.11"; - programs = import ../shared/home-manager.nix {inherit config pkgs lib;}; - }; - }; -} diff --git a/nix/darwin/packages.nix b/nix/darwin/packages.nix deleted file mode 100644 index 7eaa1d8..0000000 --- a/nix/darwin/packages.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ pkgs }: - -with pkgs; -let shared-packages = import ../shared/packages.nix { inherit pkgs; }; in -shared-packages ++ [ - dockutil -] diff --git a/nix/darwin/skhd.nix b/nix/darwin/skhd.nix deleted file mode 100644 index b51482b..0000000 --- a/nix/darwin/skhd.nix +++ /dev/null @@ -1,138 +0,0 @@ -{ - launchd.user.agents.skhd.serviceConfig = { - StandardOutPath = "/tmp/skhd.log"; - StandardErrorPath = "/tmp/skhd.log"; - }; - services.skhd = { - enable = true; - skhdConfig = '' - # Default mode - :: default - - # Workspace focus - alt - 1 : yabai -m space --focus 1 - alt - 2 : yabai -m space --focus 2 - alt - 3 : yabai -m space --focus 3 - alt - 4 : yabai -m space --focus 4 - alt - 5 : yabai -m space --focus 5 - alt - 6 : yabai -m space --focus 6 - alt - 7 : yabai -m space --focus 7 - alt - 8 : yabai -m space --focus 8 - alt - 9 : yabai -m space --focus 9 - alt - 0 : yabai -m space --focus 10 - - alt - up : yabai -m space --focus 2 - alt - down : yabai -m space --focus (yabai -m query --spaces --display | jq 'map(select(."is-native-fullscreen" == true))[-1].index') - - # change focus between external displays (left and right) - ctrl + alt - left : yabai -m display --focus west - ctrl + alt - right : yabai -m display --focus east - - # Move windows to another workspace - ctrl + shift - 1 : yabai -m window --space 1 - ctrl + shift - 2 : yabai -m window --space 2 - ctrl + shift - 3 : yabai -m window --space 3 - ctrl + shift - 4 : yabai -m window --space 4 - ctrl + shift - 5 : yabai -m window --space 5 - ctrl + shift - 6 : yabai -m window --space 6 - ctrl + shift - 7 : yabai -m window --space 7 - ctrl + shift - 8 : yabai -m window --space 8 - ctrl + shift - 9 : yabai -m window --space 9 - ctrl + shift - 0 : yabai -m window --space 10 - - # Navigation - alt - h : yabai -m window --focus west - alt - j : yabai -m window --focus south - alt - k : yabai -m window --focus north - alt - l : yabai -m window --focus east - alt - left : yabai -m window --focus west - alt - down : yabai -m window --focus south - alt - up : yabai -m window --focus north - alt - right : yabai -m window --focus east - - # Close current window - alt - q : yabai -m window --close - - # Moving windows - shift + alt - h : yabai -m window --warp west - shift + alt - j : yabai -m window --warp south - shift + alt - k : yabai -m window --warp north - shift + alt - l : yabai -m window --warp east - - # Move floating window - shift + alt - h : yabai -m window --move rel:-20:0 - shift + alt - j : yabai -m window --move rel:0:20 - shift + alt - k : yabai -m window --move rel:0:-20 - shift + alt - l : yabai -m window --move rel:20:0 - - # Float/unfloat windows - shift + alt - space : yabai -m window --toggle float; \ - yabai -m window --grid 4:4:1:1:2:2 - - # Fullscreen - alt - f : yabai -m window --toggle zoom-fullscreen - ctrl + shift - f : yabai -m window --toggle native-fullscreen - - # Resize mode - :: resize @ - - ## Enter resize mode - alt - r ; resize - - ## Leave resize mode - resize < escape ; default - - ## Resize mode key bindings - resize < h : \ - yabai -m window --resize left:-20:0 ; \ - yabai -m window --resize right:-20:0 - resize < j : \ - yabai -m window --resize bottom:0:20 ; \ - yabai -m window --resize top:0:20 - resize < k : \ - yabai -m window --resize top:0:-20 ; \ - yabai -m window --resize bottom:0:-20 - resize < l : \ - yabai -m window --resize right:20:0 ; \ - yabai -m window --resize left:20:0 - - # Resize windows - ctrl + alt - h : \ - yabai -m window --resize left:-20:0 ; \ - yabai -m window --resize right:-20:0 - - ctrl + alt - j : \ - yabai -m window --resize bottom:0:20 ; \ - yabai -m window --resize top:0:20 - - ctrl + alt - k : \ - yabai -m window --resize top:0:-20 ; \ - yabai -m window --resize bottom:0:-20 - - ctrl + alt - l : \ - yabai -m window --resize right:20:0 ; \ - yabai -m window --resize left:20:0 - - # Toggle window split type with semicolon - ctrl + alt - e : yabai -m window --toggle split - - # Balance size of windows - ctrl + alt - 0 : yabai -m space --balance - - # Workspace init - ctrl + shift - n : yabai -m space --create - ctrl + shift - d : yabai -m space --destroy - - # Applications - alt - x : /Users/sab/.nix-profile/bin/kitty - ctrl + alt - b: /Applications/Firefox.App/Contents/MacOS/firefox - - # -- Starting/Stopping/Restarting Yabai -- - - # stop/start/restart yabai + skhd - ctrl + alt - q : launchctl stop org.nixos.yabai; launchctl stop org.nixos.skhd - ctrl + alt - s : launchctl start org.nixos.yabai; launchctl start org.nixos.skhd - ctrl + alt - r : launchctl stop org.nixos.yabai; launchctl stop org.nixos.skhd; launchctl start org.nixos.yabai; launchctl start org.nixos.skhd - ''; - }; -} diff --git a/nix/darwin/yabai.nix b/nix/darwin/yabai.nix deleted file mode 100644 index 5b4b200..0000000 --- a/nix/darwin/yabai.nix +++ /dev/null @@ -1,81 +0,0 @@ -{pkgs, ...}: { - launchd.user.agents.yabai.serviceConfig = { - StandardOutPath = "/tmp/yabai.log"; - StandardErrorPath = "/tmp/yabai.log"; - }; - services.yabai = { - enable = true; - enableScriptingAddition = true; - config = { - # Binary space partitioning layout - layout = "bsp"; - # When focusing a window, put the mouse at its center - mouse_follows_focus = "on"; - # Automatically focus the window under the mouse - focus_follows_mouse = "autoraise"; - # New window spawns to the right if vertical split, or bottom if - # horizontal split - window_placement = "second_child"; - # Disable opacity for windows - window_opacity = "off"; - # Padding added around the sides of a space - top_padding = 6; - bottom_padding = 6; - left_padding = 6; - right_padding = 6; - # Size of the gap that separates windows - window_gap = 6; - # Draw shadow for windows, window_border has been removed - window_shadow = "on"; - # Add padding for external status bar - external_bar = "all:0:26"; - }; - extraConfig = '' - for _ in $(yabai -m query --spaces | jq '.[].index | select(. > 6)'); do - yabai -m space --destroy 7 - done - - function setup_space { - local idx="$1" - local name="$2" - local space= - echo "setup space $idx : $name" - - space=$(yabai -m query --spaces --space "$idx") - if [ -z "$space" ]; then - yabai -m space --create - fi - yabai -m space "$idx" --label "$name" - } - - setup_space 1 main - setup_space 2 web - setup_space 3 code - setup_space 4 social - setup_space 5 media - setup_space 6 other - - yabai -m rule --add app="^Safari$" space=2 - yabai -m rule --add app="^Firefox$" space=2 - yabai -m rule --add app="^Kitty$" space=3 - yabai -m rule --add app="^kitty$" space=3 - yabai -m rule --add app="^Telegram$" space=1 - yabai -m rule --add app="^Slack$" space=1 - yabai -m rule --add app="^Teams$" space=1 - yabai -m rule --add app="^Mail$" space=4 - yabai -m rule --add app="^Calendar$" space=4 - yabai -m rule --add app="^Music$" space=5 - - # Float system settings - yabai -m rule --add app="^(Terminal|Calculator|Software Update|Dictionary|VLC|System Preferences|System Settings|zoom.us|Photo Booth|Archive Utility)$" manage=off - yabai -m rule --add label="Finder" app="^Finder$" title="(Co(py|nnect)|Move|Info|Pref)" manage=off - yabai -m rule --add app="^System Information$" label="^About This Mac$" manage=off - yabai -m rule --add app="^Cisco AnyConnect Secure Mobility Client$" manage=off - yabai -m rule --add app="^Cisco$" manage=off - - # Load scripting addition - yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa" - sudo yabai --load-sa - ''; - }; -} diff --git a/nix/flake.lock b/nix/flake.lock index 402a382..eefbf63 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -9,11 +9,11 @@ ] }, "locked": { - "lastModified": 1660510326, + "lastModified": 1660592437, "narHash": "sha256-xFumnivtVwu5fFBOrTxrv6fv3geHKF04RGP23EsDVaI=", "owner": "kamadorueda", "repo": "alejandra", - "rev": "ef03f7ef74ec97fd91a016a51c9c9667fb315652", + "rev": "e7eac49074b70814b542fee987af2987dd0520b5", "type": "github" }, "original": { @@ -26,16 +26,16 @@ "brew-src": { "flake": false, "locked": { - "lastModified": 1694443293, - "narHash": "sha256-wBjbF2RRFyD4lN7ie98VnggmNBwAPv/dg2U+w5mUyuM=", + "lastModified": 1705326576, + "narHash": "sha256-9PvMgHgdbpb5vBO8fHCRufodR731ynzGMF9+68vKWck=", "owner": "Homebrew", "repo": "brew", - "rev": "4afb8e5602f3ecc9edf67a44257d8eceeaa8a108", + "rev": "1c612baa096c69f2fcb221c74e6f5b9979efdcee", "type": "github" }, "original": { "owner": "Homebrew", - "ref": "4.1.11", + "ref": "4.2.4", "repo": "brew", "type": "github" } @@ -47,11 +47,11 @@ ] }, "locked": { - "lastModified": 1704277720, - "narHash": "sha256-meAKNgmh3goankLGWqqpw73pm9IvXjEENJloF0coskE=", + "lastModified": 1706833576, + "narHash": "sha256-w7BL0EWRts+nD1lbLECIuz6fRzmmV+z8oWwoY7womR0=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "0dd382b70c351f528561f71a0a7df82c9d2be9a4", + "rev": "bdbae6ecff8fcc322bf6b9053c0b984912378af7", "type": "github" }, "original": { @@ -83,6 +83,22 @@ "type": "github" } }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -101,6 +117,42 @@ "type": "github" } }, + "flake-utils-plus": { + "inputs": { + "flake-utils": "flake-utils_2" + }, + "locked": { + "lastModified": 1696331477, + "narHash": "sha256-YkbRa/1wQWdWkVJ01JvV+75KIdM37UErqKgTf0L54Fk=", + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "rev": "bfc53579db89de750b25b0c5e7af299e0c06d7d3", + "type": "github" + }, + "original": { + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "flakeCompat": { "flake": false, "locked": { @@ -124,11 +176,11 @@ ] }, "locked": { - "lastModified": 1705269478, - "narHash": "sha256-j7Rp8Y3ckBHOlIzqe0g2+/BVce9SU/dVtn4Eb0rMuY4=", + "lastModified": 1706798041, + "narHash": "sha256-BbvuF4CsVRBGRP8P+R+JUilojk0M60D7hzqE0bEvJBQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "846200eb574faa2af808ed02e653c2b8ed51fd71", + "rev": "4d53427bce7bf3d17e699252fd84dc7468afc46e", "type": "github" }, "original": { @@ -141,11 +193,11 @@ "homebrew-cask": { "flake": false, "locked": { - "lastModified": 1705302354, - "narHash": "sha256-4JijL3SpT3U/4jFVw3PnxRAnDi+W5rmsi2xXy2AMcNo=", + "lastModified": 1706879948, + "narHash": "sha256-bMr/3iiTuG72bMrTmNTNTFhudMucDP9ndR07FErVkvQ=", "owner": "homebrew", "repo": "homebrew-cask", - "rev": "ab3d14b1fbfbdb4248c00c1876cd0ddcdf1d33ed", + "rev": "d216ceb851be55e9dfeb9d5b739d2e1f2a5d103a", "type": "github" }, "original": { @@ -157,11 +209,11 @@ "homebrew-core": { "flake": false, "locked": { - "lastModified": 1705294865, - "narHash": "sha256-B8FUYITW7K5ftYYMFuxzTx3jrmqSTKVM9YRMjnHHI+E=", + "lastModified": 1706880160, + "narHash": "sha256-OocK1RxG74yC2jWTbr8f7A33ABIiBjSFOLngsLPBiZc=", "owner": "homebrew", "repo": "homebrew-core", - "rev": "cd4a1994e6a73dd88e4c245f26016d4de89fc49b", + "rev": "e25e07f30fdb4075b08ff4bfe3fd92b1a1099d77", "type": "github" }, "original": { @@ -196,11 +248,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1695057498, - "narHash": "sha256-wn3j7u5tOgLLbNxZC542rJiP5iX323m+CoGPMgPOxp4=", + "lastModified": 1705952034, + "narHash": "sha256-H0nk8Gk8kPw4yi2WwOTsSHgPrzSwyNgWEYHk10IJwfc=", "owner": "zhaofengli-wip", "repo": "nix-homebrew", - "rev": "6ab33c5e9249e74401144a7c667d96a757c5d341", + "rev": "40f5ee46b58e7c5f1927e2c5a583dc3d7e571ed9", "type": "github" }, "original": { @@ -240,11 +292,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1705133751, - "narHash": "sha256-rCIsyE80jgiOU78gCWN3A0wE0tR2GI5nH6MlS+HaaSQ=", + "lastModified": 1706550542, + "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9b19f5e77dd906cb52dade0b7bd280339d2a1f3d", + "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652", "type": "github" }, "original": { @@ -262,7 +314,8 @@ "homebrew-cask": "homebrew-cask", "homebrew-core": "homebrew-core", "nix-homebrew": "nix-homebrew", - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_3", + "snowfall-lib": "snowfall-lib" } }, "rust-analyzer-src": { @@ -282,6 +335,28 @@ "type": "github" } }, + "snowfall-lib": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils-plus": "flake-utils-plus", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1696432959, + "narHash": "sha256-oJQZv2MYyJaVyVJY5IeevzqpGvMGKu5pZcCCJvb+xjc=", + "owner": "snowfallorg", + "repo": "lib", + "rev": "92803a029b5314d4436a8d9311d8707b71d9f0b6", + "type": "github" + }, + "original": { + "owner": "snowfallorg", + "repo": "lib", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, @@ -296,6 +371,21 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/nix/flake.nix b/nix/flake.nix index f3e735d..23f8ba3 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -1,11 +1,15 @@ +#https://github.com/Kazuto/.nix/blob/master/modules/linux/home/default.nix { description = "Sbulav nix config"; inputs = { # Nixpkgs - # nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + snowfall-lib = { + url = "github:snowfallorg/lib"; + inputs.nixpkgs.follows = "nixpkgs"; + }; darwin = { url = "github:LnL7/nix-darwin/master"; inputs.nixpkgs.follows = "nixpkgs"; @@ -23,91 +27,44 @@ }; # Home manager - home-manager.url = "github:nix-community/home-manager/master"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; + home-manager = { + url = "github:nix-community/home-manager/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; # Nix formatter - alejandra.url = "github:kamadorueda/alejandra/3.0.0"; - alejandra.inputs.nixpkgs.follows = "nixpkgs"; + alejandra = { + url = "github:kamadorueda/alejandra/3.0.0"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { - alejandra, - darwin, - home-manager, - homebrew-cask, - homebrew-core, - nix-homebrew, - nixpkgs, - self, - ... - } @ inputs: let - user = "sab"; - systems = ["x86_64-linux" "aarch64-darwin"]; - forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system); - devShell = system: let - pkgs = nixpkgs.legacyPackages.${system}; - in { - default = with pkgs; - mkShell { - nativeBuildInputs = with pkgs; [bashInteractive git age age-plugin-yubikey]; - shellHook = with pkgs; '' - export EDITOR=vim - ''; + outputs = inputs: let + lib = inputs.snowfall-lib.mkLib { + inherit inputs; + src = ./.; + + snowfall = { + meta = { + name = "dotfiles"; + title = "dotfiles"; }; - }; - in { - devShells = forAllSystems devShell; - darwinConfigurations = let - user = "sab"; - in { - macos = darwin.lib.darwinSystem { - system = "aarch64-darwin"; - specialArgs = inputs; - modules = [ - nix-homebrew.darwinModules.nix-homebrew - home-manager.darwinModules.home-manager - { - nix-homebrew = { - enable = true; - user = "sab"; - taps = { - "homebrew/homebrew-core" = homebrew-core; - "homebrew/homebrew-cask" = homebrew-cask; - }; - mutableTaps = true; - autoMigrate = true; - }; - } - ./darwin - ]; + namespace = "custom"; }; }; - # NixOS configuration entrypoint - # Available through 'nixos-rebuild --flake .#your-hostname' - nixosConfigurations = let - user = "sab"; - in { - nz = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = {inherit inputs;}; # Pass flake inputs to our config - # > Our main nixos configuration file < - modules = [./nixos/configuration.nix]; - }; - }; - imports = [ - # Import home-manager's NixOS module - inputs.home-manager.nixosModules.home-manager - ]; - # Standalone home-manager configuration entrypoint - # Available through 'home-manager --flake .#your-username@your-hostname' - homeConfigurations = { - "sab@nz" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - extraSpecialArgs = {inherit inputs;}; # Pass flake inputs to our config - # > Our main home-manager configuration file < - modules = [./nixos/home-manager/home.nix]; + in + lib.mkFlake { + inherit inputs; + src = ./.; + + channels-config = { + allowUnfree = true; }; + + overlays = with inputs; []; + + systems.modules.nixos = with inputs; []; + + templates = import ./templates {}; }; - }; } diff --git a/nix/lib/module/default.nix b/nix/lib/module/default.nix new file mode 100644 index 0000000..aa0ad46 --- /dev/null +++ b/nix/lib/module/default.nix @@ -0,0 +1,15 @@ +{lib, ...}: +with lib; rec { + mkOpt = type: default: description: + mkOption {inherit type default description;}; + + mkOpt' = type: default: mkOpt type default null; + + mkBoolOpt = mkOpt types.bool; + + mkBoolOpt' = mkOpt' types.bool; + + enabled = {enable = true;}; + + disabled = {enable = false;}; +} diff --git a/nix/modules/darwin/cli-apps/neovim/default.nix b/nix/modules/darwin/cli-apps/neovim/default.nix new file mode 100644 index 0000000..1a6d42a --- /dev/null +++ b/nix/modules/darwin/cli-apps/neovim/default.nix @@ -0,0 +1,23 @@ +inputs @ { + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.cli-apps.neovim; +in { + options.custom.cli-apps.neovim = with types; { + enable = mkBoolOpt false "Whether or not to enable neovim."; + }; + + config = mkIf cfg.enable { + programs.neovim = { + enable = true; + defaultEditor = true; + vimAlias = true; + }; + }; +} diff --git a/nix/modules/darwin/desktop/addons/skhd/default.nix b/nix/modules/darwin/desktop/addons/skhd/default.nix new file mode 100644 index 0000000..0ae5746 --- /dev/null +++ b/nix/modules/darwin/desktop/addons/skhd/default.nix @@ -0,0 +1,153 @@ +{ + lib, + pkgs, + config, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.skhd; +in { + options.custom.desktop.addons.skhd = { + enable = mkEnableOption "skhd"; + }; + + config = mkIf cfg.enable { + launchd.user.agents.skhd.serviceConfig = { + StandardOutPath = "/tmp/skhd.log"; + StandardErrorPath = "/tmp/skhd.log"; + }; + services.skhd = { + enable = true; + skhdConfig = '' + # Default mode + :: default + + # Workspace focus + alt - 1 : yabai -m space --focus 1 + alt - 2 : yabai -m space --focus 2 + alt - 3 : yabai -m space --focus 3 + alt - 4 : yabai -m space --focus 4 + alt - 5 : yabai -m space --focus 5 + alt - 6 : yabai -m space --focus 6 + alt - 7 : yabai -m space --focus 7 + alt - 8 : yabai -m space --focus 8 + alt - 9 : yabai -m space --focus 9 + alt - 0 : yabai -m space --focus 10 + + alt - up : yabai -m space --focus 2 + alt - down : yabai -m space --focus (yabai -m query --spaces --display | jq 'map(select(."is-native-fullscreen" == true))[-1].index') + + # change focus between external displays (left and right) + ctrl + alt - left : yabai -m display --focus west + ctrl + alt - right : yabai -m display --focus east + + # Move windows to another workspace + ctrl + shift - 1 : yabai -m window --space 1 + ctrl + shift - 2 : yabai -m window --space 2 + ctrl + shift - 3 : yabai -m window --space 3 + ctrl + shift - 4 : yabai -m window --space 4 + ctrl + shift - 5 : yabai -m window --space 5 + ctrl + shift - 6 : yabai -m window --space 6 + ctrl + shift - 7 : yabai -m window --space 7 + ctrl + shift - 8 : yabai -m window --space 8 + ctrl + shift - 9 : yabai -m window --space 9 + ctrl + shift - 0 : yabai -m window --space 10 + + # Navigation + alt - h : yabai -m window --focus west + alt - j : yabai -m window --focus south + alt - k : yabai -m window --focus north + alt - l : yabai -m window --focus east + alt - left : yabai -m window --focus west + alt - down : yabai -m window --focus south + alt - up : yabai -m window --focus north + alt - right : yabai -m window --focus east + + # Close current window + alt - q : yabai -m window --close + + # Moving windows + shift + alt - h : yabai -m window --warp west + shift + alt - j : yabai -m window --warp south + shift + alt - k : yabai -m window --warp north + shift + alt - l : yabai -m window --warp east + + # Move floating window + shift + alt - h : yabai -m window --move rel:-20:0 + shift + alt - j : yabai -m window --move rel:0:20 + shift + alt - k : yabai -m window --move rel:0:-20 + shift + alt - l : yabai -m window --move rel:20:0 + + # Float/unfloat windows + shift + alt - space : yabai -m window --toggle float; \ + yabai -m window --grid 4:4:1:1:2:2 + + # Fullscreen + alt - f : yabai -m window --toggle zoom-fullscreen + ctrl + shift - f : yabai -m window --toggle native-fullscreen + + # Resize mode + :: resize @ + + ## Enter resize mode + alt - r ; resize + + ## Leave resize mode + resize < escape ; default + + ## Resize mode key bindings + resize < h : \ + yabai -m window --resize left:-20:0 ; \ + yabai -m window --resize right:-20:0 + resize < j : \ + yabai -m window --resize bottom:0:20 ; \ + yabai -m window --resize top:0:20 + resize < k : \ + yabai -m window --resize top:0:-20 ; \ + yabai -m window --resize bottom:0:-20 + resize < l : \ + yabai -m window --resize right:20:0 ; \ + yabai -m window --resize left:20:0 + + # Resize windows + ctrl + alt - h : \ + yabai -m window --resize left:-20:0 ; \ + yabai -m window --resize right:-20:0 + + ctrl + alt - j : \ + yabai -m window --resize bottom:0:20 ; \ + yabai -m window --resize top:0:20 + + ctrl + alt - k : \ + yabai -m window --resize top:0:-20 ; \ + yabai -m window --resize bottom:0:-20 + + ctrl + alt - l : \ + yabai -m window --resize right:20:0 ; \ + yabai -m window --resize left:20:0 + + # Toggle window split type with semicolon + ctrl + alt - e : yabai -m window --toggle split + + # Balance size of windows + ctrl + alt - 0 : yabai -m space --balance + + # Workspace init + ctrl + shift - n : yabai -m space --create + ctrl + shift - d : yabai -m space --destroy + + # Applications + alt - x : /Users/sab/.nix-profile/bin/kitty + ctrl + alt - b: /Applications/Firefox.App/Contents/MacOS/firefox + + # -- Starting/Stopping/Restarting Yabai -- + + # stop/start/restart yabai + skhd + ctrl + alt - q : launchctl stop org.nixos.yabai; launchctl stop org.nixos.skhd + ctrl + alt - s : launchctl start org.nixos.yabai; launchctl start org.nixos.skhd + ctrl + alt - r : launchctl stop org.nixos.yabai; launchctl stop org.nixos.skhd; launchctl start org.nixos.yabai; launchctl start org.nixos.skhd + ''; + }; + }; +} diff --git a/nix/modules/darwin/desktop/addons/spacebar/default.nix b/nix/modules/darwin/desktop/addons/spacebar/default.nix new file mode 100644 index 0000000..ce1d5b2 --- /dev/null +++ b/nix/modules/darwin/desktop/addons/spacebar/default.nix @@ -0,0 +1,49 @@ +{ + lib, + pkgs, + config, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.spacebar; +in { + options.custom.desktop.addons.spacebar = { + enable = mkEnableOption "Spacebar"; + }; + + config = mkIf cfg.enable { + services.spacebar = { + enable = true; + package = pkgs.spacebar; + + config = { + position = "top"; + display = "all"; + height = 32; + title = "on"; + spaces = "on"; + clock = "on"; + power = "off"; + + padding_left = 10; + padding_right = 10; + + spacing_left = 10; + spacing_right = 10; + + foreground_color = "0xffeceff4"; + background_color = "0xff1d2128"; + + text_font = ''"Hack Nerd Font Mono:Regular:14.0"''; + icon_font = ''"Hack Nerd Font Mono:Regular:20.0"''; + + # Shell entries apparently break the whole bar... + # https://github.com/cmacrae/spacebar/issues/104 + # right_shell_icon = ""; + # right_shell_command = ''"whoami"''; + # right_shell = "on"; + }; + }; + }; +} diff --git a/nix/modules/darwin/desktop/yabai/default.nix b/nix/modules/darwin/desktop/yabai/default.nix new file mode 100644 index 0000000..cb7f797 --- /dev/null +++ b/nix/modules/darwin/desktop/yabai/default.nix @@ -0,0 +1,104 @@ +{ + lib, + pkgs, + config, + ... +}: let + cfg = config.custom.desktop.yabai; + + inherit (lib) types mkEnableOption mkIf; + inherit (lib.custom) mkOpt enabled; +in { + options.custom.desktop.yabai = { + enable = mkEnableOption "Yabai"; + enable-scripting-addition = mkOpt types.bool true "Whether to enable the scripting addition for Yabai. (Requires SIP to be disabled)"; + }; + + config = mkIf cfg.enable { + custom.desktop.addons = { + skhd = enabled; + spacebar = disabled; + }; + launchd.user.agents.yabai.serviceConfig = { + StandardOutPath = "/tmp/yabai.log"; + StandardErrorPath = "/tmp/yabai.log"; + }; + + services.yabai = { + enable = true; + enableScriptingAddition = true; + config = { + # Binary space partitioning layout + layout = "bsp"; + # When focusing a window, put the mouse at its center + mouse_follows_focus = "on"; + # Automatically focus the window under the mouse + focus_follows_mouse = "autoraise"; + # New window spawns to the right if vertical split, or bottom if + # horizontal split + window_placement = "second_child"; + # Disable opacity for windows + window_opacity = "off"; + # Padding added around the sides of a space + top_padding = 6; + bottom_padding = 6; + left_padding = 6; + right_padding = 6; + # Size of the gap that separates windows + window_gap = 6; + # Draw shadow for windows, window_border has been removed + window_shadow = "on"; + # Add padding for external status bar + external_bar = "all:0:26"; + }; + + extraConfig = '' + for _ in $(yabai -m query --spaces | jq '.[].index | select(. > 6)'); do + yabai -m space --destroy 7 + done + + function setup_space { + local idx="$1" + local name="$2" + local space= + echo "setup space $idx : $name" + + space=$(yabai -m query --spaces --space "$idx") + if [ -z "$space" ]; then + yabai -m space --create + fi + yabai -m space "$idx" --label "$name" + } + + setup_space 1 main + setup_space 2 web + setup_space 3 code + setup_space 4 social + setup_space 5 media + setup_space 6 other + + yabai -m rule --add app="^Safari$" space=2 + yabai -m rule --add app="^Firefox$" space=2 + yabai -m rule --add app="^Kitty$" space=3 + yabai -m rule --add app="^kitty$" space=3 + yabai -m rule --add app="^Telegram$" space=1 + yabai -m rule --add app="^Slack$" space=1 + yabai -m rule --add app="^Teams$" space=1 + yabai -m rule --add app="^Mail$" space=4 + yabai -m rule --add app="^Calendar$" space=4 + yabai -m rule --add app="^Music$" space=5 + + # Float system settings + yabai -m rule --add app="^(Terminal|Calculator|Software Update|Dictionary|VLC|System Preferences|System Settings|zoom.us|Photo Booth|Archive Utility)$" manage=off + yabai -m rule --add label="Finder" app="^Finder$" title="(Co(py|nnect)|Move|Info|Pref)" manage=off + yabai -m rule --add app="^System Information$" label="^About This Mac$" manage=off + yabai -m rule --add app="^Cisco AnyConnect Secure Mobility Client$" manage=off + yabai -m rule --add app="^Cisco$" manage=off + + # Load scripting addition + yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa" + sudo yabai --load-sa + ''; + }; + }; +} diff --git a/nix/modules/darwin/home/default.nix b/nix/modules/darwin/home/default.nix new file mode 100644 index 0000000..b17c2dd --- /dev/null +++ b/nix/modules/darwin/home/default.nix @@ -0,0 +1,46 @@ +{ + options, + config, + pkgs, + lib, + inputs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.home; +in { + # imports = with inputs; [ + # home-manager.darwinModules.home-manager + # ]; + + options.custom.home = with types; { + file = + mkOpt attrs {} + "A set of files to be managed by home-manager's ."; + configFile = + mkOpt attrs {} + "A set of files to be managed by home-manager's ."; + extraOptions = mkOpt attrs {} "Options to pass directly to home-manager."; + homeConfig = mkOpt attrs {} "Final config for home-manager."; + }; + + config = { + custom.home.extraOptions = { + home.stateVersion = mkDefault "22.11"; + home.file = mkAliasDefinitions options.custom.home.file; + xdg.enable = true; + xdg.configFile = mkAliasDefinitions options.custom.home.configFile; + }; + + snowfallorg.user.${config.custom.user.name}.home.config = mkAliasDefinitions options.custom.home.extraOptions; + + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + + # users.${config.custom.user.name} = args: + # mkAliasDefinitions options.custom.home.extraOptions; + }; + }; +} diff --git a/nix/modules/darwin/nix/default.nix b/nix/modules/darwin/nix/default.nix new file mode 100644 index 0000000..789805a --- /dev/null +++ b/nix/modules/darwin/nix/default.nix @@ -0,0 +1,72 @@ +{ + options, + config, + pkgs, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.nix; +in { + options.custom.nix = with types; { + enable = mkBoolOpt true "Whether or not to manage nix configuration."; + package = mkOpt package pkgs.nixUnstable "Which nix package to use."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + deploy-rs + nixfmt + nix-index + nix-prefetch-git + ]; + + nix = let + users = ["root" config.custom.user.name]; + in { + package = cfg.package; + + settings = { + experimental-features = "nix-command flakes"; + http-connections = 50; + warn-dirty = false; + log-lines = 50; + + # Large builds apparently fail due to an issue with darwin: + # https://github.com/NixOS/nix/issues/4119 + sandbox = false; + + # This appears to break on darwin + # https://github.com/NixOS/nix/issues/7273 + auto-optimise-store = false; + + allow-import-from-derivation = true; + + trusted-users = users; + allowed-users = users; + + # NOTE: This configuration is generated by nix-installer so I'm adding it here in + # case it becomes important. + extra-nix-path = "nixpkgs=flake:nixpkgs"; + build-users-group = "nixbld"; + }; + #// (lib.optionalAttrs config.custom.tools.direnv.enable { + # keep-outputs = true; + # keep-derivations = true; + #}); + + gc = { + automatic = true; + interval = {Day = 7;}; + options = "--delete-older-than 30d"; + user = config.custom.user.name; + }; + + # flake-utils-plus + generateRegistryFromInputs = true; + generateNixPathFromInputs = true; + linkInputs = true; + }; + }; +} diff --git a/nix/modules/darwin/services/nix-daemon/default.nix b/nix/modules/darwin/services/nix-daemon/default.nix new file mode 100644 index 0000000..44d5d1e --- /dev/null +++ b/nix/modules/darwin/services/nix-daemon/default.nix @@ -0,0 +1,18 @@ +{ + lib, + config, + ... +}: let + inherit (lib) types mkIf; + inherit (lib.custom) mkOpt enabled; + + cfg = config.custom.services.nix-daemon; +in { + options.custom.services.nix-daemon = { + enable = mkOpt types.bool true "Whether to enable the Nix daemon."; + }; + + config = mkIf cfg.enable { + services.nix-daemon = enabled; + }; +} diff --git a/nix/modules/darwin/suites/common/default.nix b/nix/modules/darwin/suites/common/default.nix new file mode 100644 index 0000000..3b6aa48 --- /dev/null +++ b/nix/modules/darwin/suites/common/default.nix @@ -0,0 +1,46 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.suites.common; +in { + options.custom.suites.common = with types; { + enable = mkBoolOpt false "Whether or not to enable common configuration."; + }; + + config = mkIf cfg.enable { + programs.fish = enabled; + + custom = { + nix = enabled; + + # apps = { + # iterm2 = enabled; + # }; + + cli-apps = { + neovim = enabled; + }; + + # tools = { + # git = enabled; + # flake = enabled; + # }; + + system = { + fonts = enabled; + input = enabled; + interface = enabled; + }; + + # security = { + # gpg = enabled; + # }; + }; + }; +} diff --git a/nix/modules/darwin/suites/development/default.nix b/nix/modules/darwin/suites/development/default.nix new file mode 100644 index 0000000..36c26fb --- /dev/null +++ b/nix/modules/darwin/suites/development/default.nix @@ -0,0 +1,39 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.suites.development; +in { + options.custom.suites.development = with types; { + enable = + mkBoolOpt false + "Whether or not to enable common development configuration."; + }; + + config = mkIf cfg.enable { + custom = { + # apps = { + # vscode = enabled; + # }; + + tools = { + # at = enabled; + # direnv = enabled; + # go = enabled; + # http = enabled; + # k8s = enabled; + # node = enabled; + # titan = enabled; + # python = enabled; + # java = enabled; + }; + + # virtualisation = { podman = enabled; }; + }; + }; +} diff --git a/nix/modules/darwin/system/fonts/default.nix b/nix/modules/darwin/system/fonts/default.nix new file mode 100644 index 0000000..bf500c4 --- /dev/null +++ b/nix/modules/darwin/system/fonts/default.nix @@ -0,0 +1,37 @@ +{ + options, + config, + pkgs, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.system.fonts; +in { + options.custom.system.fonts = with types; { + enable = mkBoolOpt false "Whether or not to manage fonts."; + fonts = mkOpt (listOf package) [] "Custom font packages to install."; + }; + + config = mkIf cfg.enable { + environment.variables = { + # Enable icons in tooling since we have nerdfonts. + LOG_ICONS = "true"; + }; + + fonts = { + fontDir = enabled; + + fonts = with pkgs; + [ + noto-fonts + noto-fonts-cjk-sans + noto-fonts-cjk-serif + noto-fonts-emoji + (nerdfonts.override {fonts = ["JetBrainsMono" "CascadiaCode" "FiraCode"];}) + ] + ++ cfg.fonts; + }; + }; +} diff --git a/nix/modules/darwin/system/input/default.nix b/nix/modules/darwin/system/input/default.nix new file mode 100644 index 0000000..3162c43 --- /dev/null +++ b/nix/modules/darwin/system/input/default.nix @@ -0,0 +1,46 @@ +{ + options, + config, + pkgs, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.system.input; +in { + options.custom.system.input = with types; { + enable = mkEnableOption "macOS input"; + }; + + config = mkIf cfg.enable (mkMerge [ + { + system = { + # keyboard = { + # enableKeyMapping = true; + # remapCapsLockToEscape = true; + # }; + + # defaults = { + # ".GlobalPreferences" = { + # "com.apple.mouse.scaling" = "1"; + # }; + + # NSGlobalDomain = { + # AppleKeyboardUIMode = 3; + # ApplePressAndHoldEnabled = false; + + # KeyRepeat = 2; + # InitialKeyRepeat = 15; + + # NSAutomaticCapitalizationEnabled = false; + # NSAutomaticDashSubstitutionEnabled = false; + # NSAutomaticQuoteSubstitutionEnabled = false; + # NSAutomaticPeriodSubstitutionEnabled = false; + # NSAutomaticSpellingCorrectionEnabled = false; + # }; + # }; + }; + } + ]); +} diff --git a/nix/modules/darwin/system/interface/default.nix b/nix/modules/darwin/system/interface/default.nix new file mode 100644 index 0000000..8132885 --- /dev/null +++ b/nix/modules/darwin/system/interface/default.nix @@ -0,0 +1,36 @@ +{ + options, + config, + pkgs, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.system.interface; +in { + options.custom.system.interface = with types; { + enable = mkEnableOption "macOS interface"; + }; + + config = mkIf cfg.enable { + system.defaults = { + # dock.autohide = true; + + LaunchServices = { + LSQuarantine = false; + }; + + finder = { + AppleShowAllExtensions = true; + FXEnableExtensionChangeWarning = false; + _FXShowPosixPathInTitle = false; + }; + + # NSGlobalDomain = { + # _HIHideMenuBar = true; + # AppleShowScrollBars = "Always"; + # }; + }; + }; +} diff --git a/nix/modules/darwin/user/default.nix b/nix/modules/darwin/user/default.nix new file mode 100644 index 0000000..72271c2 --- /dev/null +++ b/nix/modules/darwin/user/default.nix @@ -0,0 +1,42 @@ +{ + lib, + config, + pkgs, + ... +}: let + inherit (lib) types mkIf mkDefault; + inherit (lib.custom) mkOpt; + + cfg = config.custom.user; + + is-linux = pkgs.stdenv.isLinux; + is-darwin = pkgs.stdenv.isDarwin; +in { + options.custom.user = { + name = mkOpt str "sab" "The name to use for the user account."; + fullName = mkOpt str "Sergei Bulavintsev" "The full name of the user."; + email = mkOpt str "bulavintsev.sergey@gmail.com" "The email of the user."; + }; + + config = { + users.users.${cfg.name} = { + # NOTE: Setting the uid here is required for another + # module to evaluate successfully since it reads + # `users.users.${custom.user.name}.uid`. + # uid = mkIf (cfg.uid != null) cfg.uid; + shell = pkgs.fish; + }; + + snowfallorg.user.${config.custom.user.name}.home.config = { + home = { + file = { + ".profile".text = '' + # The default file limit is far too low and throws an error when rebuilding the system. + # See the original with: ulimit -Sa + ulimit -n 4096 + ''; + }; + }; + }; + }; +} diff --git a/nix/nixos/home-manager/mime.nix b/nix/modules/nixos/apps/firefox/default.nix similarity index 53% rename from nix/nixos/home-manager/mime.nix rename to nix/modules/nixos/apps/firefox/default.nix index e7e8a73..fc0570d 100644 --- a/nix/nixos/home-manager/mime.nix +++ b/nix/modules/nixos/apps/firefox/default.nix @@ -1,4 +1,13 @@ -{config, ...}: let +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.apps.firefox; browser = ["firefox.desktop"]; # XDG MIME types @@ -17,30 +26,23 @@ "x-scheme-handler/https" = browser; "x-scheme-handler/unknown" = browser; - "audio/*" = ["vlc.desktop"]; - "video/*" = ["vlc.desktop"]; - "image/*" = ["feh.desktop"]; "application/json" = browser; - "application/pdf" = ["org.pwmt.zathura.desktop.desktop"]; - "x-scheme-handler/tg" = ["telegramdesktop.desktop"]; - "inode/*" = ["pcmanfm.desktop"]; }; in { - xdg = { - enable = true; - cacheHome = config.home.homeDirectory + "/.local/cache"; + options.custom.apps.firefox = with types; { + enable = mkBoolOpt false "Whether or not to enable Firefox."; + }; - mimeApps = { + config = mkIf cfg.enable { + programs.firefox = { enable = true; - defaultApplications = associations; - associations.added = associations; }; - userDirs = { - enable = true; - createDirectories = true; - extraConfig = { - XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots"; + xdg = { + mime = { + enable = true; + defaultApplications = associations; + addedAssociations = associations; }; }; }; diff --git a/nix/modules/nixos/apps/gimp/default.nix b/nix/modules/nixos/apps/gimp/default.nix new file mode 100644 index 0000000..711652b --- /dev/null +++ b/nix/modules/nixos/apps/gimp/default.nix @@ -0,0 +1,18 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.apps.gimp; +in { + options.custom.apps.gimp = with types; { + enable = mkBoolOpt false "Whether or not to enable Gimp."; + }; + + config = + mkIf cfg.enable {environment.systemPackages = with pkgs; [gimp];}; +} diff --git a/nix/modules/nixos/apps/imv/default.nix b/nix/modules/nixos/apps/imv/default.nix new file mode 100644 index 0000000..e5e3eb8 --- /dev/null +++ b/nix/modules/nixos/apps/imv/default.nix @@ -0,0 +1,32 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.apps.imv; + + # XDG MIME types + associations = { + "image/*" = ["imv.desktop"]; + }; +in { + options.custom.apps.imv = with types; { + enable = mkBoolOpt false "Whether or not to enable imv."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [imv]; + + xdg = { + mime = { + enable = true; + defaultApplications = associations; + addedAssociations = associations; + }; + }; + }; +} diff --git a/nix/modules/nixos/apps/pcmanfm/default.nix b/nix/modules/nixos/apps/pcmanfm/default.nix new file mode 100644 index 0000000..b8604a5 --- /dev/null +++ b/nix/modules/nixos/apps/pcmanfm/default.nix @@ -0,0 +1,18 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.apps.pcmanfm; +in { + options.custom.apps.pcmanfm = with types; { + enable = mkBoolOpt false "Whether or not to enable pcmanfm."; + }; + + config = + mkIf cfg.enable {environment.systemPackages = with pkgs; [pcmanfm];}; +} diff --git a/nix/modules/nixos/apps/slack/default.nix b/nix/modules/nixos/apps/slack/default.nix new file mode 100644 index 0000000..2694793 --- /dev/null +++ b/nix/modules/nixos/apps/slack/default.nix @@ -0,0 +1,18 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.apps.slack; +in { + options.custom.apps.slack = with types; { + enable = mkBoolOpt false "Whether or not to enable slack."; + }; + + config = + mkIf cfg.enable {environment.systemPackages = with pkgs; [slack];}; +} diff --git a/nix/modules/nixos/apps/telegram/default.nix b/nix/modules/nixos/apps/telegram/default.nix new file mode 100644 index 0000000..fd43950 --- /dev/null +++ b/nix/modules/nixos/apps/telegram/default.nix @@ -0,0 +1,18 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.apps.telegram; +in { + options.custom.apps.telegram = with types; { + enable = mkBoolOpt false "Whether or not to enable telegram."; + }; + + config = + mkIf cfg.enable {environment.systemPackages = with pkgs; [telegram-desktop];}; +} diff --git a/nix/modules/nixos/apps/vlc/default.nix b/nix/modules/nixos/apps/vlc/default.nix new file mode 100644 index 0000000..7397474 --- /dev/null +++ b/nix/modules/nixos/apps/vlc/default.nix @@ -0,0 +1,32 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.apps.vlc; + + associations = { + "audio/*" = ["vlc.desktop"]; + "video/*" = ["vlc.desktop"]; + }; +in { + options.custom.apps.vlc = with types; { + enable = mkBoolOpt false "Whether or not to enable vlc."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [vlc]; + + xdg = { + mime = { + enable = true; + defaultApplications = associations; + addedAssociations = associations; + }; + }; + }; +} diff --git a/nix/modules/nixos/apps/zathura/default.nix b/nix/modules/nixos/apps/zathura/default.nix new file mode 100644 index 0000000..6a9f5ed --- /dev/null +++ b/nix/modules/nixos/apps/zathura/default.nix @@ -0,0 +1,30 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.apps.zathura; + associations = { + "application/pdf" = ["org.pwmt.zathura.desktop.desktop"]; + "application/epub" = ["org.pwmt.zathura.desktop.desktop"]; + }; +in { + options.custom.apps.zathura = with types; { + enable = mkBoolOpt false "Whether or not to enable zathura."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [zathura]; + xdg = { + mime = { + enable = true; + defaultApplications = associations; + addedAssociations = associations; + }; + }; + }; +} diff --git a/nix/modules/nixos/apps/zoom-us/default.nix b/nix/modules/nixos/apps/zoom-us/default.nix new file mode 100644 index 0000000..facc888 --- /dev/null +++ b/nix/modules/nixos/apps/zoom-us/default.nix @@ -0,0 +1,18 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.apps.zoom-us; +in { + options.custom.apps.zoom-us = with types; { + enable = mkBoolOpt false "Whether or not to enable zoom-us."; + }; + + config = + mkIf cfg.enable {environment.systemPackages = with pkgs; [zoom-us];}; +} diff --git a/nix/modules/nixos/cli-apps/atuin/default.nix b/nix/modules/nixos/cli-apps/atuin/default.nix new file mode 100644 index 0000000..fbff256 --- /dev/null +++ b/nix/modules/nixos/cli-apps/atuin/default.nix @@ -0,0 +1,24 @@ +{ + lib, + config, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.cli-apps.atuin; +in { + options.custom.cli-apps.atuin = { + enable = mkEnableOption "atuin"; + }; + + config = mkIf cfg.enable { + home.programs.atuin = { + enable = true; + # Does not work right now, injecting via fish + enableBashIntegration = true; + enableFishIntegration = true; + enableZshIntegration = true; + }; + }; +} diff --git a/nix/modules/nixos/cli-apps/lf/default.nix b/nix/modules/nixos/cli-apps/lf/default.nix new file mode 100644 index 0000000..5cd6dee --- /dev/null +++ b/nix/modules/nixos/cli-apps/lf/default.nix @@ -0,0 +1,30 @@ +{ + lib, + config, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.cli-apps.lf; +in { + options.custom.cli-apps.lf = { + enable = mkEnableOption "lf"; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + lf + ]; + home.file.".config/lf/lfrc".source = ./lfrc; + home.file.".config/lf/icons".source = ./icons; + home.file.".config/lf/lf_kitty_clean" = { + source = ./lf_kitty_clean; + executable = true; + }; + home.file.".config/lf/lf_kitty_preview" = { + source = ./lf_kitty_preview; + executable = true; + }; + }; +} diff --git a/lf/icons b/nix/modules/nixos/cli-apps/lf/icons similarity index 100% rename from lf/icons rename to nix/modules/nixos/cli-apps/lf/icons diff --git a/lf/lf_kitty_clean b/nix/modules/nixos/cli-apps/lf/lf_kitty_clean similarity index 100% rename from lf/lf_kitty_clean rename to nix/modules/nixos/cli-apps/lf/lf_kitty_clean diff --git a/lf/lf_kitty_preview b/nix/modules/nixos/cli-apps/lf/lf_kitty_preview similarity index 100% rename from lf/lf_kitty_preview rename to nix/modules/nixos/cli-apps/lf/lf_kitty_preview diff --git a/lf/lfrc b/nix/modules/nixos/cli-apps/lf/lfrc similarity index 100% rename from lf/lfrc rename to nix/modules/nixos/cli-apps/lf/lfrc diff --git a/nix/modules/nixos/cli-apps/neovim/default.nix b/nix/modules/nixos/cli-apps/neovim/default.nix new file mode 100644 index 0000000..1a6d42a --- /dev/null +++ b/nix/modules/nixos/cli-apps/neovim/default.nix @@ -0,0 +1,23 @@ +inputs @ { + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.cli-apps.neovim; +in { + options.custom.cli-apps.neovim = with types; { + enable = mkBoolOpt false "Whether or not to enable neovim."; + }; + + config = mkIf cfg.enable { + programs.neovim = { + enable = true; + defaultEditor = true; + vimAlias = true; + }; + }; +} diff --git a/nix/modules/nixos/cli-apps/tmux/default.nix b/nix/modules/nixos/cli-apps/tmux/default.nix new file mode 100644 index 0000000..b78a6d6 --- /dev/null +++ b/nix/modules/nixos/cli-apps/tmux/default.nix @@ -0,0 +1,21 @@ +{ + lib, + config, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.cli-apps.tmux; +in { + options.custom.cli-apps.tmux = { + enable = mkEnableOption "Tmux"; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + tmux + ]; + home.file.".tmux.conf".source = ./tmux.conf; + }; +} diff --git a/nix/modules/nixos/cli-apps/tmux/tmux.conf b/nix/modules/nixos/cli-apps/tmux/tmux.conf new file mode 100644 index 0000000..9787439 --- /dev/null +++ b/nix/modules/nixos/cli-apps/tmux/tmux.conf @@ -0,0 +1,103 @@ +##################################################### +# THEME +##################################################### +# Status tuning +set -g status on +set -g status-bg black +set -g status-fg white +set -g window-status-current-style fg=white,bg=black,bold +set -g status-interval 1 +set-option -g focus-events on +set -g default-shell /run/current-system/sw/bin/fish + +# Set window title string +# # #H Hostname of local host +# # #I Current window index +# # #P Current pane index +# # #S Session name +# # #T Current window title +# # #W Current window name +# # # A literal ‘#’ + +# Set up left status +set -g status-left-length 50 +set -g status-left '#[fg=red,bg=black][#h]#[fg=white,bold] W#I:P#P |#[default]' + +# Set up right status +set -g status-right-length 60 +set -g status-right "| #(/usr/bin/env bash $HOME/dotfiles/tmux/plugins/kube-tmux/kube.tmux 250 magenta cyan) #[fg=white]| #[fg=red] [%R]" +# set -g status-right '| #[fg=red]#(whoami) - [%R] ' +# set -g status-right '| #[fg=red] [%R] ' + +# Set up automatic pane rename +set-option -g automatic-rename-format '#(id -u)@#h #{?#{==:#{pane_current_command},#{b:SHELL}},#{b:pane_current_path}/,#{pane_current_command}}' + +# Highlight active window +set-window-option -g window-status-current-style bg=green,fg=black + +# Aauto renumber windows on close +setw -g renumber-windows on + +# Try to improve TERM colorscheme +# set -g default-terminal "screen-256color" +#set-option -ga terminal-overrides ',screen-256color:Tc' + +# tmux display things in 256 colors +#set -g default-terminal "tmux-256color-italic" +#set -as terminal-overrides ',xterm*:Tc:sitm=\E[3m' +# set -g default-terminal "xterm-24bit" +# set -g terminal-overrides ',xterm-24bit:Tc' +# set -g default-terminal 'xterm-256color' +# set -sa terminal-overrides ',xterm-256color:Tc' +set-option -g default-terminal "screen-256color" +set-option -ga terminal-overrides "screen-256color:Tc" + +set -as terminal-features ',screen-256color:clipboard' +#set -s copy-command 'pbcopy' +set -g allow-passthrough on +set -ga update-environment TERM +set -ga update-environment TERM_PROGRAM +set -g set-clipboard on +# enable terminal compability +#set-option -ga terminal-overrides ",tmux-256color-italic:Tc,xterm-256color-italic:T" + +# Highlight windows where something changed with white +setw -g monitor-activity on + +# Automatically set window title +set-window-option -g automatic-rename on +set-window-option -g allow-rename on + +# Start indexing windows from 1 +set -g base-index 1 +set -g pane-base-index 1 +##################################################### +# KEYS +##################################################### +# Use VI key bindings in the status line +set -g status-keys vi +# Use VI key bindings in copy and choice modes +setw -g mode-keys vi +# Use +[,v for begin copy, y copy and +P to paste current buffer +unbind P +bind P paste-buffer +# Keybinding for tmux >=2.6 +bind-key -T copy-mode-vi 'v' send-keys -X begin-selection +bind-key -T copy-mode-vi 'y' send-keys -X copy-selection + +# Vim style pane selection +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +# No delay for escape key press +set -sg escape-time 0 +# Set history size +set -g history-limit 50000 +# # Reload tmux config using r +bind r source-file ~/.tmux.conf \; display "Reloaded!" + +# Toggle synchronization +bind e setw synchronize-panes on +bind E setw synchronize-panes off diff --git a/nix/modules/nixos/cli-apps/yazi/configs/keymap.toml b/nix/modules/nixos/cli-apps/yazi/configs/keymap.toml new file mode 100644 index 0000000..fac24e9 --- /dev/null +++ b/nix/modules/nixos/cli-apps/yazi/configs/keymap.toml @@ -0,0 +1,238 @@ +[manager] + +keymap = [ + { on = [ "" ], exec = "escape", desc = "Exit visual mode, clear selected, or cancel search" }, + { on = [ "" ], exec = "quit", desc = "Exit the process" }, + { on = [ "q" ], exec = "quit", desc = "Exit the process" }, + { on = [ "Q" ], exec = "quit --no-cwd-file", desc = "Exit the process without writing cwd-file" }, + { on = [ "" ], exec = "close", desc = "Close the current tab, or quit if it is last tab" }, + { on = [ "" ], exec = "suspend", desc = "Suspend the process" }, + + # Navigation + { on = [ "k" ], exec = "arrow -1", desc = "Move cursor up" }, + { on = [ "j" ], exec = "arrow 1", desc = "Move cursor down" }, + + { on = [ "K" ], exec = "arrow -5", desc = "Move cursor up 5 lines" }, + { on = [ "J" ], exec = "arrow 5", desc = "Move cursor down 5 lines" }, + { on = [ "" ], exec = "arrow -50%", desc = "Move cursor up half page" }, + { on = [ "" ], exec = "arrow 50%", desc = "Move cursor down half page" }, + { on = [ "" ], exec = "arrow -100%", desc = "Move cursor up one page" }, + { on = [ "" ], exec = "arrow 100%", desc = "Move cursor down one page" }, + + { on = [ "" ], exec = "arrow -50%", desc = "Move cursor up half page" }, + { on = [ "" ], exec = "arrow 50%", desc = "Move cursor down half page" }, + { on = [ "" ], exec = "arrow -100%", desc = "Move cursor up one page" }, + { on = [ "" ], exec = "arrow 100%", desc = "Move cursor down one page" }, + + { on = [ "h" ], exec = "leave", desc = "Go back to the parent directory" }, + { on = [ "l" ], exec = "enter", desc = "Enter the child directory" }, + + { on = [ "H" ], exec = "back", desc = "Go back to the previous directory" }, + { on = [ "L" ], exec = "forward", desc = "Go forward to the next directory" }, + + { on = [ "" ], exec = "peek -5", desc = "Peek up 5 units in the preview" }, + { on = [ "" ], exec = "peek 5", desc = "Peek down 5 units in the preview" }, + + { on = [ "" ], exec = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], exec = "arrow 1", desc = "Move cursor down" }, + { on = [ "" ], exec = "leave", desc = "Go back to the parent directory" }, + { on = [ "" ], exec = "enter", desc = "Enter the child directory" }, + + { on = [ "g", "g" ], exec = "arrow -99999999", desc = "Move cursor to the top" }, + { on = [ "G" ], exec = "arrow 99999999", desc = "Move cursor to the bottom" }, + + # Selection + { on = [ "" ], exec = [ "select --state=none", "arrow 1" ], desc = "Toggle the current selection state" }, + { on = [ "v" ], exec = "visual_mode", desc = "Enter visual mode (selection mode)" }, + { on = [ "V" ], exec = "visual_mode --unset", desc = "Enter visual mode (unset mode)" }, + { on = [ "" ], exec = "select_all --state=true", desc = "Select all files" }, + { on = [ "" ], exec = "select_all --state=none", desc = "Inverse selection of all files" }, + + # Operation + { on = [ "o" ], exec = "open", desc = "Open the selected files" }, + { on = [ "O" ], exec = "open --interactive", desc = "Open the selected files interactively" }, + { on = [ "" ], exec = "open", desc = "Open the selected files" }, + { on = [ "" ], exec = "open --interactive", desc = "Open the selected files interactively" }, # It's cool if you're using a terminal that supports CSI u + { on = [ "y" ], exec = "yank", desc = "Copy the selected files" }, + { on = [ "x" ], exec = "yank --cut", desc = "Cut the selected files" }, + { on = [ "p" ], exec = "paste", desc = "Paste the files" }, + { on = [ "P" ], exec = "paste --force", desc = "Paste the files (overwrite if the destination exists)" }, + { on = [ "-" ], exec = "link", desc = "Symlink the absolute path of files" }, + { on = [ "_" ], exec = "link --relative", desc = "Symlink the relative path of files" }, + { on = [ "d" ], exec = "remove", desc = "Move the files to the trash" }, + { on = [ "D" ], exec = "remove --permanently", desc = "Permanently delete the files" }, + { on = [ "a" ], exec = "create", desc = "Create a file or directory (ends with / for directories)" }, + { on = [ "r" ], exec = "rename", desc = "Rename a file or directory" }, + { on = [ "," ], exec = "shell", desc = "Run a shell command" }, + { on = [ ":" ], exec = "shell --block", desc = "Run a shell command (block the UI until the command finishes)" }, + { on = [ "." ], exec = "hidden toggle", desc = "Toggle the visibility of hidden files" }, + { on = [ "s" ], exec = "search fd", desc = "Search files by name using fd" }, + { on = [ "S" ], exec = "search rg", desc = "Search files by content using ripgrep" }, + { on = [ "" ], exec = "search none", desc = "Cancel the ongoing search" }, + { on = [ "z" ], exec = "jump zoxide", desc = "Jump to a directory using zoxide" }, + { on = [ "Z" ], exec = "jump fzf", desc = "Jump to a directory, or reveal a file using fzf" }, + + # Copy + { on = [ "c", "c" ], exec = "copy path", desc = "Copy the absolute path" }, + { on = [ "c", "d" ], exec = "copy dirname", desc = "Copy the path of the parent directory" }, + { on = [ "c", "f" ], exec = "copy filename", desc = "Copy the name of the file" }, + { on = [ "c", "n" ], exec = "copy name_without_ext", desc = "Copy the name of the file without the extension" }, + + # Find + { on = [ "/" ], exec = "find --smart" }, + { on = [ "?" ], exec = "find --previous --smart" }, + { on = [ "n" ], exec = "find_arrow" }, + { on = [ "N" ], exec = "find_arrow --previous" }, + + # Sorting + { on = [ ",", "a" ], exec = "sort alphabetical --dir_first", desc = "Sort alphabetically" }, + { on = [ ",", "A" ], exec = "sort alphabetical --reverse --dir_first", desc = "Sort alphabetically (reverse)" }, + { on = [ ",", "c" ], exec = "sort created --dir_first", desc = "Sort by creation time" }, + { on = [ ",", "C" ], exec = "sort created --reverse --dir_first", desc = "Sort by creation time (reverse)" }, + { on = [ ",", "m" ], exec = "sort modified --dir_first", desc = "Sort by modified time" }, + { on = [ ",", "M" ], exec = "sort modified --reverse --dir_first", desc = "Sort by modified time (reverse)" }, + { on = [ ",", "n" ], exec = "sort natural --dir_first", desc = "Sort naturally" }, + { on = [ ",", "N" ], exec = "sort natural --reverse --dir_first", desc = "Sort naturally (reverse)" }, + { on = [ ",", "s" ], exec = "sort size --dir_first", desc = "Sort by size" }, + { on = [ ",", "S" ], exec = "sort size --reverse --dir_first", desc = "Sort by size (reverse)" }, + + # Tabs + { on = [ "t" ], exec = "tab_create --current", desc = "Create a new tab using the current path" }, + + { on = [ "1" ], exec = "tab_switch 0", desc = "Switch to the first tab" }, + { on = [ "2" ], exec = "tab_switch 1", desc = "Switch to the second tab" }, + { on = [ "3" ], exec = "tab_switch 2", desc = "Switch to the third tab" }, + { on = [ "4" ], exec = "tab_switch 3", desc = "Switch to the fourth tab" }, + { on = [ "5" ], exec = "tab_switch 4", desc = "Switch to the fifth tab" }, + { on = [ "6" ], exec = "tab_switch 5", desc = "Switch to the sixth tab" }, + { on = [ "7" ], exec = "tab_switch 6", desc = "Switch to the seventh tab" }, + { on = [ "8" ], exec = "tab_switch 7", desc = "Switch to the eighth tab" }, + { on = [ "9" ], exec = "tab_switch 8", desc = "Switch to the ninth tab" }, + + { on = [ "[" ], exec = "tab_switch -1 --relative", desc = "Switch to the previous tab" }, + { on = [ "]" ], exec = "tab_switch 1 --relative", desc = "Switch to the next tab" }, + + { on = [ "{" ], exec = "tab_swap -1", desc = "Swap the current tab with the previous tab" }, + { on = [ "}" ], exec = "tab_swap 1", desc = "Swap the current tab with the next tab" }, + + # Tasks + { on = [ "w" ], exec = "tasks_show", desc = "Show the tasks manager" }, + + # Goto + { on = [ "g", "h" ], exec = "cd ~", desc = "Go to the home directory" }, + { on = [ "g","d" ], exec = "cd ~/dotfiles", desc = "Go to the dotfiles directory" }, + { on = [ "g","n" ], exec = "cd ~/dotfiles/nix", desc = "Go to the nix directory" }, + { on = [ "g","c" ], exec = "cd ~/.config/", desc = "Go to the .config directory" }, + + # Help + { on = [ "~" ], exec = "help", desc = "Open help" }, +] + +[tasks] + +keymap = [ + { on = [ "" ], exec = "close", desc = "Hide the task manager" }, + { on = [ "" ], exec = "close", desc = "Hide the task manager" }, + { on = [ "w" ], exec = "close", desc = "Hide the task manager" }, + + { on = [ "k" ], exec = "arrow -1", desc = "Move cursor up" }, + { on = [ "j" ], exec = "arrow 1", desc = "Move cursor down" }, + + { on = [ "" ], exec = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], exec = "arrow 1", desc = "Move cursor down" }, + + { on = [ "" ], exec = "inspect", desc = "Inspect the task" }, + { on = [ "x" ], exec = "cancel", desc = "Cancel the task" }, + + { on = [ "~" ], exec = "help", desc = "Open help" } +] + +[select] + +keymap = [ + { on = [ "" ], exec = "close", desc = "Cancel selection" }, + { on = [ "" ], exec = "close", desc = "Cancel selection" }, + { on = [ "" ], exec = "close --submit", desc = "Submit the selection" }, + + { on = [ "k" ], exec = "arrow -1", desc = "Move cursor up" }, + { on = [ "j" ], exec = "arrow 1", desc = "Move cursor down" }, + + { on = [ "K" ], exec = "arrow -5", desc = "Move cursor up 5 lines" }, + { on = [ "J" ], exec = "arrow 5", desc = "Move cursor down 5 lines" }, + + { on = [ "" ], exec = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], exec = "arrow 1", desc = "Move cursor down" }, + + { on = [ "~" ], exec = "help", desc = "Open help" } +] + +[input] + +keymap = [ + { on = [ "" ], exec = "close", desc = "Cancel input" }, + { on = [ "" ], exec = "close --submit", desc = "Submit the input" }, + { on = [ "" ], exec = "escape", desc = "Go back the normal mode, or cancel input" }, + { on = [ "" ], exec = "backspace" }, + + # Mode + { on = [ "i" ], exec = "insert", desc = "Enter insert mode" }, + { on = [ "a" ], exec = "insert --append", desc = "Enter append mode" }, + { on = [ "v" ], exec = "visual", desc = "Enter visual mode" }, + { on = [ "V" ], exec = [ "move -999", "visual", "move 999" ], desc = "Enter visual mode and select all" }, + + # Navigation + { on = [ "h" ], exec = "move -1", desc = "Move cursor left" }, + { on = [ "l" ], exec = "move 1", desc = "Move cursor right" }, + + { on = [ "0" ], exec = "move -999", desc = "Move to the BOL" }, + { on = [ "$" ], exec = "move 999", desc = "Move to the EOL" }, + { on = [ "I" ], exec = [ "move -999", "insert" ], desc = "Move to the BOL, and enter insert mode" }, + { on = [ "A" ], exec = [ "move 999", "insert --append" ], desc = "Move to the EOL, and enter append mode" }, + + { on = [ "" ], exec = "move -1", desc = "Move cursor left" }, + { on = [ "" ], exec = "move 1", desc = "Move cursor right" }, + + { on = [ "b" ], exec = "backward", desc = "Move to the beginning of the previous word" }, + { on = [ "w" ], exec = "forward", desc = "Move to the beginning of the next word" }, + { on = [ "e" ], exec = "forward --end-of-word", desc = "Move to the end of the next word" }, + + # Deletion + { on = [ "d" ], exec = "delete --cut", desc = "Cut the selected characters" }, + { on = [ "D" ], exec = [ "delete --cut", "move 999" ], desc = "Cut until the EOL" }, + { on = [ "c" ], exec = "delete --cut --insert", desc = "Cut the selected characters, and enter insert mode" }, + { on = [ "C" ], exec = [ "delete --cut --insert", "move 999" ], desc = "Cut until the EOL, and enter insert mode" }, + { on = [ "x" ], exec = [ "delete --cut", "move 1 --in-operating" ], desc = "Cut the current character" }, + + # Yank/Paste + { on = [ "y" ], exec = "yank", desc = "Copy the selected characters" }, + { on = [ "p" ], exec = "paste", desc = "Paste the copied characters after the cursor" }, + { on = [ "P" ], exec = "paste --before", desc = "Paste the copied characters before the cursor" }, + + # Undo/Redo + { on = [ "u" ], exec = "undo", desc = "Undo the last operation" }, + { on = [ "" ], exec = "redo", desc = "Redo the last operation" }, + + # Help + { on = [ "~" ], exec = "help", desc = "Open help" } +] + +[help] + +keymap = [ + { on = [ "" ], exec = "escape", desc = "Clear the filter, or hide the help" }, + { on = [ "q" ], exec = "close", desc = "Exit the process" }, + { on = [ "" ], exec = "close", desc = "Hide the help" }, + + # Navigation + { on = [ "k" ], exec = "arrow -1", desc = "Move cursor up" }, + { on = [ "j" ], exec = "arrow 1", desc = "Move cursor down" }, + + { on = [ "K" ], exec = "arrow -5", desc = "Move cursor up 5 lines" }, + { on = [ "J" ], exec = "arrow 5", desc = "Move cursor down 5 lines" }, + + { on = [ "" ], exec = "arrow -1", desc = "Move cursor up" }, + { on = [ "" ], exec = "arrow 1", desc = "Move cursor down" }, + + # Filtering + { on = [ "/" ], exec = "filter", desc = "Apply a filter for the help items" }, +] diff --git a/nix/modules/nixos/cli-apps/yazi/configs/theme.toml b/nix/modules/nixos/cli-apps/yazi/configs/theme.toml new file mode 100644 index 0000000..22e0f8f --- /dev/null +++ b/nix/modules/nixos/cli-apps/yazi/configs/theme.toml @@ -0,0 +1,105 @@ +[manager] +cwd = { fg = "#cad3f5" } + +# Hovered +hovered = { fg = "#24273a", bg = "#8aadf4" } +preview_hovered = { underline = true } + +# Find +find_keyword = { fg = "#eed49f", italic = true } +find_position = { fg = "#f5bde6", bg = "reset", italic = true } + +# Marker +marker_selected = { fg = "#a6da95", bg = "#a6da95" } +marker_copied = { fg = "#eed49f", bg = "#eed49f" } +marker_cut = { fg = "#ed8796", bg = "#ed8796" } + +# Tab +tab_active = { fg = "#24273a", bg = "#8aadf4" } +tab_inactive = { fg = "#cad3f5", bg = "#494d64" } +tab_width = 1 + +# Border +border_symbol = "│" +border_style = { fg = "#8aadf4" } + +# Highlighting +syntect_theme = "~/.config/bat/themes/catppuccin-macchiato.tmTheme" + +[status] +separator_open = "" +separator_close = "" +separator_style = { fg = "#494d64", bg = "#494d64" } + +# Mode +mode_normal = { fg = "#24273a", bg = "#8aadf4", bold = true } +mode_select = { fg = "#24273a", bg = "#a6da95", bold = true } +mode_unset = { fg = "#24273a", bg = "#f0c6c6", bold = true } + +# Progress +progress_label = { fg = "#ffffff", bold = true } +progress_normal = { fg = "#8aadf4", bg = "#494d64" } +progress_error = { fg = "#ed8796", bg = "#494d64" } + +# Permissions +permissions_t = { fg = "#8aadf4" } +permissions_r = { fg = "#eed49f" } +permissions_w = { fg = "#ed8796" } +permissions_x = { fg = "#a6da95" } +permissions_s = { fg = "#8087a2" } + + +[input] +border = { fg = "#8aadf4" } +title = {} +value = {} +selected = { reversed = true } + +[select] +border = { fg = "#8aadf4" } +active = { fg = "#f5bde6" } +inactive = {} + +[tasks] +border = { fg = "#8aadf4" } +title = {} +hovered = { underline = true } + +[which] +mask = { bg = "#363a4f" } +cand = { fg = "#8bd5ca" } +rest = { fg = "#939ab7" } +desc = { fg = "#f5bde6" } +separator = "  " +separator_style = { fg = "#5b6078" } + +[help] +on = { fg = "#f5bde6" } +exec = { fg = "#8bd5ca" } +desc = { fg = "#939ab7" } +hovered = { bg = "#5b6078", bold = true } +footer = { fg = "#494d64", bg = "#cad3f5" } + +[filetype] + +rules = [ + # Images + { mime = "image/*", fg = "#8bd5ca" }, + + # Videos + { mime = "video/*", fg = "#eed49f" }, + { mime = "audio/*", fg = "#eed49f" }, + + # Archives + { mime = "application/zip", fg = "#f5bde6" }, + { mime = "application/gzip", fg = "#f5bde6" }, + { mime = "application/x-tar", fg = "#f5bde6" }, + { mime = "application/x-bzip", fg = "#f5bde6" }, + { mime = "application/x-bzip2", fg = "#f5bde6" }, + { mime = "application/x-7z-compressed", fg = "#f5bde6" }, + { mime = "application/x-rar", fg = "#f5bde6" }, + + # Fallback + { name = "*", fg = "#cad3f5" }, + { name = "*/", fg = "#8aadf4" }, +] diff --git a/nix/modules/nixos/cli-apps/yazi/default.nix b/nix/modules/nixos/cli-apps/yazi/default.nix new file mode 100644 index 0000000..db91a90 --- /dev/null +++ b/nix/modules/nixos/cli-apps/yazi/default.nix @@ -0,0 +1,50 @@ +{ + config, + lib, + options, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.cli-apps.yazi; +in { + options.custom.cli-apps.yazi = { + enable = mkEnableOption "Yazi Terminal File manager"; + }; + + config = mkIf cfg.enable { + home.programs.yazi = { + enable = true; + package = pkgs.yazi; + + enableBashIntegration = true; + enableFishIntegration = true; + enableNushellIntegration = true; + enableZshIntegration = true; + + settings = { + manager = { + layout = [1 3 4]; + linemode = "size"; + show_hidden = false; + show_symlink = true; + sort_by = "alphabetical"; + sort_dir_first = true; + sort_reverse = false; + sort_sensitive = false; + }; + }; + }; + + home.configFile = { + "yazi" = { + source = lib.cleanSourceWith { + src = lib.cleanSource ./configs/.; + }; + + recursive = true; + }; + }; + }; +} diff --git a/nix/modules/nixos/desktop/addons/gtk/default.nix b/nix/modules/nixos/desktop/addons/gtk/default.nix new file mode 100644 index 0000000..c8ff7e4 --- /dev/null +++ b/nix/modules/nixos/desktop/addons/gtk/default.nix @@ -0,0 +1,36 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.gtk; +in { + options.custom.desktop.addons.gtk = with types; { + enable = mkBoolOpt false "Whether to customize GTK and apply themes."; + + home.config = mkIf cfg.enable { + gtk = { + enable = true; + theme = { + name = "Adwaita"; + package = pkgs.gnome.adwaita-icon-theme; + }; + iconTheme = { + name = "Adwaita"; + package = pkgs.gnome.adwaita-icon-theme; + }; + cursorTheme = { + name = "Adwaita"; + package = pkgs.gnome.adwaita-icon-theme; + }; + + font.name = "System-ui Regular"; + font.size = 11; + }; + }; + }; +} diff --git a/nix/modules/nixos/desktop/addons/hyprpaper/default.nix b/nix/modules/nixos/desktop/addons/hyprpaper/default.nix new file mode 100644 index 0000000..59b0bc1 --- /dev/null +++ b/nix/modules/nixos/desktop/addons/hyprpaper/default.nix @@ -0,0 +1,25 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.hyprpaper; + wallpaper = /home/sab/Pictures/cityscape2.jpg; +in { + options.custom.desktop.addons.hyprpaper = with types; { + enable = mkBoolOpt false "Whether to enable the hyprpaper config"; + }; + + config = mkIf cfg.enable { + home.file.".config/hypr/hyprpaper.conf".text = '' + preload = ${wallpaper} + wallpaper = eDP-1,${wallpaper} + wallpaper = DP-1,${wallpaper} + wallpaper = DP-2,${wallpaper} + ''; + }; +} diff --git a/nix/modules/nixos/desktop/addons/keyring/default.nix b/nix/modules/nixos/desktop/addons/keyring/default.nix new file mode 100644 index 0000000..0de778e --- /dev/null +++ b/nix/modules/nixos/desktop/addons/keyring/default.nix @@ -0,0 +1,21 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.keyring; +in { + options.custom.desktop.addons.keyring = with types; { + enable = mkBoolOpt false "Whether to enable the gnome keyring. Required to save DE passwords"; + }; + + config = mkIf cfg.enable { + services.gnome.gnome-keyring.enable = true; + + environment.systemPackages = with pkgs; [gnome.seahorse]; + }; +} diff --git a/nix/modules/nixos/desktop/addons/kitty/default.nix b/nix/modules/nixos/desktop/addons/kitty/default.nix new file mode 100644 index 0000000..34e83f2 --- /dev/null +++ b/nix/modules/nixos/desktop/addons/kitty/default.nix @@ -0,0 +1,47 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.kitty; +in { + options.custom.desktop.addons.kitty = with types; { + enable = mkBoolOpt false "Whether to enable the Kitty terminal"; + }; + + config = mkIf cfg.enable { + home.programs.kitty = { + enable = true; + font = { + name = "CaskaydiaCove Nerd Font"; + size = 14.0; + }; + + keybindings = { + "kitty_mod+e" = "kitten hints"; # https://sw.kovidgoyal.net/kitty/kittens/hints/ + "kitty_mod+f" = "toggle_fullscreen"; + "kitty_mod+c" = "copy_to_clipboard"; + }; + extraConfig = '' + mouse_map right press ungrabbed copy_to_clipboard + mouse_map middle release ungrabbed paste_from_clipboard + ''; + settings = { + disable_ligatures = "never"; + macos_option_as_alt = "yes"; + share_connections = "no"; + kitty_mod = "ctrl+shift"; + background_opacity = "0.90"; + confirm_os_window_close = 0; + + macos_quit_when_last_window_closed = "no"; + sync_to_monitor = "no"; + term = "xterm-256color"; + }; + }; + }; +} diff --git a/nix/modules/nixos/desktop/addons/mako/default.nix b/nix/modules/nixos/desktop/addons/mako/default.nix new file mode 100644 index 0000000..e4bcd3a --- /dev/null +++ b/nix/modules/nixos/desktop/addons/mako/default.nix @@ -0,0 +1,49 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.mako; +in { + options.custom.desktop.addons.mako = with types; { + enable = mkBoolOpt false "Whether to enable Mako in Sway."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [libnotify]; + home.services.mako = { + enable = true; + defaultTimeout = 5000; + font = "FiraCode Nerd Font 10"; + layer = "overlay"; + anchor = "top-right"; + maxIconSize = 32; + icons = true; + iconPath = "${pkgs.papirus-icon-theme}/share/icons/Papirus-Dark"; + borderRadius = 5; + margin = "5"; + extraConfig = '' + group-by=app-name + background-color=#FFFFFFee + text-color=#000000cc + border-color=#00000033 + border-size=1 + progress-color=source #07b5efee + + [urgency=low] + border-color=#394b70 + + [urgency=normal] + border-color=#00000033 + + [urgency=high] + border-color=#ff757f + default-timeout=0 + ''; + }; + }; +} diff --git a/nix/modules/nixos/desktop/addons/regreet/default.nix b/nix/modules/nixos/desktop/addons/regreet/default.nix new file mode 100644 index 0000000..c315a21 --- /dev/null +++ b/nix/modules/nixos/desktop/addons/regreet/default.nix @@ -0,0 +1,70 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.regreet; + greetdSwayConfig = pkgs.writeText "greetd-sway-config" '' + exec "dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP" + input "type:touchpad" { + tap enabled + } + seat seat0 xcursor_theme Bibata-Modern-Classic 24 + xwayland disable + + bindsym Mod4+shift+e exec swaynag \ + -t warning \ + -m 'What do you want to do?' \ + -b 'Poweroff' 'systemctl poweroff' \ + -b 'Reboot' 'systemctl reboot' + + exec "${lib.getExe config.programs.regreet.package} -l debug; swaymsg exit" + ''; +in { + options.custom.desktop.addons.regreet = with types; { + enable = mkBoolOpt false "Whether to enable the regreet display manager"; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + # theme packages + (catppuccin-gtk.override { + accents = ["mauve"]; + size = "compact"; + variant = "mocha"; + }) + bibata-cursors + papirus-icon-theme + ]; + programs.regreet = { + enable = true; + + settings = { + background = { + path = /home/sab/Pictures/wallpaper.png; + fit = "Cover"; + }; + GTK = { + cursor_theme_name = "Bibata-Modern-Classic"; + font_name = "FiraCode Nerd Font Regular 12"; + icon_theme_name = "Papirus-Dark"; + theme_name = "Catppuccin-Mocha-Compact-Mauve-dark"; + }; + }; + }; + + programs.sway.enable = true; + # services.greetd.settings.default_session.command = + # "${config.programs.sway.package}/bin/sway --config ${greetdSwayConfig}" + # + (lib.optionalString (config.networking.hostName == "rog") " --unsupported-gpu"); + + services.greetd.settings.default_session = { + command = "env GTK_USE_PORTAL=0 ${getExe pkgs.sway} --config ${greetdSwayConfig}"; + }; + security.pam.services.greetd.enableGnomeKeyring = true; + }; +} diff --git a/nix/modules/nixos/desktop/addons/rofi/default.nix b/nix/modules/nixos/desktop/addons/rofi/default.nix new file mode 100644 index 0000000..1135185 --- /dev/null +++ b/nix/modules/nixos/desktop/addons/rofi/default.nix @@ -0,0 +1,154 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.rofi; +in { + options.custom.desktop.addons.rofi = with types; { + enable = + mkBoolOpt false "Whether to enable Rofi in the desktop environment."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [rofi-rbw wtype]; + home.programs.rofi = { + enable = true; + package = pkgs.rofi-wayland; + plugins = with pkgs; [ + rofi-calc + ]; + extraConfig = { + combi-hide-mode-prefix = true; + combi-modi = "drun,run,calc"; + disable-history = false; + display-Network = " 󰤨 Network"; + display-drun = "  Apps "; + display-run = "  Run "; + display-window = " 﩯 Window"; + display-vpn = " VPN "; + drun-display-format = "{icon} {name}"; + icon-theme = "Fluent"; + location = 0; + modi = "run,drun,vpn:~/.config/rofi/rofi-vpn.sh,clip:~/.config/rofi/rofi-cliphist.sh,calc,"; + show-icons = true; + sidebar-mode = true; + sorting-method = "fzf"; + sort = true; + terminal = "kitty"; + font = "FiraCode Nerd Font Regular 12"; + kb-accept-custom = "Control+Return"; + kb-cancel = "Escape,Control+g,Control+bracketleft,Control+space"; + kb-row-select = "Control+Super+space"; + matching = "fuzzy"; + }; + theme = ./rofi/catppuccin-frappe.rasi; + }; + home.file.".config/rofi/rofi-vpn.sh" = { + executable = true; + text = '' + #!/usr/bin/env sh + + multiple=false + active_marker='[*] ' + + error() { + echo "''${@}" >&2 + exit 1 + } + + maybe_remove_active_marker() { + length=''$(printf '%s' "''${active_marker}" | wc -c) + if [ "''$(echo "''${1}" | cut -c "-''${length}")" = "''${active_marker}" ]; then + echo "''${1}" | cut -c ''$((length + 1))- + return 0 + fi + echo "''${1}" + return 1 + } + + disconnect_all() { + active_connections=$( + nmcli --get-values name,type connection show --active \ + | awk -F ':' ' + $2 != "vpn" && $2 != "wireguard" { next } + { print $1 } + ' + ) + if [ -z "''${active_connections}" ]; then + return + fi + echo "''${active_connections}" | xargs -d '\n' nmcli connection down \ + > /dev/null + } + + connection_list() { + nmcli --get-values name,type,active,state connection show \ + | awk -F ':' ' + ''$2 != "vpn" && ''$2 != "wireguard" { next } + ''$3 == "yes" { ''$1 = "\a" ''$1 } + { print ''$1 } + ' \ + | LC_COLLATE=C sort \ + | sed -n "s/^\a/''${active_marker}/;p" + } + + toggle_connection() { + if connection=''$(maybe_remove_active_marker "''${1}"); then + action='down' + else + action='up' + fi + if [ ''${multiple} != true ]; then + disconnect_all + if [ ''${action} = 'down' ]; then + return + fi + fi + nmcli connection "''${action}" "''${connection}" > /dev/null & + } + + run_rofi_mode() { + if [ ''${#} -eq 0 ]; then + connection_list + else + toggle_connection "''${1}" + fi + } + + "run_rofi_mode" "''${@}" + ''; + }; + home.file.".config/rofi/rofi-cliphist.sh" = { + executable = true; + text = '' + #!/usr/bin/env bash + + tmp_dir="/tmp/cliphist" + rm -rf "$tmp_dir" + + if [[ -n "$1" ]]; then + cliphist decode <<<"$1" | wl-copy + exit + fi + + mkdir -p "$tmp_dir" + + read -r -d "" prog <$tmp_dir/"grp[1]"."grp[3]) + print \$0"\0icon\x1f$tmp_dir/"grp[1]"."grp[3] + next + } + 1 + EOF + cliphist list | gawk "$prog" + ''; + }; + }; +} diff --git a/nix/nixos/home-manager/desktop/rofi/catppuccin-frappe.rasi b/nix/modules/nixos/desktop/addons/rofi/rofi/catppuccin-frappe.rasi similarity index 100% rename from nix/nixos/home-manager/desktop/rofi/catppuccin-frappe.rasi rename to nix/modules/nixos/desktop/addons/rofi/rofi/catppuccin-frappe.rasi diff --git a/nix/modules/nixos/desktop/addons/swayidle/default.nix b/nix/modules/nixos/desktop/addons/swayidle/default.nix new file mode 100644 index 0000000..64d87f5 --- /dev/null +++ b/nix/modules/nixos/desktop/addons/swayidle/default.nix @@ -0,0 +1,52 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.swayidle; +in { + options.custom.desktop.addons.swayidle = with types; { + enable = mkBoolOpt false "Whether to enable the swayidle"; + }; + + config = mkIf cfg.enable { + home.services.swayidle = { + enable = true; + + events = [ + { + event = "lock"; + command = "${pkgs.swaylock-effects}/bin/swaylock -efF"; + } + { + event = "after-resume"; + command = "${pkgs.hyprland}/bin/hyprctl dispatch dpms on"; + } + { + event = "before-sleep"; + command = "${pkgs.swaylock-effects}/bin/swaylock -efF"; + } + ]; + # 5 min lock, 10min turn the screen off, 20 min suspend + timeouts = [ + { + timeout = 300; + command = "${pkgs.swaylock-effects}/bin/swaylock -efF -C ~/.config/swaylock/config"; + } + { + timeout = 600; + command = "${pkgs.hyprland}/bin/hyprctl dispatch dpms off"; + resumeCommand = "${pkgs.hyprland}/bin/hyprctl dispatch dpms on"; + } + { + timeout = 1200; + command = "${pkgs.systemd}/bin/systemctl suspend"; + } + ]; + }; + }; +} diff --git a/nix/modules/nixos/desktop/addons/swaylock/default.nix b/nix/modules/nixos/desktop/addons/swaylock/default.nix new file mode 100644 index 0000000..acad238 --- /dev/null +++ b/nix/modules/nixos/desktop/addons/swaylock/default.nix @@ -0,0 +1,61 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.swaylock; +in { + options.custom.desktop.addons.swaylock = with types; { + enable = mkBoolOpt false "Whether to enable the swaylock"; + }; + + config = mkIf cfg.enable { + home.programs.swaylock = { + enable = true; + package = pkgs.swaylock-effects; + settings = { + image = "$HOME/Pictures/wallpaper.png"; + color = "000000ff"; + font-size = "24"; + indicator-idle-visible = true; + clock = true; + timestr = "%H:%M"; + datestr = "%A, %d %B"; + + indicator = true; + indicator-radius = "100"; + indicator-thickness = "10"; + + effect-blur = "30x2"; + effect-vignette = "0.5:0.5"; + + text-color = "cdd6f4"; + text-clear-color = "11111b"; + text-ver-color = "11111b"; + text-wrong-color = "11111b"; + + ring-color = "1e1e2e"; + key-hl-color = "f5c2e7"; + line-color = "f5c2e7"; + inside-color = "00000088"; + separator-color = "00000000"; + + inside-clear-color = "f2cdcd88"; + line-clear-color = "f2cdcd"; + ring-clear-color = "f2cdcd"; + + inside-ver-color = "89dceb88"; + line-ver-color = "89dceb"; + ring-ver-color = "89dceb"; + + inside-wrong-color = "f38ba888"; + line-wrong-color = "f38ba8"; + ring-wrong-color = "f38ba8"; + }; + }; + }; +} diff --git a/nix/modules/nixos/desktop/addons/waybar/default.nix b/nix/modules/nixos/desktop/addons/waybar/default.nix new file mode 100644 index 0000000..84e6b5d --- /dev/null +++ b/nix/modules/nixos/desktop/addons/waybar/default.nix @@ -0,0 +1,165 @@ + +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.waybar; + hyprctl = "${pkgs.hyprland}/bin/hyprctl"; + blueberry = "${pkgs.blueberry}/bin/blueberry"; +in { + options.custom.desktop.addons.waybar = with types; { + enable = + mkBoolOpt false "Whether to enable Waybar in the desktop environment."; + }; + + config = mkIf cfg.enable { + home.programs.waybar = { + enable = true; + package = pkgs.waybar; + + systemd = { + enable = false; + target = "hyprland-session.target"; + }; + + style = pkgs.substituteAll { + src = ./style.css; + }; + + settings = { + mainBar = { + layer = "top"; + position = "top"; + margin = "10 10 0 10"; + + modules-left = [ + "hyprland/workspaces" + "hyprland/window" + ]; + + modules-center = [ + "clock" + ]; + modules-right = [ + "hyprland/language" + "cpu" + "memory" + "temperature" + "pulseaudio" + "bluetooth" + "network" + "tray" + "battery" + "custom/power" + ]; + + bluetooth = { + "format" = "󰂯"; + "format-disabled" = "󰂲"; + "format-connected" = "󰂱"; + "tooltip-format" = "{controller_alias}\t{controller_address}"; + "tooltip-format-connected" = "{controller_alias}\t{controller_address}\n\n{device_enumerate}"; + "tooltip-format-enumerate-connected" = "{device_alias}\t\t{device_address}"; + "on-click" = "blueberry"; + }; + + "hyprland/workspaces" = { + format = "{icon}"; + on-click = "activate"; + all-outputs = true; + format-icons = { + "urgent" = " "; + "active" = " "; + "default" = " "; + }; + }; + + "hyprland/window" = { + max-length = 25; + separate-outputs = true; + }; + "cpu" = { + format = "󰌢 {load}"; + tooltip = false; + on-click = "gnome-system-monitor"; + }; + "memory" = { + format = " {}%"; + }; + "disk" = { + interval = 600; + format = " {percentage_used}%"; + path = "/"; + }; + "clock" = { + format = " {:%b %d %H:%M}"; + tooltip-format = "{:%Y %B}\n\n{calendar}"; + format-alt = "{:%Y-%m-%d}"; + }; + "temperature" = { + thermal-zone = 0; + critical-threshold = 80; + format = "{icon} {temperatureC}°C"; + format-icons = ["" "" "" "" ""]; + }; + "custom/kernel" = { + interval = "once"; + format = " {}"; + exec = "uname -r"; + }; + network = { + format-wifi = "󰖩 {signalStrength}%"; + format-ethernet = "{ifname}: {ipaddr}/{cidr} 󰈀"; + format-linked = "{ifname} (No IP) 󰈀"; + format-disconnected = "󰖪"; + format-alt = " 󰜮 {bandwidthDownBytes} 󰜷 {bandwidthUpBytes}"; + }; + pulseaudio = { + scroll-step = 5; + tooltip = true; + tooltip-format = "{volume}% {format_source}"; + on-click-right = "${pkgs.pavucontrol}/bin/pavucontrol"; + on-click = "${pkgs.pamixer}/bin/pamixer -t"; + format = "{icon} {volume}%"; + format-bluetooth = "󰂯 {icon} {volume}%"; + format-muted = "󰝟 0%"; + format-icons = { + default = ["" "" " "]; + }; + }; + "hyprland/language" = { + # "format-dh" = " dh"; + "format-en" = " dh"; + "format-ru" = " ru"; + "keyboard-name" = "at-translated-set-2-keyboard"; + on-click = "${hyprctl} switchxkblayout at-translated-set-2-keyboard next"; + }; + "battery" = { + # on-click = "cpupower-gui"; + bat = "BAT0"; + states = { + "good" = 95; + "warning" = 30; + "critical" = 15; + }; + format = "{icon} {capacity}%"; + format-charging = " {capacity}%"; + format-plugged = " {capacity}%"; + format-alt = "{time} {icon}"; + format-icons = [" " " " " " " " " "]; + }; + "tray" = {spacing = 10;}; + "custom/power" = { + format = ""; + on-click = "wlogout -p layer-shell"; + }; + }; + }; + }; + }; +} diff --git a/nix/nixos/home-manager/desktop/waybar/waybar.css b/nix/modules/nixos/desktop/addons/waybar/style.css similarity index 100% rename from nix/nixos/home-manager/desktop/waybar/waybar.css rename to nix/modules/nixos/desktop/addons/waybar/style.css diff --git a/nix/modules/nixos/desktop/addons/wezterm/colors.lua b/nix/modules/nixos/desktop/addons/wezterm/colors.lua new file mode 100644 index 0000000..74eae89 --- /dev/null +++ b/nix/modules/nixos/desktop/addons/wezterm/colors.lua @@ -0,0 +1,48 @@ +local base16_colors = { + bg = "#1B2B34", + bg_dark = "#343D46", + bg_highlight = "#4F5B66", + comment = "#65737E", + fg_dark = "#A7ADBA", + fg = "#C0C5CE", + fg_gutter = "#CDD3DE", + fg_light = "#D8DEE9", -- TODO: this doesn't make sesne + + red = "#EC5f67", + orange = "#F99157", + yellow = "#FAC863", + green = "#99C794", + green_dark = "#11ab49", + cyan = "#5FB3B3", + blue = "#6699CC", + purple = "#C594C5", + magenta = "#C594C5", + black = "#000000", + white = "#dedcdc", +} + +-- config.color_scheme = "Oceanic-Next" +command_palette_bg_color = base16_colors.black +-- https://wezfurlong.org/wezterm/config/appearance.html#retro-tab-bar-appearance +config.colors = { + -- The default text color + foreground = base16_colors.white, + -- The default background color + background = base16_colors.black, + tab_bar = { + background = base16_colors.black, + active_tab = { + bg_color = base16_colors.green_dark, + fg_color = base16_colors.fg, + }, + inactive_tab = { + -- bg_color = base16_colors.bg_dark, + bg_color = base16_colors.bg_dark, + fg_color = base16_colors.fg_dark, + }, + new_tab = { + bg_color = base16_colors.bg_dark, + fg_color = base16_colors.fg_dark, + }, + }, +} diff --git a/nix/modules/nixos/desktop/addons/wezterm/default.nix b/nix/modules/nixos/desktop/addons/wezterm/default.nix new file mode 100644 index 0000000..d3c841e --- /dev/null +++ b/nix/modules/nixos/desktop/addons/wezterm/default.nix @@ -0,0 +1,31 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.wezterm; +in { + options.custom.desktop.addons.wezterm = with types; { + enable = mkBoolOpt false "Whether to enable the wezterm terminal"; + }; + + config = mkIf cfg.enable { + home.programs.wezterm = { + enable = true; + extraConfig = + # Generate wezterm.lua; order of files are important + (builtins.readFile ./wezterm.lua) + + (builtins.readFile ./mappings.lua) + + (builtins.readFile ./colors.lua) + + (builtins.readFile ./tabs.lua) + + (builtins.readFile ./events.lua) + + '' + return config + ''; + }; + }; +} diff --git a/nix/modules/nixos/desktop/addons/wezterm/events.lua b/nix/modules/nixos/desktop/addons/wezterm/events.lua new file mode 100644 index 0000000..ff4e368 --- /dev/null +++ b/nix/modules/nixos/desktop/addons/wezterm/events.lua @@ -0,0 +1,35 @@ +-- Update window title +-- {{{ +wezterm.on("format-window-title", function(tab, _, tabs) + local index = "" + if #tabs > 1 then + index = "[" .. tab.tab_index + 1 .. "/" .. #tabs .. "]" + end + + return index .. tab.window_title +end) +-- }}} +-- Update status on the right side +-- {{{ +-- Icons: https://wezfurlong.org/wezterm/config/lua/wezterm/nerdfonts.html +-- https://wezfurlong.org/wezterm/config/lua/window-events/update-right-status.html +wezterm.on("update-right-status", function(window) + local _, kube_context, _ = wezterm.run_child_process { "bash", "-lc", "kubectx -c" } + local _, kube_ns, _ = wezterm.run_child_process { "bash", "-lc", "kubens -c" } + kube_context = kube_context:gsub("[\n\r]", "") + kube_ns = kube_ns:gsub("[\n\r]", "") + + local date = wezterm.strftime "[%H:%M]" + + window:set_right_status(wezterm.format { + { Foreground = { Color = base16_colors.blue } }, + { Text = wezterm.nerdfonts.md_kubernetes }, + { Foreground = { Color = base16_colors.magenta } }, + { Text = " " .. kube_context }, + { Foreground = { Color = base16_colors.cyan } }, + { Text = ":" .. kube_ns }, + { Foreground = { Color = base16_colors.red } }, + { Text = " " .. date }, + }) +end) +-- }}} diff --git a/nix/modules/nixos/desktop/addons/wezterm/mappings.lua b/nix/modules/nixos/desktop/addons/wezterm/mappings.lua new file mode 100644 index 0000000..c12e911 --- /dev/null +++ b/nix/modules/nixos/desktop/addons/wezterm/mappings.lua @@ -0,0 +1,58 @@ +local act = wezterm.action + +config.leader = { key = "b", mods = "CTRL" } + +config.keys = { + { + key = "-", + mods = "ALT", + action = act.SplitVertical { domain = "CurrentPaneDomain" }, + }, + { + key = "=", + mods = "ALT", + action = act.SplitHorizontal { domain = "CurrentPaneDomain" }, + }, + { + key = "w", + mods = "SHIFT|ALT", + action = act.CloseCurrentPane { confirm = true }, + }, + { key = "X", mods = "LEADER", action = act.ActivateCopyMode }, + { key = "p", mods = "LEADER", action = act.ActivateTabRelative(-1) }, + { key = "n", mods = "LEADER", action = act.ActivateTabRelative(1) }, + + { key = "a", mods = "LEADER|CTRL", action = wezterm.action { SendString = "\x01" } }, + { key = "-", mods = "LEADER", action = wezterm.action { SplitVertical = { domain = "CurrentPaneDomain" } } }, + { key = "\\", mods = "LEADER", action = wezterm.action { SplitHorizontal = { domain = "CurrentPaneDomain" } } }, + { key = "s", mods = "LEADER", action = wezterm.action { SplitVertical = { domain = "CurrentPaneDomain" } } }, + { key = "v", mods = "LEADER", action = wezterm.action { SplitHorizontal = { domain = "CurrentPaneDomain" } } }, + { key = "z", mods = "LEADER", action = "TogglePaneZoomState" }, + { key = "c", mods = "LEADER", action = wezterm.action { SpawnTab = "CurrentPaneDomain" } }, + { key = "h", mods = "LEADER", action = wezterm.action { ActivatePaneDirection = "Left" } }, + { key = "j", mods = "LEADER", action = wezterm.action { ActivatePaneDirection = "Down" } }, + { key = "k", mods = "LEADER", action = wezterm.action { ActivatePaneDirection = "Up" } }, + { key = "l", mods = "LEADER", action = wezterm.action { ActivatePaneDirection = "Right" } }, + { key = "H", mods = "LEADER|SHIFT", action = wezterm.action { AdjustPaneSize = { "Left", 5 } } }, + { key = "J", mods = "LEADER|SHIFT", action = wezterm.action { AdjustPaneSize = { "Down", 5 } } }, + { key = "K", mods = "LEADER|SHIFT", action = wezterm.action { AdjustPaneSize = { "Up", 5 } } }, + { key = "L", mods = "LEADER|SHIFT", action = wezterm.action { AdjustPaneSize = { "Right", 5 } } }, + { key = "1", mods = "LEADER", action = wezterm.action { ActivateTab = 0 } }, + { key = "2", mods = "LEADER", action = wezterm.action { ActivateTab = 1 } }, + { key = "3", mods = "LEADER", action = wezterm.action { ActivateTab = 2 } }, + { key = "4", mods = "LEADER", action = wezterm.action { ActivateTab = 3 } }, + { key = "5", mods = "LEADER", action = wezterm.action { ActivateTab = 4 } }, + { key = "6", mods = "LEADER", action = wezterm.action { ActivateTab = 5 } }, + { key = "7", mods = "LEADER", action = wezterm.action { ActivateTab = 6 } }, + { key = "8", mods = "LEADER", action = wezterm.action { ActivateTab = 7 } }, + { key = "9", mods = "LEADER", action = wezterm.action { ActivateTab = 8 } }, + { key = "d", mods = "LEADER", action = wezterm.action { CloseCurrentPane = { confirm = true } } }, +} + +config.mouse_bindings = { + { + event = { Down = { streak = 1, button = "Right" } }, + mods = "NONE", + action = act.PasteFrom "PrimarySelection", + }, +} diff --git a/nix/modules/nixos/desktop/addons/wezterm/tabs.lua b/nix/modules/nixos/desktop/addons/wezterm/tabs.lua new file mode 100644 index 0000000..fe6e638 --- /dev/null +++ b/nix/modules/nixos/desktop/addons/wezterm/tabs.lua @@ -0,0 +1,108 @@ +local arrow_solid = "" +local arrow_thin = "" +local icons = { + ["C:\\WINDOWS\\system32\\cmd.exe"] = wezterm.nerdfonts.md_console_line, + ["Topgrade"] = wezterm.nerdfonts.md_rocket_launch, + ["bash"] = wezterm.nerdfonts.cod_terminal_bash, + ["btm"] = wezterm.nerdfonts.mdi_chart_donut_variant, + ["btop"] = wezterm.nerdfonts.md_chart_areaspline, + ["cargo"] = wezterm.nerdfonts.dev_rust, + ["curl"] = wezterm.nerdfonts.mdi_flattr, + ["docker"] = wezterm.nerdfonts.linux_docker, + ["docker-compose"] = wezterm.nerdfonts.linux_docker, + ["fish"] = wezterm.nerdfonts.md_fish, + ["gh"] = wezterm.nerdfonts.dev_github_badge, + ["git"] = wezterm.nerdfonts.dev_git, + ["go"] = wezterm.nerdfonts.seti_go, + ["htop"] = wezterm.nerdfonts.md_chart_areaspline, + ["kubectl"] = wezterm.nerdfonts.md_kubernetes, + ["k9s"] = wezterm.nerdfonts.md_kubernetes, + ["kuberlr"] = wezterm.nerdfonts.linux_docker, + ["lazydocker"] = wezterm.nerdfonts.linux_docker, + ["lazygit"] = wezterm.nerdfonts.cod_github, + ["lua"] = wezterm.nerdfonts.seti_lua, + ["make"] = wezterm.nerdfonts.seti_makefile, + ["node"] = wezterm.nerdfonts.mdi_hexagon, + ["nvim"] = wezterm.nerdfonts.linux_neovim, + ["nix"] = wezterm.nerdfonts.md_nix, + ["nixt"] = wezterm.nerdfonts.md_nix, + ["psql"] = wezterm.nerdfonts.dev_postgresql, + ["pwsh.exe"] = wezterm.nerdfonts.md_console, + ["ruby"] = wezterm.nerdfonts.cod_ruby, + ["sudo"] = wezterm.nerdfonts.fa_hashtag, + ["vim"] = wezterm.nerdfonts.linux_neovim, + ["wget"] = wezterm.nerdfonts.mdi_arrow_down_box, + ["zsh"] = wezterm.nerdfonts.dev_terminal, +} + +---@param tab MuxTabObj +---@param max_width number +local function title(tab, max_width) + local title = (tab.tab_title and #tab.tab_title > 0) and tab.tab_title or tab.active_pane.title + local process, other = title:match "^(%S+)%s*%-?%s*%s*(.*)$" + + if icons[process] then + title = icons[process] .. " " .. (other or "") + end + + local is_zoomed = false + for _, pane in ipairs(tab.panes) do + if pane.is_zoomed then + is_zoomed = true + break + end + end + if is_zoomed then -- or (#tab.panes > 1 and not tab.is_active) then + title = " " .. title + end + + title = wezterm.truncate_right(title, max_width - 3) + return " " .. title .. " " +end + +wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width) + local title = title(tab, max_width) + local colors = config.resolved_palette + local active_bg = colors.tab_bar.active_tab.bg_color + local inactive_bg = colors.tab_bar.inactive_tab.bg_color + + local tab_idx = 1 + for i, t in ipairs(tabs) do + if t.tab_id == tab.tab_id then + tab_idx = i + break + end + end + -- local tab_idx = tab.tab_index + 1 + local is_last = tab_idx == #tabs + local next_tab = tabs[tab_idx + 1] + local next_is_active = next_tab and next_tab.is_active + local arrow = (tab.is_active or is_last or next_is_active) and arrow_solid or arrow_thin + local arrow_bg = inactive_bg + local arrow_fg = colors.tab_bar.inactive_tab_edge + + if is_last then + arrow_bg = colors.tab_bar.background + arrow_fg = tab.is_active and active_bg or inactive_bg + elseif tab.is_active then + arrow_bg = inactive_bg + arrow_fg = active_bg + elseif next_is_active then + arrow_bg = active_bg + arrow_fg = inactive_bg + end + + local ret = tab.is_active + and { + { Attribute = { Intensity = "Bold" } }, + -- { Attribute = { Italic = true } }, + } + or {} + + ret[#ret + 1] = { Text = " " .. tab_idx .. ":" .. title } + + ret[#ret + 1] = { Foreground = { Color = arrow_fg } } + ret[#ret + 1] = { Background = { Color = arrow_bg } } + ret[#ret + 1] = { Text = arrow } + return ret +end) diff --git a/nix/modules/nixos/desktop/addons/wezterm/wezterm.lua b/nix/modules/nixos/desktop/addons/wezterm/wezterm.lua new file mode 100644 index 0000000..8e006df --- /dev/null +++ b/nix/modules/nixos/desktop/addons/wezterm/wezterm.lua @@ -0,0 +1,49 @@ +-- https://github.com/pjcj/base/blob/2f036f8bb616a5b3dabf8314ae9eb6d574a83e32/.wezterm.lua#L406 +-- +local wezterm = require "wezterm" +local config = {} + +if wezterm.config_builder then + config = wezterm.config_builder() +end + +-- Fonts +-- {{{ +config.adjust_window_size_when_changing_font_size = false + +config.font = wezterm.font_with_fallback { + "CaskaydiaCove Nerd Font Mono", + { family = "Symbols Nerd Font Mono", scale = 0.9 }, + { family = "DejaVu Sans", weight = "Regular", scale = 0.75 }, +} +config.font_size = 14 +-- }}} +-- Windows +-- {{{ +config.window_close_confirmation = "AlwaysPrompt" +config.window_padding = { + left = 0, + right = 0, + top = 1, + bottom = 0, +} +config.window_background_opacity = 0.9 +-- }}} +-- Cursor +-- {{{ +config.cursor_blink_rate = 1000 +config.default_cursor_style = "BlinkingBlock" +config.hide_mouse_cursor_when_typing = false +config.xcursor_theme = "Adwaita" +-- }}} +-- Tabs +-- {{{ +config.use_fancy_tab_bar = false +config.tab_max_width = 32 +config.hide_tab_bar_if_only_one_tab = false +config.tab_bar_at_bottom = true +config.inactive_pane_hsb = { + saturation = 0.9, + brightness = 0.2, +} +-- }}} diff --git a/nix/modules/nixos/desktop/addons/wlogout/default.nix b/nix/modules/nixos/desktop/addons/wlogout/default.nix new file mode 100644 index 0000000..12e88f6 --- /dev/null +++ b/nix/modules/nixos/desktop/addons/wlogout/default.nix @@ -0,0 +1,21 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.wlogout; +in { + options.custom.desktop.addons.wlogout = with types; { + enable = mkBoolOpt false "Whether to enable the wlogout"; + }; + + config = mkIf cfg.enable { + home.programs.wlogout = { + enable = true; + }; + }; +} diff --git a/nix/modules/nixos/desktop/addons/xdg-portal/default.nix b/nix/modules/nixos/desktop/addons/xdg-portal/default.nix new file mode 100644 index 0000000..710e90e --- /dev/null +++ b/nix/modules/nixos/desktop/addons/xdg-portal/default.nix @@ -0,0 +1,30 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.xdg-portal; +in { + options.custom.desktop.addons.xdg-portal = with types; { + enable = mkBoolOpt false "Whether or not to add support for xdg portal."; + }; + + config = mkIf cfg.enable { + xdg = { + autostart.enable = true; + portal = { + enable = true; + extraPortals = with pkgs; [ + # Only one hyprland portal must be enabled, otherwise screen sharing brokes + # xdg-desktop-portal + xdg-desktop-portal-hyprland + ]; + # gtkUsePortal = true; + }; + }; + }; +} diff --git a/nix/modules/nixos/desktop/hyprland/default.nix b/nix/modules/nixos/desktop/hyprland/default.nix new file mode 100644 index 0000000..561ab5a --- /dev/null +++ b/nix/modules/nixos/desktop/hyprland/default.nix @@ -0,0 +1,93 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.hyprland; +in { + options.custom.desktop.hyprland = with types; { + enable = mkBoolOpt false "Whether or not to install Hyprland and dependencies."; + }; + + config = mkIf cfg.enable { + custom.desktop.addons = { + # electron-support = enabled; + # hyprpicker = enabled; + keyring = enabled; + # nautilus = enabled; + # thunar = enabled; + gtk = enabled; + hyprpaper = enabled; + kitty = enabled; + mako = enabled; + regreet = enabled; + rofi = enabled; + swayidle = enabled; + swaylock = enabled; + waybar = enabled; + wezterm = enabled; + wlogout = enabled; + xdg-portal = enabled; + }; + + home.configFile."hypr/hyprland.conf".source = ./hyprland.conf; + + environment.systemPackages = with pkgs; [ + hyprland + hyprland-protocols + hyprpaper + hyprpicker + + wlroots + cliphist + wl-clipboard + + grim + slurp + networkmanagerapplet + + adwaita-qt + adwaita-qt6 + gnome.adwaita-icon-theme + gnome.gnome-tweaks + ]; + + environment.sessionVariables = { + POLKIT_AUTH_AGENT = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; + GSETTINGS_SCHEMA_DIR = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}/glib-2.0/schemas"; + XDG_SESSION_TYPE = "wayland"; + NIXOS_OZONE_WL = "1"; + MOZ_ENABLE_WAYLAND = "1"; + SDL_VIDEODRIVER = "wayland"; + CLUTTER_BACKEND = "wayland"; + XDG_CURRENT_DESKTOP = "Hyprland"; + XDG_SESSION_DESKTOP = "Hyprland"; + XDG_SCREENSHOTS_DIR = "~/Pictures/Screenshots"; + }; + + programs.hyprland = { + enable = true; + xwayland.enable = true; + }; + + services.xserver = { + enable = true; + + displayManager = { + defaultSession = "hyprland"; + + # gdm = { + # enable = true; + # wayland = true; + # }; + }; + + # Enable touchpad support (enabled default in most desktopManager). + libinput.enable = true; + }; + }; +} diff --git a/nix/nixos/home-manager/desktop/hypr/hyprland.conf b/nix/modules/nixos/desktop/hyprland/hyprland.conf similarity index 78% rename from nix/nixos/home-manager/desktop/hypr/hyprland.conf rename to nix/modules/nixos/desktop/hyprland/hyprland.conf index f153c21..fd25f65 100644 --- a/nix/nixos/home-manager/desktop/hypr/hyprland.conf +++ b/nix/modules/nixos/desktop/hyprland/hyprland.conf @@ -1,8 +1,8 @@ - autogenerated = 0 # remove this line to remove the warning # See https://wiki.hyprland.org/Configuring/Monitors/ monitor=,preferred,auto,auto +monitor=HDMI-A-1, 1920x1080, 0x0, 1 # See https://wiki.hyprland.org/Configuring/Keywords/ for more @@ -11,12 +11,10 @@ monitor=,preferred,auto,auto # exec-once = waybar & hyprpaper & firefox exec-once = mako exec-once = waybar -exec-once = copyq --start-server -exec-once = swayidle -w timeout 500 'swaylock' timeout 900 'systemctl suspend' before-sleep 'swaylock' +exec-once = wl-paste --watch cliphist store exec-once = hyprpaper exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP exec = nm-applet --indicator -# exec = blueman-applet --indicator # Source a file (multi-file configs) # source = ~/.config/hypr/myColors.conf @@ -35,8 +33,8 @@ input { kb_layout = dh,ru # kb_variant = ,,, # kb_model = - # kb_options = caps:none, grp:caps_toggle,grp:win_space_toggle, caps:escape - kb_options = caps:none,grp:win_space_toggle,caps:escape + kb_options = grp:caps_toggle + # kb_options = grp:win_space_toggle,caps:swapescape kb_rules = follow_mouse = 1 @@ -126,25 +124,37 @@ device:epic-mouse-v1 { $mainMod = SUPER # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more -bind = $mainMod, T, exec, kitty -bind = $mainMod, X, exec, kitty +bind = $mainMod, X, exec, wezterm bind = $mainMod, Q, killactive, bind = $mainMod, M, exit, bind = $mainMod, B, exec, firefox bind = $mainMod, F, fullscreen, bind = $mainMod, V, togglefloating, bind = $mainMod, R, exec, rofi -show drun -bind = $mainMod, L, exec, swaylock -f -bind = $mainMod, P, pseudo, # dwindle +bind = $mainMod, C, exec, rofi -show clip +bind = $mainMod, P, exec, rofi-rbw +bind = $mainMod, Z, exec, rofi -dmenu -p \"Search\" | xargs -I{} xdg-open "https://www.google.com/search?q={}" && hyprctl dispatch focuswindow firefox +bind = $mainMod SHIFT, L, exec, swaylock -f +bind = $mainMod, U, pseudo, # dwindle bind = $mainMod, J, togglesplit, # dwindle -bind = $mainMod, P, exec, wlogout -bind = $mainMod, E, exec, kitty nvim ~/dotfiles/nix/hypr/hyprland.conf +bind = $mainMod SHIFT, P, exec, wlogout +bind = $mainMod, E, exec, kitty nvim ~/dotfiles/nix/nixos/home-manager/desktop/hypr/hyprland.conf # Move focus with mainMod + arrow keys bind = $mainMod, left, movefocus, l bind = $mainMod, right, movefocus, r bind = $mainMod, up, movefocus, u bind = $mainMod, down, movefocus, d +bind = $mainMod, h, movefocus, l +bind = $mainMod, l, movefocus, r +bind = $mainMod, k, movefocus, u +bind = $mainMod, j, movefocus, d + +# Swap windows with mainMod + shift + arrow +bind = CONTROLALT, h, swapwindow, l +bind = CONTROLALT, l, swapwindow, r +bind = CONTROLALT, k, swapwindow, u +bind = CONTROLALT, j, swapwindow, d # Switch workspaces with mainMod + [0-9] bind = $mainMod, 1, workspace, 1 @@ -170,6 +180,8 @@ bind = $mainMod SHIFT, 8, movetoworkspace, 8 bind = $mainMod SHIFT, 9, movetoworkspace, 9 bind = $mainMod SHIFT, 0, movetoworkspace, 10 +bind = $mainMod CONTROL, left, movecurrentworkspacetomonitor, l +bind = $mainMod CONTROL, right, movecurrentworkspacetomonitor, r # Scroll through existing workspaces with mainMod + scroll bind = $mainMod, mouse_down, workspace, e+1 bind = $mainMod, mouse_up, workspace, e-1 @@ -191,8 +203,9 @@ bind=, XF86AudioPrev, exec, playerctl previous bind = , XF86MonBrightnessUp, exec, brightnessctl s 5%+ bind = , XF86MonBrightnessDown, exec, brightnessctl s 5%- -bind = $mainMod, C, exec, copyq menu -bind = $mainMod SHIFT, C, exec, copyq show - -bind = ,Print, exec, grim -g "$(slurp)" -bind = SHIFT, Print, exec, grim +# Screenshot a region and output to Pictures +bind = ,Print, exec, grim -g "$(slurp)" ~/Pictures/Screenshots/$(date +'ss_%s.png') +# Screenshot a region and output clipboard +bind = CONTROL, Print, exec, grim -g "$(slurp)" - | wl-copy +# Screenshot full screen +bind = SHIFT, Print, exec, grim ~/Pictures/Screenshots/$(date +'ss_%s.png') diff --git a/nix/modules/nixos/hardware/audio/default.nix b/nix/modules/nixos/hardware/audio/default.nix new file mode 100644 index 0000000..ff0c1db --- /dev/null +++ b/nix/modules/nixos/hardware/audio/default.nix @@ -0,0 +1,33 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.hardware.audio; +in { + options.hardware.audio = with types; { + enable = mkBoolOpt false "Enable pipewire"; + }; + + config = mkIf cfg.enable { + security.rtkit.enable = true; + services.pipewire = { + alsa.enable = true; + alsa.support32Bit = true; + enable = true; + jack.enable = false; + pulse.enable = true; + wireplumber.enable = true; + }; + programs.noisetorch.enable = true; + + environment.systemPackages = with pkgs; [ + pamixer + pavucontrol + ]; + }; +} diff --git a/nix/modules/nixos/hardware/bluetoothmy/default.nix b/nix/modules/nixos/hardware/bluetoothmy/default.nix new file mode 100644 index 0000000..96ea175 --- /dev/null +++ b/nix/modules/nixos/hardware/bluetoothmy/default.nix @@ -0,0 +1,20 @@ +{ + options, + config, + pkgs, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.hardware.bluetoothmy; +in { + options.hardware.bluetoothmy = with types; { + enable = mkBoolOpt false "Whether or not to enable bluetooth support."; + }; + + config = mkIf cfg.enable { + hardware.bluetooth.enable = true; + environment.systemPackages = with pkgs; [blueberry]; + }; +} diff --git a/nix/modules/nixos/hardware/fingerprint/default.nix b/nix/modules/nixos/hardware/fingerprint/default.nix new file mode 100644 index 0000000..f24fd5d --- /dev/null +++ b/nix/modules/nixos/hardware/fingerprint/default.nix @@ -0,0 +1,38 @@ +{ + options, + config, + pkgs, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.hardware.fingerprint; +in { + options.hardware.fingerprint = with types; { + enable = mkBoolOpt false "Whether or not to enable fingerprint support."; + }; + + config = mkIf cfg.enable { + services.fprintd.enable = true; + + security.pam.services.swaylock.text = '' + # Account management. + account required pam_unix.so + + # Authentication management. + + # prompt for a password; pressing Enter on a blank field will proceed to fingerprint authentication. + auth sufficient pam_unix.so nullok likeauth try_first_pass + auth sufficient ${pkgs.fprintd}/lib/security/pam_fprintd.so + auth required pam_deny.so + + # Password management. + password sufficient pam_unix.so nullok sha512 + + # Session management. + session required pam_env.so conffile=/etc/pam/environment readenv=0 + session required pam_unix.so + ''; + }; +} diff --git a/nix/modules/nixos/hardware/networking/default.nix b/nix/modules/nixos/hardware/networking/default.nix new file mode 100644 index 0000000..ac4fe14 --- /dev/null +++ b/nix/modules/nixos/hardware/networking/default.nix @@ -0,0 +1,41 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.hardware.networking; +in { + options.hardware.networking = with types; { + enable = mkBoolOpt false "Enable NetworkManager"; + hosts = + mkOpt attrs {} + (mdDoc "An attribute set to merge with `networking.hosts`"); + }; + + config = mkIf cfg.enable { + networking = { + networkmanager.enable = true; + enableIPv6 = false; + wireguard.enable = true; + firewall.enable = false; + hosts = + { + "127.0.0.1" = ["local.test"] ++ (cfg.hosts."127.0.0.1" or []); + } + // cfg.hosts; + }; + systemd.services.NetworkManager-wait-online.enable = false; + services.wg-netmanager.enable = true; + environment.systemPackages = with pkgs; [networkmanager-l2tp gnome.networkmanager-l2tp]; + services.strongswan = { + enable = true; + secrets = [ + "ipsec.d/ipsec.nm-l2tp.secrets" + ]; + }; + }; +} diff --git a/nix/modules/nixos/home/default.nix b/nix/modules/nixos/home/default.nix new file mode 100644 index 0000000..d69ec10 --- /dev/null +++ b/nix/modules/nixos/home/default.nix @@ -0,0 +1,43 @@ +{ + options, + config, + lib, + inputs, + ... +}: +with lib; +with lib.custom; { + imports = with inputs; [ + home-manager.nixosModules.home-manager + ]; + + options.home = with types; { + file = + mkOpt attrs {} + "A set of files to be managed by home-manager's ."; + configFile = + mkOpt attrs {} + "A set of files to be managed by home-manager's ."; + programs = mkOpt attrs {} "Programs to be managed by home-manager."; + services = mkOpt attrs {} "Services to be managed by home-manager."; + extraOptions = mkOpt attrs {} "Options to pass directly to home-manager."; + }; + + config = { + home.extraOptions = { + home.stateVersion = config.system.stateVersion; + home.file = mkAliasDefinitions options.home.file; + xdg.enable = true; + xdg.configFile = mkAliasDefinitions options.home.configFile; + programs = mkAliasDefinitions options.home.programs; + services = mkAliasDefinitions options.home.services; + }; + + home-manager = { + useUserPackages = true; + + users.${config.custom.user.name} = + mkAliasDefinitions options.home.extraOptions; + }; + }; +} diff --git a/nix/modules/nixos/services/ssh/default.nix b/nix/modules/nixos/services/ssh/default.nix new file mode 100644 index 0000000..348fec2 --- /dev/null +++ b/nix/modules/nixos/services/ssh/default.nix @@ -0,0 +1,38 @@ +{ + options, + config, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.services.ssh; +in { + options.services.ssh = with types; { + enable = mkBoolOpt false "Enable ssh"; + }; + + config = mkIf cfg.enable { + services.openssh = { + enable = true; + ports = [22]; + settings.PermitRootLogin = "no"; + }; + + # users.users = let + # publicKey = ""; # Enter your ssh public key + # in + # { + # root.openssh.authorizedKeys.keys = [ + # publicKey + # ]; + # ${config.user.name}.openssh.authorizedKeys.keys = [ + # publicKey + # ]; + # }; + + # home.file.".ssh/config".text = '' + # identityfile ~/.ssh/key + # ''; + }; +} diff --git a/nix/modules/nixos/suites/common/default.nix b/nix/modules/nixos/suites/common/default.nix new file mode 100644 index 0000000..6a5d74e --- /dev/null +++ b/nix/modules/nixos/suites/common/default.nix @@ -0,0 +1,53 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.suites.common; +in { + options.suites.common = with types; { + enable = mkBoolOpt false "Enable the common suite"; + }; + + config = mkIf cfg.enable { + system = { + nix.enable = true; + + fonts.enable = true; + locale.enable = true; + time.enable = true; + xkb.enable = true; + + security.doas.enable = false; + security.sudo.enable = true; + security.gpg.enable = true; + }; + + hardware.audio.enable = true; + hardware.networking.enable = true; + + services.ssh.enable = true; + programs.dconf.enable = true; + + # add sys custom build package + environment.systemPackages = [pkgs.custom.sys]; + + custom.tools = { + git.enable = true; + http.enable = true; + misc.enable = true; + net.enable = true; + }; + custom.cli-apps = { + atuin.enable = lib.mkDefault true; + neovim.enable = lib.mkDefault true; + lf.enable = lib.mkDefault false; + tmux.enable = lib.mkDefault true; + yazi.enable = lib.mkDefault false; + }; + }; +} diff --git a/nix/modules/nixos/suites/desktop/default.nix b/nix/modules/nixos/suites/desktop/default.nix new file mode 100644 index 0000000..eb6aece --- /dev/null +++ b/nix/modules/nixos/suites/desktop/default.nix @@ -0,0 +1,34 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.suites.desktop; +in { + options.suites.desktop = with types; { + enable = mkBoolOpt false "Enable the desktop suite"; + }; + + config = mkIf cfg.enable { + system.security.rbw.enable = true; + custom = { + desktop = { + hyprland = enabled; + }; + apps = { + firefox = enabled; + imv = enabled; + slack = enabled; + zoom-us = enabled; + telegram = enabled; + vlc = enabled; + zathura = enabled; + pcmanfm = enabled; + }; + }; + }; +} diff --git a/nix/modules/nixos/suites/develop/default.nix b/nix/modules/nixos/suites/develop/default.nix new file mode 100644 index 0000000..fba4058 --- /dev/null +++ b/nix/modules/nixos/suites/develop/default.nix @@ -0,0 +1,23 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.suites.develop; +in { + options.suites.develop = with types; { + enable = mkBoolOpt false "Enable the develop suite"; + }; + + config = mkIf cfg.enable { + custom.tools = { + lsp.enable = true; + linters.enable = true; + k8s.enable = true; + }; + }; +} diff --git a/nix/modules/nixos/system/battery/default.nix b/nix/modules/nixos/system/battery/default.nix new file mode 100644 index 0000000..4410225 --- /dev/null +++ b/nix/modules/nixos/system/battery/default.nix @@ -0,0 +1,39 @@ +{ + options, + config, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.system.battery; +in { + options.system.battery = with types; { + enable = mkBoolOpt false "Whether or not to enable battery optimizations and utils."; + }; + + config = mkIf cfg.enable { + # Better scheduling for CPU cycles - thanks System76!!! + services.system76-scheduler.settings.cfsProfiles.enable = true; + + # Enable TLP (better than gnomes internal power manager) + services.tlp = { + enable = true; + settings = { + CPU_BOOST_ON_AC = 1; + CPU_BOOST_ON_BAT = 0; + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + }; + }; + + # Disable GNOMEs power management + services.power-profiles-daemon.enable = false; + + # Enable powertop + powerManagement.powertop.enable = true; + + # Enable thermald (only necessary if on Intel CPUs) + services.thermald.enable = true; + }; +} diff --git a/nix/modules/nixos/system/boot/bios/default.nix b/nix/modules/nixos/system/boot/bios/default.nix new file mode 100644 index 0000000..751f773 --- /dev/null +++ b/nix/modules/nixos/system/boot/bios/default.nix @@ -0,0 +1,22 @@ +{ + options, + config, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.system.boot.bios; +in { + options.system.boot.bios = with types; { + enable = mkBoolOpt false "Whether or not to enable bios booting."; + device = mkOpt str "/dev/sda" "Disk that grub will be installed to."; + }; + + config = mkIf cfg.enable { + boot.loader.grub = { + enable = true; + device = "/dev/sda"; + }; + }; +} diff --git a/nix/modules/nixos/system/boot/efi/default.nix b/nix/modules/nixos/system/boot/efi/default.nix new file mode 100644 index 0000000..8f05ef7 --- /dev/null +++ b/nix/modules/nixos/system/boot/efi/default.nix @@ -0,0 +1,24 @@ +{ + options, + config, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.system.boot.efi; +in { + options.system.boot.efi = with types; { + enable = mkBoolOpt false "Whether or not to enable efi booting."; + }; + + config = mkIf cfg.enable { + boot.loader.systemd-boot.enable = true; + boot.kernelParams = ["ipv6.disable=1"]; + boot.loader.systemd-boot.configurationLimit = 5; + boot.loader.efi.canTouchEfiVariables = true; + + # https://github.com/NixOS/nixpkgs/blob/c32c39d6f3b1fe6514598fa40ad2cf9ce22c3fb7/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix#L66 + # boot.loader.systemd-boot.editor = false; + }; +} diff --git a/nix/modules/nixos/system/env/default.nix b/nix/modules/nixos/system/env/default.nix new file mode 100644 index 0000000..e635eb4 --- /dev/null +++ b/nix/modules/nixos/system/env/default.nix @@ -0,0 +1,42 @@ +{ + options, + config, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.system.env; +in { + options.system.env = with types; + mkOption { + type = attrsOf (oneOf [str path (listOf (either str path))]); + apply = mapAttrs (_n: v: + if isList v + then concatMapStringsSep ":" toString v + else (toString v)); + default = {}; + description = "A set of environment variables to set."; + }; + + config = { + environment = { + sessionVariables = { + XDG_CACHE_HOME = "$HOME/.cache"; + XDG_CONFIG_HOME = "$HOME/.config"; + XDG_DATA_HOME = "$HOME/.local/share"; + XDG_BIN_HOME = "$HOME/.local/bin"; + # To prevent firefox from creating ~/Desktop. + XDG_DESKTOP_DIR = "$HOME"; + }; + variables = { + # Make some programs "XDG" compliant. + LESSHISTFILE = "$XDG_CACHE_HOME/less.history"; + WGETRC = "$XDG_CONFIG_HOME/wgetrc"; + }; + extraInit = + concatStringsSep "\n" + (mapAttrsToList (n: v: ''export ${n}="${v}"'') cfg); + }; + }; +} diff --git a/nix/modules/nixos/system/fonts/default.nix b/nix/modules/nixos/system/fonts/default.nix new file mode 100644 index 0000000..55fc62d --- /dev/null +++ b/nix/modules/nixos/system/fonts/default.nix @@ -0,0 +1,43 @@ +{ + options, + config, + pkgs, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.system.fonts; +in { + options.system.fonts = with types; { + enable = mkBoolOpt false "Whether or not to manage fonts."; + fonts = mkOpt (listOf package) [] "Custom font packages to install."; + }; + + config = mkIf cfg.enable { + environment.variables = { + # Enable icons in tooling since we have nerdfonts. + LOG_ICONS = "true"; + }; + + environment.systemPackages = with pkgs; [font-manager]; + + fonts.packages = with pkgs; + [ + noto-fonts + noto-fonts-cjk-sans + noto-fonts-cjk-serif + noto-fonts-emoji + (nerdfonts.override {fonts = ["JetBrainsMono" "CascadiaCode" "FiraCode"];}) + ] + ++ cfg.fonts; + + fonts.fontconfig = { + defaultFonts = { + monospace = ["CaskaydiaCove Nerd Font Mono"]; + sansSerif = ["CascadiaCode Nerd Font"]; + serif = ["CascadiaCode Nerd Font"]; + }; + }; + }; +} diff --git a/nix/modules/nixos/system/locale/default.nix b/nix/modules/nixos/system/locale/default.nix new file mode 100644 index 0000000..eb987a9 --- /dev/null +++ b/nix/modules/nixos/system/locale/default.nix @@ -0,0 +1,31 @@ +{ + options, + config, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.system.locale; +in { + options.system.locale = with types; { + enable = mkBoolOpt false "Whether or not to manage locale settings."; + }; + + config = mkIf cfg.enable { + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "ru_RU.UTF-8"; + LC_IDENTIFICATION = "ru_RU.UTF-8"; + LC_MEASUREMENT = "ru_RU.UTF-8"; + LC_MONETARY = "ru_RU.UTF-8"; + LC_NAME = "ru_RU.UTF-8"; + LC_NUMERIC = "ru_RU.UTF-8"; + LC_PAPER = "ru_RU.UTF-8"; + LC_TELEPHONE = "ru_RU.UTF-8"; + LC_TIME = "ru_RU.UTF-8"; + }; + + console = {keyMap = mkForce "us";}; + }; +} diff --git a/nix/modules/nixos/system/nix/default.nix b/nix/modules/nixos/system/nix/default.nix new file mode 100644 index 0000000..eae707d --- /dev/null +++ b/nix/modules/nixos/system/nix/default.nix @@ -0,0 +1,63 @@ +{ + options, + config, + pkgs, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.system.nix; +in { + options.system.nix = with types; { + enable = mkBoolOpt true "Whether or not to manage nix configuration."; + + package = mkOpt package pkgs.nixUnstable "Which nix package to use."; + default-substituter = { + url = mkOpt str "https://cache.nixos.org" "The url for the substituter."; + key = mkOpt str "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "The trusted public key for the substituter."; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + rnix-lsp + nixfmt + nix-index + nix-prefetch-git + ]; + + nix = let + users = ["root" config.custom.user.name]; + in { + inherit (cfg) package; + + settings = + { + experimental-features = "nix-command flakes"; + http-connections = 50; + warn-dirty = false; + log-lines = 50; + sandbox = "relaxed"; + auto-optimise-store = true; + trusted-users = users; + allowed-users = users; + } + // (lib.optionalAttrs config.custom.tools.direnv.enable { + keep-outputs = true; + keep-derivations = true; + }); + + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + + # flake-utils-plus + generateRegistryFromInputs = true; + generateNixPathFromInputs = true; + linkInputs = true; + }; + }; +} diff --git a/nix/modules/nixos/system/security/doas/default.nix b/nix/modules/nixos/system/security/doas/default.nix new file mode 100644 index 0000000..7a7592e --- /dev/null +++ b/nix/modules/nixos/system/security/doas/default.nix @@ -0,0 +1,34 @@ +{ + options, + config, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.system.security.doas; +in { + options.system.security.doas = { + enable = mkBoolOpt false "Whether or not to replace sudo with doas."; + }; + + config = mkIf cfg.enable { + # Disable sudo + security.sudo.enable = false; + + # Enable and configure `doas`. + security.doas = { + enable = true; + extraRules = [ + { + users = [config.custom.user.name]; + noPass = true; + keepEnv = true; + } + ]; + }; + + # Add an alias to the shell for backward-compat and convenience. + environment.shellAliases = {sudo = "doas";}; + }; +} diff --git a/nix/modules/nixos/system/security/gpg/default.nix b/nix/modules/nixos/system/security/gpg/default.nix new file mode 100644 index 0000000..2975d8c --- /dev/null +++ b/nix/modules/nixos/system/security/gpg/default.nix @@ -0,0 +1,69 @@ +{ + options, + config, + pkgs, + lib, + inputs, + ... +}: +with lib; +with lib.custom; let + cfg = config.system.security.gpg; + + gpgConf = '' + use-agent + pinentry-mode loopback + ''; + + gpgAgentConf = '' + enable-ssh-support + default-cache-ttl 28800 + max-cache-ttl 28800 + allow-loopback-pinentry + ''; +in { + options.system.security.gpg = with types; { + enable = mkBoolOpt false "Whether or not to enable GPG."; + agentTimeout = mkOpt int 5 "The amount of time to wait before continuing with shell init."; + }; + + config = mkIf cfg.enable { + # NOTE: This should already have been added by programs.gpg, but + # keeping it here for now just in case. + environment.shellInit = '' + export GPG_TTY="$(tty)" + export SSH_AUTH_SOCK=$(${pkgs.gnupg}/bin/gpgconf --list-dirs agent-ssh-socket) + + ${pkgs.coreutils}/bin/timeout ${builtins.toString cfg.agentTimeout} ${pkgs.gnupg}/bin/gpgconf --launch gpg-agent + gpg_agent_timeout_status=$? + + if [ "$gpg_agent_timeout_status" = 124 ]; then + # Command timed out... + echo "GPG Agent timed out..." + echo 'Run "gpgconf --launch gpg-agent" to try and launch it again.' + fi + ''; + + environment.systemPackages = with pkgs; [ + gnupg + pinentry-curses + ]; + + programs = { + ssh.startAgent = false; + + gnupg.agent = { + enable = true; + enableSSHSupport = true; + enableExtraSocket = true; + }; + }; + + home.file = { + ".gnupg/.keep".text = ""; + + ".gnupg/gpg.conf".text = gpgConf; + ".gnupg/gpg-agent.conf".text = gpgAgentConf; + }; + }; +} diff --git a/nix/modules/nixos/system/security/keyring/default.nix b/nix/modules/nixos/system/security/keyring/default.nix new file mode 100644 index 0000000..473601f --- /dev/null +++ b/nix/modules/nixos/system/security/keyring/default.nix @@ -0,0 +1,22 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.security.keyring; +in { + options.custom.security.keyring = with types; { + enable = mkBoolOpt false "Whether to enable gnome keyring."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + gnome.gnome-keyring + gnome.libgnome-keyring + ]; + }; +} diff --git a/nix/modules/nixos/system/security/rbw/default.nix b/nix/modules/nixos/system/security/rbw/default.nix new file mode 100644 index 0000000..e7dd37e --- /dev/null +++ b/nix/modules/nixos/system/security/rbw/default.nix @@ -0,0 +1,35 @@ +{ + options, + config, + pkgs, + lib, + inputs, + ... +}: +with lib; +with lib.custom; let + cfg = config.system.security.rbw; +in { + options.system.security.rbw = with types; { + enable = mkBoolOpt false "Whether or not to enable rbw."; + lockTimeout = mkOpt int 28800 "The amount of time to wait before continuing with shell init."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + rbw + pinentry-gnome + ]; + + home.programs = { + rbw = { + enable = true; + settings = { + lock_timeout = cfg.lockTimeout; + pinentry = "gnome3"; + email = "zppfan@gmail.com"; + }; + }; + }; + }; +} diff --git a/nix/modules/nixos/system/security/sudo/default.nix b/nix/modules/nixos/system/security/sudo/default.nix new file mode 100644 index 0000000..dd8e130 --- /dev/null +++ b/nix/modules/nixos/system/security/sudo/default.nix @@ -0,0 +1,18 @@ +{ + options, + config, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.system.security.sudo; +in { + options.system.security.sudo = { + enable = mkBoolOpt false "Whether or not to configure sudo"; + }; + + config = mkIf cfg.enable { + security.sudo.wheelNeedsPassword = false; + }; +} diff --git a/nix/modules/nixos/system/shell/default.nix b/nix/modules/nixos/system/shell/default.nix new file mode 100644 index 0000000..8778b72 --- /dev/null +++ b/nix/modules/nixos/system/shell/default.nix @@ -0,0 +1,80 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.system.shell; +in { + options.system.shell = with types; { + shell = mkOpt (enum ["nushell" "fish"]) "nushell" "What shell to use"; + }; + + config = { + environment.systemPackages = with pkgs; [ + eza + bat + neofetch + zoxide + starship + ]; + + users.defaultUserShell = pkgs.${cfg.shell}; + users.users.root.shell = pkgs.bashInteractive; + + home.programs.starship = { + enable = true; + enableFishIntegration = true; + enableNushellIntegration = true; + }; + home.configFile."starship.toml".source = ./starship.toml; + + environment.shellAliases = { + ".." = "cd .."; + }; + + home.programs.zoxide = { + enable = true; + enableNushellIntegration = true; + }; + + # Actual Shell Configurations + home.programs.fish = mkIf (cfg.shell == "fish") { + enable = true; + shellAliases = { + ls = "eza -la --icons --no-user --no-time --git -s type"; + cat = "bat"; + }; + shellInit = '' + ${mkIf apps.tools.direnv.enable '' + direnv hook fish | source + ''} + + zoxide init fish | source + + function , --description 'add software to shell session' + nix shell nixpkgs#$argv[1..-1] + end + ''; + }; + + # Enable all if nushell + home.programs.nushell = mkIf (cfg.shell == "nushell") { + enable = true; + shellAliases = config.environment.shellAliases // {ls = "ls";}; + envFile.text = ""; + extraConfig = '' + $env.config = { + show_banner: false, + } + + def , [...packages] { + nix shell ($packages | each {|s| $"nixpkgs#($s)"}) + } + ''; + }; + }; +} diff --git a/nix/modules/nixos/system/shell/starship.toml b/nix/modules/nixos/system/shell/starship.toml new file mode 100644 index 0000000..1bcd11f --- /dev/null +++ b/nix/modules/nixos/system/shell/starship.toml @@ -0,0 +1,75 @@ +[aws] +symbol = " " + +[buf] +symbol = " " + +[c] +symbol = " " + +[dart] +symbol = " " + +[directory] +read_only = " " + +[docker_context] +symbol = " " + +[elixir] +symbol = " " + +[elm] +symbol = " " + +[git_branch] +symbol = " " + +[golang] +symbol = " " + +[haskell] +symbol = " " + +[hg_branch] +symbol = " " + +[java] +symbol = " " + +[julia] +symbol = " " + +[lua] +symbol = " " + +[memory_usage] +symbol = "󰘚 " + +[nim] +symbol = " " + +[nix_shell] +symbol = "  " + +[nodejs] +symbol = " " + +[package] +symbol = "󰏗 " + +[python] +symbol = " " + +[rlang] +symbol = " " + +[ruby] +symbol = " " + +[rust] +symbol = " " + +[scala] +symbol = " " + diff --git a/nix/modules/nixos/system/time/default.nix b/nix/modules/nixos/system/time/default.nix new file mode 100644 index 0000000..37233e9 --- /dev/null +++ b/nix/modules/nixos/system/time/default.nix @@ -0,0 +1,17 @@ +{ + options, + config, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.system.time; +in { + options.system.time = with types; { + enable = + mkBoolOpt false "Whether or not to configure timezone information."; + }; + + config = mkIf cfg.enable {time.timeZone = "Europe/Moscow";}; +} diff --git a/nix/modules/nixos/system/xkb/default.nix b/nix/modules/nixos/system/xkb/default.nix new file mode 100644 index 0000000..a2392e9 --- /dev/null +++ b/nix/modules/nixos/system/xkb/default.nix @@ -0,0 +1,28 @@ +{ + options, + config, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.system.xkb; +in { + options.system.xkb = with types; { + enable = mkBoolOpt false "Whether or not to configure xkb."; + }; + + config = mkIf cfg.enable { + console.useXkbConfig = true; + services.xserver = { + layout = "dh,ru"; + # xkbOptions = "grp:shift_caps_toggle,grp_led:caps,terminate:ctrl_alt_bksp"; + xkbOptions = "terminate:ctrl_alt_bksp"; + extraLayouts.dh = { + description = "Colemak-DH ergo"; + languages = ["eng"]; + symbolsFile = ./symbols/colemak_dh; + }; + }; + }; +} diff --git a/nix/symbols/colemak_dh b/nix/modules/nixos/system/xkb/symbols/colemak_dh similarity index 100% rename from nix/symbols/colemak_dh rename to nix/modules/nixos/system/xkb/symbols/colemak_dh diff --git a/nix/modules/nixos/tools/direnv/default.nix b/nix/modules/nixos/tools/direnv/default.nix new file mode 100644 index 0000000..fda7a6f --- /dev/null +++ b/nix/modules/nixos/tools/direnv/default.nix @@ -0,0 +1,24 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.tools.direnv; +in { + options.custom.tools.direnv = with types; { + enable = mkBoolOpt false "Whether or not to enable direnv."; + }; + + config = mkIf cfg.enable { + home.extraOptions = { + programs.direnv = { + enable = true; + nix-direnv = enabled; + }; + }; + }; +} diff --git a/nix/modules/nixos/tools/git/default.nix b/nix/modules/nixos/tools/git/default.nix new file mode 100644 index 0000000..b2c3bfb --- /dev/null +++ b/nix/modules/nixos/tools/git/default.nix @@ -0,0 +1,73 @@ +{ + options, + config, + pkgs, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.tools.git; + gpg = config.system.security.gpg; + user = config.custom.user; +in { + options.custom.tools.git = with types; { + enable = mkBoolOpt false "Whether or not to install and configure git."; + userName = mkOpt types.str user.fullName "The name to configure git with."; + userEmail = mkOpt types.str user.email "The email to configure git with."; + signingKey = + mkOpt types.str "7C43420F61CEC7FB" "The key ID to sign commits with."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [git]; + + home.extraOptions = { + programs.git = { + enable = true; + inherit (cfg) userName userEmail; + lfs = enabled; + signing = { + key = cfg.signingKey; + signByDefault = mkIf gpg.enable true; + }; + extraConfig = { + init = { + defaultBranch = "master"; + templatedir = "~/.git_template"; + whitespace = "trailing-space,space-before-tab"; + }; + core = { + pager = "bat"; + }; + pull = {rebase = true;}; + push = {autoSetupRemote = true;}; + safe = { + directory = "${config.users.users.${user.name}.home}/work/config"; + }; + merge = { + tool = "nvimdiff"; + conflictstyle = "diff3"; + }; + diff = { + tool = "nvimdiff"; + }; + difftool = { + prompt = false; + }; + mergetool = { + prompt = false; + }; + alias = { + st = "status -sb"; + lga = "log --oneline --all --decorate --graph --color"; + lg = "log --pretty=lg"; + glg = "log --graph --pretty=lg"; + slg = "stash list --pretty=reflg"; + hist = "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"; + }; + }; + }; + }; + }; +} diff --git a/nix/modules/nixos/tools/http/default.nix b/nix/modules/nixos/tools/http/default.nix new file mode 100644 index 0000000..fb25ed5 --- /dev/null +++ b/nix/modules/nixos/tools/http/default.nix @@ -0,0 +1,18 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.tools.http; +in { + options.custom.tools.http = with types; { + enable = mkBoolOpt false "Whether or not to enable common http utilities."; + }; + + config = + mkIf cfg.enable {environment.systemPackages = with pkgs; [wget curl];}; +} diff --git a/nix/modules/nixos/tools/k8s/default.nix b/nix/modules/nixos/tools/k8s/default.nix new file mode 100644 index 0000000..fe18d04 --- /dev/null +++ b/nix/modules/nixos/tools/k8s/default.nix @@ -0,0 +1,37 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.tools.k8s; +in { + options.custom.tools.k8s = with types; { + enable = + mkBoolOpt false "Whether or not to enable common Kubernetes utilities."; + }; + + config = mkIf cfg.enable { + programs.fish.shellAliases = { + k = "kubecolor"; + kk = "kubecolor"; + kubectl = "kubecolor"; + kc = "kubectx"; + kn = "kubens"; + }; + + environment.systemPackages = with pkgs; [ + kubectl + kubectx + kubecolor + kubernetes-helm + helmfile + helm-docs + k9s + krew + ]; + }; +} diff --git a/nix/modules/nixos/tools/linters/default.nix b/nix/modules/nixos/tools/linters/default.nix new file mode 100644 index 0000000..f8bb160 --- /dev/null +++ b/nix/modules/nixos/tools/linters/default.nix @@ -0,0 +1,23 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.tools.linters; +in { + options.custom.tools.linters = with types; { + enable = mkBoolOpt false "Whether or not to enable linters utilities."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + alejandra + ctags + stylua + ]; + }; +} diff --git a/nix/modules/nixos/tools/lsp/default.nix b/nix/modules/nixos/tools/lsp/default.nix new file mode 100644 index 0000000..6920eef --- /dev/null +++ b/nix/modules/nixos/tools/lsp/default.nix @@ -0,0 +1,28 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.tools.lsp; +in { + options.custom.tools.lsp = with types; { + enable = mkBoolOpt false "Whether or not to enable lsp utilities."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + lua-language-server # LSP for lua + marksman # LSP for markdown + rnix-lsp # LSP for nix + tree-sitter + yamllint + nodejs_21 # Note for LSP servers + nodePackages_latest.pyright + black + ]; + }; +} diff --git a/nix/modules/nixos/tools/misc/default.nix b/nix/modules/nixos/tools/misc/default.nix new file mode 100644 index 0000000..2c99181 --- /dev/null +++ b/nix/modules/nixos/tools/misc/default.nix @@ -0,0 +1,33 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.tools.misc; +in { + options.custom.tools.misc = with types; { + enable = mkBoolOpt false "Whether or not to enable common utilities."; + }; + + config = mkIf cfg.enable { + home.configFile."wgetrc".text = ""; + + environment.systemPackages = with pkgs; [ + bat + fd + file + fzf + jq + killall + ripgrep + rsync + tree + unzip + yq + ]; + }; +} diff --git a/nix/modules/nixos/tools/net/default.nix b/nix/modules/nixos/tools/net/default.nix new file mode 100644 index 0000000..082396f --- /dev/null +++ b/nix/modules/nixos/tools/net/default.nix @@ -0,0 +1,28 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.tools.net; +in { + options.custom.tools.net = with types; { + enable = mkBoolOpt false "Whether or not to enable common utilities."; + }; + + config = mkIf cfg.enable { + home.configFile."wgetrc".text = ""; + + environment.systemPackages = with pkgs; [ + dig + iftop + ipfetch + nfs-utils + traceroute + mtr + ]; + }; +} diff --git a/nix/modules/nixos/user/default.nix b/nix/modules/nixos/user/default.nix new file mode 100644 index 0000000..dfa355b --- /dev/null +++ b/nix/modules/nixos/user/default.nix @@ -0,0 +1,94 @@ +{ + options, + config, + pkgs, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.user; + defaultIconFileName = "profile.png"; + defaultIcon = pkgs.stdenvNoCC.mkDerivation { + name = "default-icon"; + src = ./. + "/${defaultIconFileName}"; + + dontUnpack = true; + + installPhase = '' + cp $src $out + ''; + + passthru = {fileName = defaultIconFileName;}; + }; + propagatedIcon = + pkgs.runCommandNoCC "propagated-icon" + {passthru = {inherit (cfg.icon) fileName;};} + '' + local target="$out/share/icons/user/${cfg.name}" + mkdir -p "$target" + + cp ${cfg.icon} "$target/${cfg.icon.fileName}" + ''; +in { + options.custom.user = with types; { + name = mkOpt str "sab" "The name to use for the user account."; + fullName = mkOpt str "Sergei Bulavintsev" "The full name of the user."; + email = mkOpt str "bulavintsev.sergey@gmail.com" "The email of the user."; + initialPassword = + mkOpt str "password" + "The initial password to use when the user is first created."; + icon = + mkOpt (nullOr package) defaultIcon + "The profile picture to use for the user."; + prompt-init = mkBoolOpt true "Whether or not to show an initial message when opening a new shell."; + extraGroups = mkOpt (listOf str) [] "Groups for the user to be assigned."; + extraOptions = + mkOpt attrs {} + (mdDoc "Extra options passed to `users.users.`."); + }; + + config = { + environment.systemPackages = with pkgs; [ + propagatedIcon + ]; + + home = { + file = { + "Documents/.keep".text = ""; + "Downloads/.keep".text = ""; + "Music/.keep".text = ""; + "Pictures/.keep".text = ""; + "Pictures/${ + cfg.icon.fileName or (builtins.baseNameOf cfg.icon) + }".source = + cfg.icon; + }; + }; + + programs = { + fish = { + enable = true; + shellAliases = { + nixup = "sudo nixos-rebuild switch --flake ~/dotfiles/nix#nz"; + nixt = "sudo nixos-rebuild test --flake ~/dotfiles/nix#nz"; + nixclean = "sudo nix-collect-garbage -d && sudo nix-store --gc && sudo nix-store --repair --verify --check-contents && sudo nix-store --optimise -vvv"; + }; + # interactiveShellInit = "source ~/dotfiles/fish/functions/l.fish"; + }; + }; + users.users.${cfg.name} = + { + isNormalUser = true; + inherit (cfg) name initialPassword; + home = "/home/${cfg.name}"; + group = "users"; + + shell = pkgs.fish; + extraGroups = + ["wheel" "audio" "sound" "video" "networkmanager" "input" "tty" "docker"] + ++ cfg.extraGroups; + } + // cfg.extraOptions; + }; +} diff --git a/nix/modules/nixos/user/profile.png b/nix/modules/nixos/user/profile.png new file mode 100644 index 0000000..e43f9ca Binary files /dev/null and b/nix/modules/nixos/user/profile.png differ diff --git a/nix/nixos/configuration.nix b/nix/nixos/configuration.nix deleted file mode 100644 index 970d684..0000000 --- a/nix/nixos/configuration.nix +++ /dev/null @@ -1,201 +0,0 @@ -# This is your system's configuration file. -# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) -{ - inputs, - lib, - config, - pkgs, - ... -}: { - # You can import other NixOS modules here - imports = [ - # If you want to use modules from other flakes (such as nixos-hardware): - # inputs.hardware.nixosModules.common-cpu-amd - # inputs.hardware.nixosModules.common-ssd - - # You can also split up your configuration and import pieces of it here: - ./users.nix - - # Import your generated (nixos-generate-config) hardware configuration - ./hardware-configuration.nix - ./programs.nix - ./packages.nix - ./greetd.nix - ]; - - nixpkgs = { - # You can add overlays here - overlays = [ - # If you want to use overlays exported from other flakes: - # neovim-nightly-overlay.overlays.default - - # Or define it inline, for example: - # (final: prev: { - # hi = final.hello.overrideAttrs (oldAttrs: { - # patches = [ ./change-hello-to-hi.patch ]; - # }); - # }) - ]; - # Configure your nixpkgs instance - config = { - # Disable if you don't want unfree packages - allowUnfree = true; - }; - }; - - nix = { - # This will add each flake input as a registry - # To make nix3 commands consistent with your flake - registry = lib.mapAttrs (_: value: {flake = value;}) inputs; - - # This will additionally add your inputs to the system's legacy channels - # Making legacy nix commands consistent as well, awesome! - nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; - - # Perform garbage collection weekly to maintain low disk usage - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 1w"; - }; - settings = { - # Enable flakes and new 'nix' command - experimental-features = "nix-command flakes"; - # Deduplicate and optimize nix store - auto-optimise-store = true; - }; - }; - - # Networking - networking = { - hostName = "nz"; # Define your hostname. - enableIPv6 = false; - networkmanager.enable = true; - wireguard.enable = true; - hosts = { - "10.211.80.175" = ["teleport-c11.pyn.ru"]; - }; - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - firewall.enable = false; - }; - systemd.services.NetworkManager-wait-online.enable = false; - services.wg-netmanager.enable = true; - - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.kernelParams = ["ipv6.disable=1"]; - boot.loader.efi.canTouchEfiVariables = true; - - # Set your time zone. - time.timeZone = "Europe/Moscow"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "ru_RU.UTF-8"; - LC_IDENTIFICATION = "ru_RU.UTF-8"; - LC_MEASUREMENT = "ru_RU.UTF-8"; - LC_MONETARY = "ru_RU.UTF-8"; - LC_NAME = "ru_RU.UTF-8"; - LC_NUMERIC = "ru_RU.UTF-8"; - LC_PAPER = "ru_RU.UTF-8"; - LC_TELEPHONE = "ru_RU.UTF-8"; - LC_TIME = "ru_RU.UTF-8"; - }; - - # Enable the X11 windowing system. - services.xserver.enable = true; - - # Enable the GNOME Desktop Environment. - # services.xserver.displayManager.gdm.enable = true; - # services.xserver.displayManager.gdm.wayland = true; - # services.xserver.desktopManager.gnome.enable = true; - - # Configure keymap in X11 - services.xserver = { - layout = "dh,ru"; - #xkbVariant = ""; - - # xkbOptions = "grp:shift_caps_toggle,grp_led:caps,terminate:ctrl_alt_bksp"; - xkbOptions = "terminate:ctrl_alt_bksp"; - }; - services.dbus.enable = true; - # XDG Portals - xdg = { - autostart.enable = true; - portal = { - enable = true; - extraPortals = [ - pkgs.xdg-desktop-portal - ]; - }; - }; - - # Enable CUPS to print documents. - services.printing.enable = false; - - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - wireplumber.enable = true; - # If you want to use JACK applications, uncomment this - #jack.enable = true; - - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #media-session.enable = true; - }; - - services.xserver.extraLayouts.dh = { - description = "Colemak-DH ergo"; - languages = ["eng"]; - symbolsFile = ../symbols/colemak_dh; - }; - - services.fprintd.enable = true; - - security.rtkit.enable = true; - security.sudo.wheelNeedsPassword = false; - # security.pam.services.swaylock.fprintAuth = true; - security.pam.services.swaylock.text = '' - # Account management. - account required pam_unix.so - - # Authentication management. - - # prompt for a password; pressing Enter on a blank field will proceed to fingerprint authentication. - auth sufficient pam_unix.so nullok likeauth try_first_pass - auth sufficient ${pkgs.fprintd}/lib/security/pam_fprintd.so - auth required pam_deny.so - - # Password management. - password sufficient pam_unix.so nullok sha512 - - # Session management. - session required pam_env.so conffile=/etc/pam/environment readenv=0 - session required pam_unix.so - ''; - - # This setups a SSH server. Very important if you're setting up a headless system. - # Feel free to remove if you don't need it. - services.openssh = { - enable = true; - # Forbid root login through SSH. - settings.PermitRootLogin = "no"; - # Use keys only. Remove if you want to SSH using password (not recommended) - #settings.passwordauthentication = false; - }; - - # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - system.stateVersion = "23.11"; -} diff --git a/nix/nixos/greetd.nix b/nix/nixos/greetd.nix deleted file mode 100644 index 2d516a8..0000000 --- a/nix/nixos/greetd.nix +++ /dev/null @@ -1,78 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -# greetd display manager -let - greetdSwayConfig = pkgs.writeText "greetd-sway-config" '' - exec "dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP" - input "type:touchpad" { - tap enabled - } - seat seat0 xcursor_theme Bibata-Modern-Classic 24 - xwayland disable - - bindsym Mod4+shift+e exec swaynag \ - -t warning \ - -m 'What do you want to do?' \ - -b 'Poweroff' 'systemctl poweroff' \ - -b 'Reboot' 'systemctl reboot' - - exec "${lib.getExe config.programs.regreet.package} -l debug; swaymsg exit" - ''; -in { - environment.systemPackages = with pkgs; [ - # theme packages - (catppuccin-gtk.override { - accents = ["mauve"]; - size = "compact"; - variant = "mocha"; - }) - bibata-cursors - papirus-icon-theme - ]; - - programs.regreet = { - enable = true; - package = pkgs.greetd.regreet.overrideAttrs (self: super: rec { - version = "0.1.1-patched"; - src = pkgs.fetchFromGitHub { - owner = "rharish101"; - repo = "ReGreet"; - rev = "61d871a0ee5c74230dfef8100d0c9bc75b309203"; - hash = "sha256-PkQTubSm/FN3FXs9vBB3FI4dXbQhv/7fS1rXkVsTAAs="; - }; - cargoDeps = super.cargoDeps.overrideAttrs (_: { - inherit src; - outputHash = "sha256-dR6veXCGVMr5TbCvP0EqyQKTG2XM65VHF9U2nRWyzfA="; - }); - - # temp fix until https://github.com/rharish101/ReGreet/issues/32 is solved - patches = [./regreet.patch]; - }); - - settings = { - background = { - path = /home/sab/Pictures/wallpaper.png; - fit = "Cover"; - }; - GTK = { - cursor_theme_name = "Bibata-Modern-Classic"; - font_name = "FiraCode Nerd Font Regular 12"; - icon_theme_name = "Papirus-Dark"; - theme_name = "Catppuccin-Mocha-Compact-Mauve-dark"; - }; - }; - }; - - programs.sway.enable = true; - - services.greetd.settings.default_session.command = - "${config.programs.sway.package}/bin/sway --config ${greetdSwayConfig}" - + (lib.optionalString (config.networking.hostName == "rog") " --unsupported-gpu"); - - # unlock GPG keyring on login - security.pam.services.greetd.enableGnomeKeyring = true; -} diff --git a/nix/nixos/home-manager/desktop/hypr/hyprpaper.conf b/nix/nixos/home-manager/desktop/hypr/hyprpaper.conf deleted file mode 120000 index d026359..0000000 --- a/nix/nixos/home-manager/desktop/hypr/hyprpaper.conf +++ /dev/null @@ -1 +0,0 @@ -/nix/store/f075xg2s9iw746d82avp7qp7ax89ppy2-home-manager-files/.config/hypr/hyprpaper.conf \ No newline at end of file diff --git a/nix/nixos/home-manager/desktop/hyprpaper.nix b/nix/nixos/home-manager/desktop/hyprpaper.nix deleted file mode 100644 index 914028f..0000000 --- a/nix/nixos/home-manager/desktop/hyprpaper.nix +++ /dev/null @@ -1,10 +0,0 @@ -let - wallpaper = ./wallpapers/2.jpg; -in { - xdg.configFile."hypr/hyprpaper.conf".text = '' - preload = ${wallpaper} - wallpaper = eDP-1,${wallpaper} - wallpaper = DP-1,${wallpaper} - wallpaper = DP-2,${wallpaper} - ''; -} diff --git a/nix/nixos/home-manager/desktop/mako.nix b/nix/nixos/home-manager/desktop/mako.nix deleted file mode 100644 index 74faca0..0000000 --- a/nix/nixos/home-manager/desktop/mako.nix +++ /dev/null @@ -1,32 +0,0 @@ -{pkgs, ...}: { - services.mako = { - enable = true; - defaultTimeout = 5000; - font = "FiraCode Nerd Font 10"; - layer = "overlay"; - anchor = "top-right"; - maxIconSize = 32; - icons = true; - iconPath = "${pkgs.papirus-icon-theme}/share/icons/Papirus-Dark"; - borderRadius = 5; - margin = "5"; - extraConfig = '' - group-by=app-name - background-color=#FFFFFFee - text-color=#000000cc - border-color=#00000033 - border-size=1 - progress-color=source #07b5efee - - [urgency=low] - border-color=#394b70 - - [urgency=normal] - border-color=#00000033 - - [urgency=high] - border-color=#ff757f - default-timeout=0 - ''; - }; -} diff --git a/nix/nixos/home-manager/desktop/rofi.nix b/nix/nixos/home-manager/desktop/rofi.nix deleted file mode 100644 index 81b72a8..0000000 --- a/nix/nixos/home-manager/desktop/rofi.nix +++ /dev/null @@ -1,30 +0,0 @@ -{...}: { - programs.rofi = { - enable = true; - extraConfig = { - combi-hide-mode-prefix = true; - combi-modi = "window,drun,calc"; - disable-history = false; - display-Network = " 󰤨 Network"; - display-drun = "  Apps "; - display-run = "  Run "; - display-window = " 﩯 Window"; - drun-display-format = "{icon} {name}"; - hide-scrollbar = true; - icon-theme = "Fluent"; - location = 0; - modi = "run,drun,window"; - show-icons = true; - sidebar-mode = true; - sorting-method = "fzf"; - sort = true; - terminal = "kitty"; - font = "FiraCode Nerd Font Regular 12"; - kb-accept-custom = "Control+Return"; - kb-cancel = "Escape,Control+g,Control+bracketleft,Control+space"; - kb-row-select = "Control+Super+space"; - matching = "fuzzy"; - }; - theme = ./rofi/catppuccin-frappe.rasi; - }; -} diff --git a/nix/nixos/home-manager/desktop/rofi/blurry.rasi b/nix/nixos/home-manager/desktop/rofi/blurry.rasi deleted file mode 100644 index be91b95..0000000 --- a/nix/nixos/home-manager/desktop/rofi/blurry.rasi +++ /dev/null @@ -1,142 +0,0 @@ -* { - transparent: #00000000; - foreground: #000000cc; - background-selected: #00000011; - background-active: #F2F2F230; - background-white: #00000011; - background-black: #ffffffee; - urgent: #E91E6366; - urgent-selected: #E91E6377; -} - -window { - transparency: "real"; - background-color: @transparent; - location: center; - anchor: center; - x-offset: 0px; - height: 500px; - width: 750px; - orientation: vertical; - border-radius: 8px; - border: 1; - border-color: #00000033; -} - -prompt { - enabled: false; -} - -button { - action: "ok"; - str: " "; - expand: false; - text-color: @foreground; - background-color: @transparent; - vertical-align: 0.7; - horizontal-align: 0.5; -} - -entry { - background-color: @transparent; - text-color: @foreground; - expand: true; - vertical-align: 0.5; - horizontal-align: 0.5; - placeholder: "Type to search"; - placeholder-color: @foreground; - blink: true; -} - -case-indicator { - background-color: @transparent; - text-color: @foreground; - vertical-align: 0.5; - horizontal-align: 0.5; -} - -entry-wrapper { - orientation: horizontal; - vertical-align: 0.5; - spacing: 4px; - background-color: @transparent; - children: [ button, entry, case-indicator ]; -} - -inputbar { - background-color: @background-white; - text-color: @foreground; - expand: false; - border-radius: 24px; - margin: 0px 225px 0px 225px; - padding: 10px 10px 10px 10px; - position: north; - children: [ entry-wrapper ]; -} - -listview { - background-color: @transparent; - columns: 2; - spacing: 5px; - cycle: false; - dynamic: true; - layout: vertical; -} - -mainbox { - background-color: @background-black; - children: [ inputbar, listview ]; - spacing: 25px; - padding: 40px 25px 25px 25px; -} - -element { - background-color: @transparent; - text-color: @foreground; - orientation: horizontal; - border-radius: 6px; - padding: 5px 10px 5px 10px; -} - -element-icon { - background-color: @transparent; - size: 36px; - border: 0; -} - -element-text { - background-color: @transparent; - text-color: @foreground; - expand: true; - horizontal-align: 0; - vertical-align: 0.5; - margin: 0 10px 0 10px; -} - -element normal.urgent, -element alternate.urgent { - background-color: @urgent; - text-color: @foreground; - border-radius: 9px; -} - -element normal.active, -element alternate.active { - background-color: @background-active; - text-color: @foreground; -} - -element selected { - background-color: @background-selected; - text-color: @foreground; -} - -element selected.urgent { - background-color: @urgent-selected; - text-color: @foreground; -} - -element selected.active { - background-color: @background-active; - color: @foreground-selected; -} diff --git a/nix/nixos/home-manager/desktop/rofi/catppuccin-latte.rasi b/nix/nixos/home-manager/desktop/rofi/catppuccin-latte.rasi deleted file mode 100644 index 6826db6..0000000 --- a/nix/nixos/home-manager/desktop/rofi/catppuccin-latte.rasi +++ /dev/null @@ -1,111 +0,0 @@ -* { - bg-col: #eff1f5; - bg-col-light: #eff1f5; - border-col: #eff1f5; - selected-col: #eff1f5; - blue: #1e66f5; - fg-col: #4c4f69; - fg-col2: #d20f39; - grey: #9ca0b0; - - width: 600; - font: "JetBrainsMono Nerd Font 14"; -} - -element-text, element-icon , mode-switcher { - background-color: inherit; - text-color: inherit; -} - -window { - height: 360px; - border: 3px; - border-color: @border-col; - background-color: @bg-col; -} - -mainbox { - background-color: @bg-col; -} - -inputbar { - children: [prompt,entry]; - background-color: @bg-col; - border-radius: 5px; - padding: 2px; -} - -prompt { - background-color: @blue; - padding: 6px; - text-color: @bg-col; - border-radius: 3px; - margin: 20px 0px 0px 20px; -} - -textbox-prompt-colon { - expand: false; - str: ":"; -} - -entry { - padding: 6px; - margin: 20px 0px 0px 10px; - text-color: @fg-col; - background-color: @bg-col; -} - -listview { - border: 0px 0px 0px; - padding: 6px 0px 0px; - margin: 10px 0px 0px 20px; - columns: 2; - lines: 5; - background-color: @bg-col; -} - -element { - padding: 5px; - background-color: @bg-col; - text-color: @fg-col ; -} - -element-icon { - size: 25px; -} - -element selected { - background-color: @selected-col ; - text-color: @fg-col2 ; -} - -mode-switcher { - spacing: 0; - } - -button { - padding: 10px; - background-color: @bg-col-light; - text-color: @grey; - vertical-align: 0.5; - horizontal-align: 0.5; -} - -button selected { - background-color: @bg-col; - text-color: @blue; -} - -message { - background-color: @bg-col-light; - margin: 2px; - padding: 2px; - border-radius: 5px; -} - -textbox { - padding: 6px; - margin: 20px 0px 0px 20px; - text-color: @blue; - background-color: @bg-col-light; -} diff --git a/nix/nixos/home-manager/desktop/rofi/catppuccin-macchiato.rasi b/nix/nixos/home-manager/desktop/rofi/catppuccin-macchiato.rasi deleted file mode 100644 index 696d769..0000000 --- a/nix/nixos/home-manager/desktop/rofi/catppuccin-macchiato.rasi +++ /dev/null @@ -1,111 +0,0 @@ -* { - bg-col: #24273a; - bg-col-light: #24273a; - border-col: #24273a; - selected-col: #24273a; - blue: #8aadf4; - fg-col: #cad3f5; - fg-col2: #ed8796; - grey: #6e738d; - - width: 600; - font: "JetBrainsMono Nerd Font 14"; -} - -element-text, element-icon , mode-switcher { - background-color: inherit; - text-color: inherit; -} - -window { - height: 360px; - border: 3px; - border-color: @border-col; - background-color: @bg-col; -} - -mainbox { - background-color: @bg-col; -} - -inputbar { - children: [prompt,entry]; - background-color: @bg-col; - border-radius: 5px; - padding: 2px; -} - -prompt { - background-color: @blue; - padding: 6px; - text-color: @bg-col; - border-radius: 3px; - margin: 20px 0px 0px 20px; -} - -textbox-prompt-colon { - expand: false; - str: ":"; -} - -entry { - padding: 6px; - margin: 20px 0px 0px 10px; - text-color: @fg-col; - background-color: @bg-col; -} - -listview { - border: 0px 0px 0px; - padding: 6px 0px 0px; - margin: 10px 0px 0px 20px; - columns: 2; - lines: 5; - background-color: @bg-col; -} - -element { - padding: 5px; - background-color: @bg-col; - text-color: @fg-col ; -} - -element-icon { - size: 25px; -} - -element selected { - background-color: @selected-col ; - text-color: @fg-col2 ; -} - -mode-switcher { - spacing: 0; - } - -button { - padding: 10px; - background-color: @bg-col-light; - text-color: @grey; - vertical-align: 0.5; - horizontal-align: 0.5; -} - -button selected { - background-color: @bg-col; - text-color: @blue; -} - -message { - background-color: @bg-col-light; - margin: 2px; - padding: 2px; - border-radius: 5px; -} - -textbox { - padding: 6px; - margin: 20px 0px 0px 20px; - text-color: @blue; - background-color: @bg-col-light; -} diff --git a/nix/nixos/home-manager/desktop/rofi/catppuccin-mocha.rasi b/nix/nixos/home-manager/desktop/rofi/catppuccin-mocha.rasi deleted file mode 100644 index 6cccf7a..0000000 --- a/nix/nixos/home-manager/desktop/rofi/catppuccin-mocha.rasi +++ /dev/null @@ -1,112 +0,0 @@ -* { - bg-col: #1e1e2e; - bg-col-light: #1e1e2e; - border-col: #f5c2e7; - selected-col: #1e1e2e; - blue: #89b4fa; - fg-col: #cdd6f4; - fg-col2: #f38ba8; - grey: #6c7086; - - width: 600; - font: "JetBrainsMono Nerd Font 14"; -} - -element-text, element-icon , mode-switcher { - background-color: inherit; - text-color: inherit; -} - -window { - height: 360px; - border: 3px; - border-color: @border-col; - border-radius: 5px; - background-color: @bg-col; -} - -mainbox { - background-color: @bg-col; -} - -inputbar { - children: [prompt,entry]; - background-color: @bg-col; - border-radius: 5px; - padding: 2px; -} - -prompt { - background-color: @blue; - padding: 6px; - text-color: @bg-col; - border-radius: 3px; - margin: 20px 0px 0px 20px; -} - -textbox-prompt-colon { - expand: false; - str: ":"; -} - -entry { - padding: 6px; - margin: 20px 0px 0px 10px; - text-color: @fg-col; - background-color: @bg-col; -} - -listview { - border: 0px 0px 0px; - padding: 6px 0px 0px; - margin: 10px 0px 0px 20px; - columns: 2; - lines: 5; - background-color: @bg-col; -} - -element { - padding: 5px; - background-color: @bg-col; - text-color: @fg-col ; -} - -element-icon { - size: 25px; -} - -element selected { - background-color: @selected-col ; - text-color: @fg-col2 ; -} - -mode-switcher { - spacing: 0; - } - -button { - padding: 10px; - background-color: @bg-col-light; - text-color: @grey; - vertical-align: 0.5; - horizontal-align: 0.5; -} - -button selected { - background-color: @bg-col; - text-color: @blue; -} - -message { - background-color: @bg-col-light; - margin: 2px; - padding: 2px; - border-radius: 5px; -} - -textbox { - padding: 6px; - margin: 20px 0px 0px 20px; - text-color: @blue; - background-color: @bg-col-light; -} diff --git a/nix/nixos/home-manager/desktop/swaylock.nix b/nix/nixos/home-manager/desktop/swaylock.nix deleted file mode 100644 index 76770c4..0000000 --- a/nix/nixos/home-manager/desktop/swaylock.nix +++ /dev/null @@ -1,45 +0,0 @@ -{pkgs, ...}: { - programs.swaylock = { - enable = true; - package = pkgs.swaylock-effects; - settings = { - image = "$HOME/Pictures/wallpaper.png"; - color = "000000ff"; - font-size = "24"; - indicator-idle-visible = true; - clock = true; - timestr = "%H:%M"; - datestr = "%A, %d %B"; - - indicator = true; - indicator-radius = "100"; - indicator-thickness = "10"; - - effect-blur = "30x2"; - effect-vignette = "0.5:0.5"; - - text-color = "cdd6f4"; - text-clear-color = "11111b"; - text-ver-color = "11111b"; - text-wrong-color = "11111b"; - - ring-color = "1e1e2e"; - key-hl-color = "f5c2e7"; - line-color = "f5c2e7"; - inside-color = "00000088"; - separator-color = "00000000"; - - inside-clear-color = "f2cdcd88"; - line-clear-color = "f2cdcd"; - ring-clear-color = "f2cdcd"; - - inside-ver-color = "89dceb88"; - line-ver-color = "89dceb"; - ring-ver-color = "89dceb"; - - inside-wrong-color = "f38ba888"; - line-wrong-color = "f38ba8"; - ring-wrong-color = "f38ba8"; - }; - }; -} diff --git a/nix/nixos/home-manager/desktop/wallpapers/2.jpg b/nix/nixos/home-manager/desktop/wallpapers/2.jpg deleted file mode 100644 index cf18b49..0000000 Binary files a/nix/nixos/home-manager/desktop/wallpapers/2.jpg and /dev/null differ diff --git a/nix/nixos/home-manager/desktop/wallpapers/3.png b/nix/nixos/home-manager/desktop/wallpapers/3.png deleted file mode 100644 index 5015aca..0000000 Binary files a/nix/nixos/home-manager/desktop/wallpapers/3.png and /dev/null differ diff --git a/nix/nixos/home-manager/desktop/wallpapers/cityscape2.jpg b/nix/nixos/home-manager/desktop/wallpapers/cityscape2.jpg deleted file mode 100644 index 959b132..0000000 Binary files a/nix/nixos/home-manager/desktop/wallpapers/cityscape2.jpg and /dev/null differ diff --git a/nix/nixos/home-manager/desktop/wallpapers/girl.gif b/nix/nixos/home-manager/desktop/wallpapers/girl.gif deleted file mode 100644 index 23853db..0000000 Binary files a/nix/nixos/home-manager/desktop/wallpapers/girl.gif and /dev/null differ diff --git a/nix/nixos/home-manager/desktop/wallpapers/gruvbox_Animesummer.png b/nix/nixos/home-manager/desktop/wallpapers/gruvbox_Animesummer.png deleted file mode 100644 index 4a976f2..0000000 Binary files a/nix/nixos/home-manager/desktop/wallpapers/gruvbox_Animesummer.png and /dev/null differ diff --git a/nix/nixos/home-manager/desktop/wallpapers/lofi.gif b/nix/nixos/home-manager/desktop/wallpapers/lofi.gif deleted file mode 100644 index 3ddc139..0000000 Binary files a/nix/nixos/home-manager/desktop/wallpapers/lofi.gif and /dev/null differ diff --git a/nix/nixos/home-manager/desktop/wallpapers/waterfall.gif b/nix/nixos/home-manager/desktop/wallpapers/waterfall.gif deleted file mode 100644 index 85398c4..0000000 Binary files a/nix/nixos/home-manager/desktop/wallpapers/waterfall.gif and /dev/null differ diff --git a/nix/nixos/home-manager/desktop/waybar.nix b/nix/nixos/home-manager/desktop/waybar.nix deleted file mode 100644 index 1da7523..0000000 --- a/nix/nixos/home-manager/desktop/waybar.nix +++ /dev/null @@ -1,148 +0,0 @@ -{pkgs, ...}: let - hyprctl = "${pkgs.hyprland}/bin/hyprctl"; - blueberry = "${pkgs.blueberry}/bin/blueberry"; -in { - programs.waybar = { - enable = true; - package = pkgs.waybar; - - systemd = { - enable = false; - target = "hyprland-session.target"; - }; - - style = pkgs.substituteAll { - src = ./waybar/waybar.css; - }; - - settings = { - mainBar = { - layer = "top"; - position = "top"; - margin = "10 10 0 10"; - - modules-left = [ - "hyprland/workspaces" - "hyprland/window" - ]; - - modules-center = [ - "clock" - ]; - modules-right = [ - "hyprland/language" - "cpu" - "memory" - "temperature" - "pulseaudio" - "bluetooth" - "network" - "tray" - "battery" - "custom/power" - ]; - - bluetooth = { - "format" = "󰂯"; - "format-disabled" = "󰂲"; - "format-connected" = "󰂱"; - "tooltip-format" = "{controller_alias}\t{controller_address}"; - "tooltip-format-connected" = "{controller_alias}\t{controller_address}\n\n{device_enumerate}"; - "tooltip-format-enumerate-connected" = "{device_alias}\t\t{device_address}"; - "on-click" = "blueberry"; - }; - - "hyprland/workspaces" = { - format = "{icon}"; - on-click = "activate"; - all-outputs = true; - format-icons = { - "urgent" = " "; - "active" = " "; - "default" = " "; - }; - }; - - "hyprland/window" = { - max-length = 25; - separate-outputs = true; - }; - "cpu" = { - format = "󰌢 {load}"; - tooltip = false; - on-click = "gnome-system-monitor"; - }; - "memory" = { - format = " {}%"; - }; - "disk" = { - interval = 600; - format = " {percentage_used}%"; - path = "/"; - }; - "clock" = { - format = " {:%b %d %H:%M}"; - tooltip-format = "{:%Y %B}\n\n{calendar}"; - format-alt = "{:%Y-%m-%d}"; - }; - "temperature" = { - thermal-zone = 0; - critical-threshold = 80; - format = "{icon} {temperatureC}°C"; - format-icons = ["" "" "" "" ""]; - }; - "custom/kernel" = { - interval = "once"; - format = " {}"; - exec = "uname -r"; - }; - network = { - format-wifi = "󰖩"; - format-ethernet = "{ifname}: {ipaddr}/{cidr} 󰈀"; - format-linked = "{ifname} (No IP) 󰈀"; - format-disconnected = "󰖪"; - format-alt = "{ifname}: {ipaddr}/{cidr}"; - }; - "pulseaudio" = { - format = "{icon} {volume}% {format_source}"; - format-muted = " {format_source}"; - format-source = ""; - format-source-muted = ""; - format-icons = {"default" = ["" "" ""];}; - scroll-step = 1; - tooltip-format = "{desc}; {volume}%"; - # on-click = "pactl set-sink-mute @DEFAULT_SINK@ toggle"; - on-click = "${pkgs.pamixer}/bin/pamixer -t"; - on-click-right = "pactl set-source-mute @DEFAULT_SOURCE@ toggle"; - on-click-middle = "pavucontrol"; - }; - "hyprland/language" = { - # "format-dh" = " dh"; - "format-en" = " dh"; - "format-ru" = " ru"; - "keyboard-name" = "at-translated-set-2-keyboard"; - on-click = "${hyprctl} switchxkblayout at-translated-set-2-keyboard next"; - }; - "battery" = { - # on-click = "cpupower-gui"; - bat = "BAT0"; - states = { - "good" = 95; - "warning" = 30; - "critical" = 15; - }; - format = "{icon} {capacity}%"; - format-charging = " {capacity}%"; - format-plugged = " {capacity}%"; - format-alt = "{time} {icon}"; - format-icons = [" " " " " " " " " "]; - }; - "tray" = {spacing = 10;}; - "custom/power" = { - format = ""; - on-click = "wlogout -p layer-shell"; - }; - }; - }; - }; -} diff --git a/nix/nixos/home-manager/home.nix b/nix/nixos/home-manager/home.nix deleted file mode 100644 index 1984228..0000000 --- a/nix/nixos/home-manager/home.nix +++ /dev/null @@ -1,86 +0,0 @@ -# This is your home-manager configuration file -# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) -{ - inputs, - pkgs, - ... -}: { - # You can import other home-manager modules here - imports = [ - # If you want to use home-manager modules from other flakes (such as nix-colors): - # inputs.nix-colors.homeManagerModule - - # You can also split up your configuration and import pieces of it here: - ./desktop/hyprpaper.nix - ./desktop/mako.nix - ./mime.nix - ./desktop/rofi.nix - ./desktop/swaylock.nix - ./desktop/waybar.nix - ]; - - nixpkgs = { - # You can add overlays here - overlays = [ - # If you want to use overlays exported from other flakes: - # neovim-nightly-overlay.overlays.default - - # Or define it inline, for example: - # (final: prev: { - # hi = final.hello.overrideAttrs (oldAttrs: { - # patches = [ ./change-hello-to-hi.patch ]; - # }); - # }) - ]; - # Configure your nixpkgs instance - config = { - # Disable if you don't want unfree packages - allowUnfree = true; - # Workaround for https://github.com/nix-community/home-manager/issues/2942 - allowUnfreePredicate = _: true; - }; - }; - - home = { - username = "sab"; - homeDirectory = "/home/sab"; - }; - - # Add stuff for your user as you see fit: - # programs.neovim.enable = true; - home.packages = with pkgs; [ - awscli2 - bluez-tools - brightnessctl - cargo - fd - feh - fzf - gh - glib # required for mime - k9s - kubectl - neofetch - networkmanagerapplet - papirus-icon-theme - pcmanfm - ripgrep - slack - swayidle - wl-clipboard - xdg-utils - zoom-us - ]; - - programs.firefox.enable = true; - programs.wlogout.enable = true; - - services.copyq = { - enable = true; - }; - # Nicely reload system units when changing configs - systemd.user.startServices = "sd-switch"; - - # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - home.stateVersion = "23.11"; -} diff --git a/nix/nixos/packages.nix b/nix/nixos/packages.nix deleted file mode 100644 index 5d9b486..0000000 --- a/nix/nixos/packages.nix +++ /dev/null @@ -1,31 +0,0 @@ -{pkgs, ...}: { - # Load configuration that is shared across systems - environment.systemPackages = with pkgs; - [ - adwaita-qt - adwaita-qt6 - blueberry - file - gnome.gnome-tweaks - grim # Screenshot tool for hyprland - slurp # Works with grim to screenshot on wayland - gnumake - home-manager - hyprland-protocols - hyprpaper - hyprpicker - nfs-utils - traceroute - pamixer - polkit_gnome - qt5.qtwayland - qt6.qmake - qt6.qtwayland - vlc - xdg-desktop-portal - xdg-desktop-portal-hyprland - xdg-utils - zathura # PDF viewer - ] - ++ (import ../shared/packages.nix {inherit pkgs;}); -} diff --git a/nix/nixos/programs.nix b/nix/nixos/programs.nix deleted file mode 100644 index c82aafe..0000000 --- a/nix/nixos/programs.nix +++ /dev/null @@ -1,62 +0,0 @@ -{pkgs, ...}: { - programs = { - hyprland.enable = true; - hyprland.xwayland.enable = true; - fish = { - enable = true; - shellAliases = { - nixup = "sudo nixos-rebuild switch --flake ~/dotfiles/nix#nz"; - nixt = "sudo nixos-rebuild test --flake ~/dotfiles/nix#nz"; - nixclean = "sudo nix-collect-garbage -d && sudo nix-store --gc && sudo nix-store --repair --verify --check-contents && sudo nix-store --optimise -vvv"; - homeup = "home-manager switch --flake ~/dotfiles/nix"; - }; - interactiveShellInit = "source ~/dotfiles/fish/functions/l.fish"; - }; - tmux.enable = true; - neovim.enable = true; - neovim.defaultEditor = true; - neovim.vimAlias = true; - git.enable = true; - gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - }; - - environment.sessionVariables = { - POLKIT_AUTH_AGENT = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; - GSETTINGS_SCHEMA_DIR = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}/glib-2.0/schemas"; - XDG_SESSION_TYPE = "wayland"; - NIXOS_OZONE_WL = "1"; - MOZ_ENABLE_WAYLAND = "1"; - SDL_VIDEODRIVER = "wayland"; - CLUTTER_BACKEND = "wayland"; - XDG_CURRENT_DESKTOP = "Hyprland"; - XDG_SESSION_DESKTOP = "Hyprland"; - }; - - fonts.packages = with pkgs; [ - (nerdfonts.override {fonts = ["CascadiaCode" "FiraCode"];}) - ]; - - environment.gnome.excludePackages = - (with pkgs; [ - gnome-photos - gnome-tour - ]) - ++ (with pkgs.gnome; [ - cheese # webcam tool - gnome-music - gedit # text editor - epiphany # web browser - geary # email reader - gnome-characters - tali # poker game - iagno # go game - hitori # sudoku game - atomix # puzzle game - yelp # Help view - gnome-contacts - gnome-initial-setup - ]); -} diff --git a/nix/nixos/regreet.patch b/nix/nixos/regreet.patch deleted file mode 100644 index 34e1113..0000000 --- a/nix/nixos/regreet.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/gui/component.rs b/src/gui/component.rs -index 692309c..f2fb9c0 100644 ---- a/src/gui/component.rs -+++ b/src/gui/component.rs -@@ -371,7 +371,7 @@ impl AsyncComponent for Greeter { - if let Some(monitor) = &model.updates.monitor { - // The window needs to be manually fullscreened, since the monitor is `None` at widget - // init. -- root.fullscreen_on_monitor(monitor); -+ // root.fullscreen_on_monitor(monitor); - } else { - // Couldn't choose a monitor, so let the compositor choose it for us. - root.fullscreen(); diff --git a/nix/nixos/users.nix b/nix/nixos/users.nix deleted file mode 100644 index c3339b2..0000000 --- a/nix/nixos/users.nix +++ /dev/null @@ -1,14 +0,0 @@ -{pkgs, ...}: { - users.defaultUserShell = pkgs.fish; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.sab = { - isNormalUser = true; - description = "Sergei"; - extraGroups = ["networkmanager" "wheel"]; - packages = with pkgs; [ - # firefox - # thunderbird - ]; - }; -} diff --git a/nix/packages/sys/default.nix b/nix/packages/sys/default.nix new file mode 100644 index 0000000..c9c6491 --- /dev/null +++ b/nix/packages/sys/default.nix @@ -0,0 +1,64 @@ +{writeShellScriptBin, ...}: +writeShellScriptBin "sys" '' + + cmd_rebuild() { + echo "🔨 Building system configuration with $REBUILD_COMMAND" + $REBUILD_COMMAND switch --flake ~/dotfiles/nix# + } + + cmd_test() { + echo "🏗️ Building ephemeral system configuration with $REBUILD_COMMAND" + $REBUILD_COMMAND test --fast --flake ~/dotfiles/nix# + } + + # TODO: Make it update a single input + cmd_update() { + echo "🔒Updating flake.lock" + nix flake update + } + + cmd_clean() { + echo "🗑️ Cleaning and optimizing the Nix store." + nix store optimise --verbose && + nix store gc --verbose + } + + cmd_usage() { + cat <<-_EOF + Usage: + $PROGRAM rebuild + Rebuild the system. (You must be in the system flake directory!) + Must be run as root. + $PROGRAM test + Like rebuild but faster and not persistant. + $PROGRAM update [input] + Update all inputs or the input specified. (You must be in the system flake directory!) + Must be run as root. + $PROGRAM clean + Garbage collect and optimise the Nix Store. + $PROGRAM help + Show this text. + _EOF + } + + + if [[ "$OSTYPE" == "linux"* ]]; then + REBUILD_COMMAND=nixos-rebuild + elif [[ "$OSTYPE" == "darwin"* ]]; then + REBUILD_COMMAND=darwin-rebuild + fi + + # Subcommand utils based on pass + + PROGRAM=sys + COMMAND="$1" + case "$1" in + rebuild|r) shift; cmd_rebuild ;; + test|t) shift; cmd_test ;; + update|u) shift; cmd_update ;; + clean|c) shift; cmd_clean ;; + help|--help) shift; cmd_usage "$@" ;; + *) echo "Unknown command: $@" ;; + esac + exit 0 +'' diff --git a/nix/shared/cachix/default.nix b/nix/shared/cachix/default.nix deleted file mode 100644 index 37339e9..0000000 --- a/nix/shared/cachix/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ pkgs, lib, ... }: -{ - nix.settings = { - substituters = [ - "https://nix-community.cachix.org" - "https://cache.nixos.org/" - ]; - trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; -} diff --git a/nix/shared/default.nix b/nix/shared/default.nix deleted file mode 100644 index ad64560..0000000 --- a/nix/shared/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ config, pkgs, ... }: - -# let -# emacsOverlaySha256 = "1xz956v01l3d1nzmcjbn016sn669mfq2wx9asgl85yyvvz7m7f38"; -# in -{ - - nixpkgs = { - config = { - allowUnfree = true; - allowBroken = true; - allowInsecure = false; - allowUnsupportedSystem = true; - }; - }; - - # overlays = - # # Apply each overlay found in the /overlays directory - # let path = ../overlays; in with builtins; - # map (n: import (path + ("/" + n))) - # (filter (n: match ".*\\.nix" n != null || - # pathExists (path + ("/" + n + "/default.nix"))) - # (attrNames (readDir path))); - - # # ++ [(import (builtins.fetchTarball { - # # url = "https://github.com/dustinlyons/emacs-overlay/archive/refs/heads/master.tar.gz"; - # # sha256 = emacsOverlaySha256; - # # }))]; -} diff --git a/nix/shared/home-manager.nix b/nix/shared/home-manager.nix deleted file mode 100644 index b35a55c..0000000 --- a/nix/shared/home-manager.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: let - name = "Sergei Bulavintsev"; - user = "sab"; -in { - # atuin = { - # enable = true; - # # Doesn't work for me right now, explicitly do it via fish - # enableFishIntegration = false; - # }; -} diff --git a/nix/shared/packages.nix b/nix/shared/packages.nix deleted file mode 100644 index 8b1e315..0000000 --- a/nix/shared/packages.nix +++ /dev/null @@ -1,45 +0,0 @@ -{pkgs}: -with pkgs; [ - alejandra - atuin - bat - cmake - ctags - curl - dig - fd - ffmpeg - fish - fzf - gcc - gh - gnupg - go - helm-docs - home-manager - iftop - ipfetch - jq - k9s - kitty - krew - kubectl - kubectx - kubernetes-helm - lf - lua-language-server # LSP for lua - marksman # LSP for markdown - mtr - neovim - ripgrep - rnix-lsp # LSP for nix - rsync - stylua - tmux - tree - tree-sitter - unzip - wget - yamllint - yq -] diff --git a/nix/shells/default/default.nix b/nix/shells/default/default.nix new file mode 100644 index 0000000..a023090 --- /dev/null +++ b/nix/shells/default/default.nix @@ -0,0 +1,10 @@ +{pkgs, ...}: +pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + treefmt + + alejandra + python310Packages.mdformat + shfmt + ]; +} diff --git a/nix/systems/aarch64-darwin/mbp/default.nix b/nix/systems/aarch64-darwin/mbp/default.nix new file mode 100644 index 0000000..a5b0be3 --- /dev/null +++ b/nix/systems/aarch64-darwin/mbp/default.nix @@ -0,0 +1,21 @@ +{ + lib, + pkgs, + ... +}: +with lib.custom; { + custom = { + suites = { + common = enabled; + development = enabled; + }; + + desktop.yabai = enabled; + }; + + environment.systemPath = [ + "/opt/homebrew/bin" + ]; + + system.stateVersion = 4; +} diff --git a/nix/systems/x86_64-linux/nz/default.nix b/nix/systems/x86_64-linux/nz/default.nix new file mode 100644 index 0000000..ec4af25 --- /dev/null +++ b/nix/systems/x86_64-linux/nz/default.nix @@ -0,0 +1,25 @@ +{pkgs, ...}: { + imports = [./hardware-configuration.nix]; + + # Enable Bootloader + system.boot.efi.enable = true; + system.battery.enable = true; # Only for laptops, they will still work without it, just improves battery life + hardware.fingerprint.enable = true; + hardware.bluetoothmy.enable = true; + + # environment.systemPackages = with pkgs; [ + # # Any particular packages only for this host + # ]; + + suites.common.enable = true; # Enables the basics, like audio, networking, ssh, etc. + suites.desktop.enable = true; + suites.develop.enable = true; + + custom.cli-apps = { + yazi.enable = true; + }; + + # ======================== DO NOT CHANGE THIS ======================== + system.stateVersion = "23.11"; + # ======================== DO NOT CHANGE THIS ======================== +} diff --git a/nix/nixos/hardware-configuration.nix b/nix/systems/x86_64-linux/nz/hardware-configuration.nix similarity index 86% rename from nix/nixos/hardware-configuration.nix rename to nix/systems/x86_64-linux/nz/hardware-configuration.nix index 3bd6c0f..dc20ebd 100644 --- a/nix/nixos/hardware-configuration.nix +++ b/nix/systems/x86_64-linux/nz/hardware-configuration.nix @@ -27,6 +27,12 @@ fsType = "vfat"; }; + fileSystems."/mnt/tank" = { + device = "truenas.sbulav.ru:/mnt/tank"; + options = ["x-systemd.automount" "x-systemd.idle-timeout=600" "noauto"]; + fsType = "nfs"; + }; + swapDevices = [ {device = "/dev/disk/by-uuid/73002676-c9b2-46e8-a987-5bf002c91cbc";} ]; @@ -36,6 +42,9 @@ # still possible to use this option, but it's recommended to use it in conjunction # with explicit per-interface declarations with `networking.interfaces..useDHCP`. networking.useDHCP = lib.mkDefault true; + networking.hosts = { + "192.168.89.200" = ["truenas.sbulav.ru"]; + }; # networking.interfaces.enp2s0f0.useDHCP = lib.mkDefault true; # networking.interfaces.enp5s0.useDHCP = lib.mkDefault true; # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; diff --git a/nix/templates/default.nix b/nix/templates/default.nix new file mode 100644 index 0000000..21e07c7 --- /dev/null +++ b/nix/templates/default.nix @@ -0,0 +1,17 @@ +{...}: { + lib = { + path = ./lib; + }; + module = { + path = ./module; + }; + overlay = { + path = ./overlay; + }; + system = { + path = ./system; + }; + home = { + path = ./home; + }; +} diff --git a/nix/templates/lib/default.nix b/nix/templates/lib/default.nix new file mode 100644 index 0000000..f9a1360 --- /dev/null +++ b/nix/templates/lib/default.nix @@ -0,0 +1,2 @@ +{lib, ...}: +with lib; rec {} diff --git a/nix/templates/module/default.nix b/nix/templates/module/default.nix new file mode 100644 index 0000000..f24403f --- /dev/null +++ b/nix/templates/module/default.nix @@ -0,0 +1,19 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.module; +in { + options.module = with types; { + enable = mkBoolOpt false "Enable module"; + }; + + config = + mkIf cfg.enable { + }; +} diff --git a/nix/templates/overlay/default.nix b/nix/templates/overlay/default.nix new file mode 100644 index 0000000..b08dfc4 --- /dev/null +++ b/nix/templates/overlay/default.nix @@ -0,0 +1,3 @@ +_: (final: prev: { + package = prev.package.override {}; +}) diff --git a/nix/templates/system/default.nix b/nix/templates/system/default.nix new file mode 100644 index 0000000..97d0567 --- /dev/null +++ b/nix/templates/system/default.nix @@ -0,0 +1,31 @@ +{ + config, + pkgs, + ... +}: { + imports = [./hardware-configuration.nix]; + + # Enable Bootloader (EFI or BIOS) + #system.boot.efi.enable = true; + #system.boot.bios.enable = true; + + # Better battery life on laptops + # system.battery.enable = true; + + # suites.desktop.enable = true; + # suites.development.enable = true; + + # suites.server.enable = true; + + # Nvidia Drivers + # hardware.nvidia.enable = true; + + # Add packages (custom for ones in these dotfiles) + # environment.systemPackages = with pkgs; [ + # custom.package + # ]; + + # ======================== DO NOT CHANGE THIS ======================== + system.stateVersion = "22.11"; + # ======================== DO NOT CHANGE THIS ======================== +} diff --git a/nvim/after/plugin/keymap.vim b/nvim/after/plugin/keymap.vim index 872566a..3c54691 100644 --- a/nvim/after/plugin/keymap.vim +++ b/nvim/after/plugin/keymap.vim @@ -18,6 +18,7 @@ augroup pscbindings autocmd FileType terraform nnoremap :Nredir !terraform apply --auto-approve autocmd FileType typescript nnoremap :Nredir !npm run build && npm run test && npm run lint autocmd FileType dockerfile nnoremap lua require('nredir').nredir("!hadolint " .. vim.fn.bufname()) + autocmd FileType nix nnoremap lua require('nredir').nredir("!nix eval --file " .. vim.fn.bufname()) augroup end " Draw a visual line in any mode on F1 @@ -147,7 +148,8 @@ nnoremap fM lua require('telescope.builtin').marks() nnoremap fa lua require('telescope.builtin').live_grep() nnoremap fb lua require('telescope.builtin').buffers() nnoremap fc lua require('telescope.builtin').git_commits() -nnoremap ff lua require('telescope.builtin').find_files() +nnoremap fF lua require('telescope.builtin').find_files() +nnoremap ff lua require('config.telescope_myfunctions').search_in_cwd() nnoremap fg lua require('telescope.builtin').current_buffer_fuzzy_find() nnoremap fh lua require('telescope.builtin').oldfiles() nnoremap fm lua require('telescope.builtin').keymaps() @@ -157,11 +159,11 @@ nnoremap ft lua require('telescope.builtin').help_tags() nnoremap fv lua require('config.telescope_myfunctions').search_vimfiles() nnoremap fd lua require('config.telescope_myfunctions').search_dotfiles() nnoremap gb lua require('telescope.builtin').git_branches() -nnoremap gr lua require'telescope'.extensions.gh.run{} -nnoremap gp lua require'telescope'.extensions.gh.pull_request{} -nnoremap gi lua require'telescope'.extensions.gh.gist{} -nnoremap gs lua require'telescope'.extensions.gh.secret{} -nnoremap td :Telescope terraform_doc full_name=hashicorp/aws version=3.74.0 +" nnoremap gr lua require'telescope'.extensions.gh.run{} +" nnoremap gp lua require'telescope'.extensions.gh.pull_request{} +" nnoremap gi lua require'telescope'.extensions.gh.gist{} +" nnoremap gs lua require'telescope'.extensions.gh.secret{} +" nnoremap td :Telescope terraform_doc full_name=hashicorp/aws version=3.74.0 " nnoremap tp lua require'telescope'.extensions.terraform.plan{} " nnoremap tP lua require'telescope'.extensions.terraform.plan_targeted{} " nnoremap ta lua require'telescope'.extensions.terraform.apply{} diff --git a/nvim/lua/config/lazy.lua b/nvim/lua/config/lazy.lua index 59f47da..d72fa80 100644 --- a/nvim/lua/config/lazy.lua +++ b/nvim/lua/config/lazy.lua @@ -43,4 +43,4 @@ require("lazy").setup("plugins", { }, }, }) -vim.cmd.colorscheme "monet" +vim.cmd.colorscheme "base16-oceanicnext" diff --git a/nvim/lua/config/mappings.lua b/nvim/lua/config/mappings.lua index 30bf9b8..46f03b5 100644 --- a/nvim/lua/config/mappings.lua +++ b/nvim/lua/config/mappings.lua @@ -96,15 +96,8 @@ vim.keymap.set({ "i", "s" }, "", function() end, attach_opts) vim.keymap.set("n", "", function() - require("lf").start { - -- Pass options (if any) that you would like - -- dir = ".", -- directory where `lf` starts ('gwd' is git-working-directory) - direction = "float", -- window type: float horizontal vertical - border = "double", -- border kind: single double shadow curved - height = 52, -- height of the *floating* window - width = 150, -- width of the *floating* window - mappings = false, -- whether terminal buffer mapping is enabled - } + -- require("yazi").yazi {} + require("tfm").open() end, { noremap = true, silent = true }) vim.keymap.set("n", "yn", function() diff --git a/nvim/lua/config/snippets.lua b/nvim/lua/config/snippets.lua index 32c2f9b..55f8bbe 100644 --- a/nvim/lua/config/snippets.lua +++ b/nvim/lua/config/snippets.lua @@ -18,7 +18,7 @@ ls.config.set_config { -- minimal increase in priority. ext_prio_increase = 1, enable_autosnippets = false, - store_selection_keys = "", + store_selection_keys = "", } local function get_line_iter(str) diff --git a/nvim/lua/config/telescope_myfunctions.lua b/nvim/lua/config/telescope_myfunctions.lua index c37a367..c720a01 100644 --- a/nvim/lua/config/telescope_myfunctions.lua +++ b/nvim/lua/config/telescope_myfunctions.lua @@ -14,6 +14,13 @@ M.search_plugins = function() } end +M.search_in_cwd = function() + require("telescope.builtin").find_files { + prompt_title = "< Find in Current Directory >", + cwd = vim.fn.expand "%:p:h", + } +end + M.search_vimfiles = function() require("telescope.builtin").find_files { prompt_title = "< Find Vimfiles >", diff --git a/nvim/lua/plugins/alpha.lua b/nvim/lua/plugins/alpha.lua index 9172e9e..668b094 100644 --- a/nvim/lua/plugins/alpha.lua +++ b/nvim/lua/plugins/alpha.lua @@ -14,7 +14,7 @@ return { local datetime = os.date " %d-%m-%Y  %H:%M:%S" local platform = vim.fn.has "win32" == 1 and "" or "" return string.format( - "  %d  v%d.%d.%d %s %s", + " 󰂔 %d  v%d.%d.%d %s %s", stats.count, v.major, v.minor, diff --git a/nvim/lua/plugins/completion.lua b/nvim/lua/plugins/completion.lua index 5157dff..713ec93 100644 --- a/nvim/lua/plugins/completion.lua +++ b/nvim/lua/plugins/completion.lua @@ -12,6 +12,7 @@ return { config = function() require("luasnip").config.setup { updateevents = "TextChanged,TextChangedI", + store_selection_keys = "", } require "config.snippets" end, @@ -45,31 +46,31 @@ return { end local lsp_symbols = { - Text = "  (Text) ", - Method = "  (Method)", - Function = "  (Function)", - Constructor = "  (Constructor)", - Field = " ﴲ (Field)", - Variable = "[] (Variable)", - Class = "  (Class)", - Interface = " ﰮ (Interface)", - Module = "  (Module)", - Property = " 襁 (Property)", - Unit = "  (Unit)", - Value = "  (Value)", - Enum = " 練 (Enum)", - Keyword = "  (Keyword)", - Snippet = "  (Snippet)", - Color = "  (Color)", - File = "  (File)", - Reference = "  (Reference)", - Folder = "  (Folder)", - EnumMember = "  (EnumMember)", - Constant = " ﲀ (Constant)", - Struct = " ﳤ (Struct)", - Event = "  (Event)", - Operator = "  (Operator)", - TypeParameter = "  (TypeParameter)", + Text = "󰉿", + Method = "󰆧", + Function = "󰊕", + Constructor = "", + Field = "󰜢", + Variable = "󰀫", + Class = "󰠱", + Interface = "", + Module = "", + Property = "󰜢", + Unit = "󰑭", + Value = "󰎠", + Enum = "", + Keyword = "󰌋", + Snippet = "", + Color = "󰏘", + File = "󰈙", + Reference = "󰈇", + Folder = "󰉋", + EnumMember = "", + Constant = "󰏿", + Struct = "󰙅", + Event = "", + Operator = "󰆕", + TypeParameter = "", } cmp.setup { diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index ab3b6ba..803b040 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -71,28 +71,6 @@ return { }, }, }, - lua_ls = { - settings = { - Lua = { - -- make the language server recognize "vim" global - diagnostics = { - globals = { "vim" }, - }, - - workspace = { - checkThirdParty = false, - }, - library = { - [vim.fn.expand "$VIMRUNTIME/lua"] = true, - [vim.fn.stdpath "config" .. "/lua"] = true, - }, - - completion = { - callSnippet = "Replace", - }, - }, - }, - }, }, -- you can do any additional lsp server setup here -- return true if you don't want this server to be setup with lspconfig @@ -139,6 +117,29 @@ return { -- manually configured servers require("lspconfig")["rnix"].setup {}, require("lspconfig")["marksman"].setup { cmd = { "marksman", "server" } }, + + require("lspconfig")["lua_ls"].setup { + settings = { + Lua = { + -- make the language server recognize "vim" global + diagnostics = { + globals = { "vim" }, + }, + + workspace = { + checkThirdParty = false, + }, + library = { + [vim.fn.expand "$VIMRUNTIME/lua"] = true, + [vim.fn.stdpath "config" .. "/lua"] = true, + }, + + completion = { + callSnippet = "Replace", + }, + }, + }, + }, } end, }, @@ -150,7 +151,6 @@ return { cmd = "Mason", opts = { ensure_installed = { - "black", "eslint_d", "flake8", "goimports", @@ -159,15 +159,17 @@ return { "jq", "json-lsp", "jsonnet-language-server", - "lua-language-server", - "marksman", "prettierd", - "pyright", - "shellcheck", "shfmt", - "stylua", "terraform-ls", "yaml-language-server", + -- Managed via Nix, DO NOT INSTALL IN MASON + -- "stylua", + -- "alejandra", + -- "pyright", + -- "black", + -- "marksman", + "lua-language-server", }, }, ---@param opts MasonSettings | {ensure_installed: string[]} diff --git a/nvim/lua/plugins/misc.lua b/nvim/lua/plugins/misc.lua index dabef78..0330244 100644 --- a/nvim/lua/plugins/misc.lua +++ b/nvim/lua/plugins/misc.lua @@ -9,16 +9,34 @@ return { }, { "janko/vim-test", cmd = { "TestNearest", "TestFile", "TestSuite", "TestLast", "TestVisit" } }, - -- Tree file manager { - "lmburns/lf.nvim", - config = function() - require("lf").setup { - escape_quit = false, + "rolv-apneseth/tfm.nvim", + opts = { + file_manager = "yazi", + replace_netrw = true, + keybindings = { + [""] = "q", + }, + -- Customise UI. The below options are the default + ui = { border = "rounded", - } - end, + height = 0.9, + width = 0.9, + x = 0.5, + y = 0.5, + }, + }, }, + -- { + -- "DreamMaoMao/yazi.nvim", + -- dependencies = { + -- "nvim-telescope/telescope.nvim", + -- "nvim-lua/plenary.nvim", + -- }, + -- config = function() + -- require("yazi").setup {} + -- end, + -- }, -- Redirect output to scratch buffer "sbulav/nredir.nvim", diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua index 94cd72e..da8a9a8 100644 --- a/nvim/lua/plugins/telescope.lua +++ b/nvim/lua/plugins/telescope.lua @@ -3,8 +3,8 @@ return { dependencies = { { "nvim-lua/popup.nvim" }, { "nvim-lua/plenary.nvim" }, - { "nvim-telescope/telescope-github.nvim" }, - { "ANGkeith/telescope-terraform-doc.nvim" }, + -- { "nvim-telescope/telescope-github.nvim" }, + -- { "ANGkeith/telescope-terraform-doc.nvim" }, }, config = function() local telescope = require "telescope" @@ -53,8 +53,8 @@ return { }, }, } - telescope.load_extension "gh" - telescope.load_extension "terraform_doc" + -- telescope.load_extension "gh" + -- telescope.load_extension "terraform_doc" -- telescope.load_extension "env" -- telescope.load_extension "terraform" end, diff --git a/nvim/lua/utils/init.lua b/nvim/lua/utils/init.lua index 0d9d4c7..81cf616 100644 --- a/nvim/lua/utils/init.lua +++ b/nvim/lua/utils/init.lua @@ -52,7 +52,12 @@ function M.cheatSheetCommand(detect_language) end end - local command = language .. "/" .. searchPhrase + local command = "" + if searchPhrase == nil then + command = language + else + command = language .. "/" .. searchPhrase + end M.info("cht.sh/" .. command, "Cheat Sheet Query") return ("!curl -s cht.sh/" .. command) diff --git a/templates/README.md b/templates/README.md deleted file mode 100644 index 04d05d0..0000000 --- a/templates/README.md +++ /dev/null @@ -1,64 +0,0 @@ -# My configuration files - -[![Always wip](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRrgUjNod0ETGyHau0Tkn-WAnFjXLP493ryUQ&usqp=CAU)] -[![GitGuardian scan](https://github.com/sbulav/dotfiles/actions/workflows/gitguardian.yml/badge.svg)](https://github.com/sbulav/dotfiles/actions/workflows/gitguardian.yml) -[![release-please](https://github.com/sbulav/dotfiles/actions/workflows/please_release.yml/badge.svg)](https://github.com/sbulav/dotfiles/actions/workflows/please_release.yml) - -This file is auto-generated, do not modify it! - -## Nix - -I am currently in the process of migration to [Nix](https://nixos.org/) - -- MacOS - - [Nix Flakes](https://nixos.wiki/wiki/Flakes) - - [Nix-Darwin](https://github.com/LnL7/nix-darwin) - - [Home-Manager](https://nix-community.github.io/home-manager/) -- NixOS - - [Nix Flakes](https://nixos.wiki/wiki/Flakes) - - [Home-Manager](https://nix-community.github.io/home-manager/) - - [Hyprland](https://wiki.hyprland.org) + Waybar, Swaylock, Rofi, mako, hyprpaper - -To trigger a new build both on Mac and Nix, run - -```sh -./bin/build -``` - -Kudos for config inspiration to: - -- [Introduction to Nix & NixOS](https://nixos-and-flakes.thiscute.world/introduction/) -- [Nix for MacOS by dustinlyons](https://github.com/dustinlyons/nixos-config) -- [Nix starter configs by Misterio77](https://github.com/Misterio76/nix-starter-configs) - -You might also want to check out my blog with [#Nix category](https://sbulav.github.io/categories/#nix) - -### Useful NIX commands - -Quickly try out new package in the shell without installing it: - -```sh -nix shell nixpkgs#glow -``` - -## Automated workflows - -I'm using following workflows to automate management of my dotfiles: -- [automerge-release.yml](.github/workflows/automerge-release.yml) - Merge - changelog automated PR -- [commit_validate.yml](.github/workflows/commit_validate.yml) - Validate - commits are using `conventional commits` style -- [gitguardian.yml](.github/workflows/gitguardian.yml) - Check for leaking - secrets/tokens -- [please_release.yml](.github/workflows/please_release.yml) - Automated - releases based on conventional commits -- [update-readme.yml](.github/workflows/update-readme.yml) - Workflow to - generate this README - - -## Tools installation(Obsolete) - -Run make and specify tool to install: - -```bash -> make diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index a4224b3..daeb00b 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -25,7 +25,7 @@ set -g status-left '#[fg=red,bg=black][#h]#[fg=white,bold] W#I:P#P |#[default]' # Set up right status set -g status-right-length 60 -set -g status-right "| #(/usr/bin/env bash $HOME/.tmux/kube.tmux 250 magenta cyan) #[fg=white]| #[fg=red] [%R]" +set -g status-right "| #(/usr/bin/env bash $HOME/dotfiles/tmux/plugins/kube-tmux/kube.tmux 250 magenta cyan) #[fg=white]| #[fg=red] [%R]" # set -g status-right '| #[fg=red]#(whoami) - [%R] ' # set -g status-right '| #[fg=red] [%R] ' diff --git a/tmux/kube.tmux b/tmux/kube.tmux deleted file mode 120000 index 0674b49..0000000 --- a/tmux/kube.tmux +++ /dev/null @@ -1 +0,0 @@ -/Users/sab/dotfiles/tmux/plugins/kube-tmux/kube.tmux \ No newline at end of file