diff --git a/fish/conf.d/tmux.fish b/fish/conf.d/tmux.fish deleted file mode 100644 index bfdc398..0000000 --- a/fish/conf.d/tmux.fish +++ /dev/null @@ -1,5 +0,0 @@ -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 -end diff --git a/nix/flake.lock b/nix/flake.lock index eefbf63..be4dbd2 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -47,11 +47,11 @@ ] }, "locked": { - "lastModified": 1706833576, - "narHash": "sha256-w7BL0EWRts+nD1lbLECIuz6fRzmmV+z8oWwoY7womR0=", + "lastModified": 1709529951, + "narHash": "sha256-KVqN0Dvf4bg87XYQCHdd1kuJkjA23y5wlTTSOnilLIU=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "bdbae6ecff8fcc322bf6b9053c0b984912378af7", + "rev": "e7d7a7f0c5a184c67b6bff56f95436d83d05fba5", "type": "github" }, "original": { @@ -101,7 +101,7 @@ }, "flake-utils": { "inputs": { - "systems": "systems" + "systems": "systems_4" }, "locked": { "lastModified": 1687709756, @@ -137,7 +137,7 @@ }, "flake-utils_2": { "inputs": { - "systems": "systems_2" + "systems": "systems_5" }, "locked": { "lastModified": 1694529238, @@ -176,11 +176,11 @@ ] }, "locked": { - "lastModified": 1706798041, - "narHash": "sha256-BbvuF4CsVRBGRP8P+R+JUilojk0M60D7hzqE0bEvJBQ=", + "lastModified": 1709485962, + "narHash": "sha256-rmFB4uE10+LJbcVE4ePgiuHOBlUIjQOeZt4VQVJTU8M=", "owner": "nix-community", "repo": "home-manager", - "rev": "4d53427bce7bf3d17e699252fd84dc7468afc46e", + "rev": "d579633ff9915a8f4058d5c439281097e92380a8", "type": "github" }, "original": { @@ -193,11 +193,11 @@ "homebrew-cask": { "flake": false, "locked": { - "lastModified": 1706879948, - "narHash": "sha256-bMr/3iiTuG72bMrTmNTNTFhudMucDP9ndR07FErVkvQ=", + "lastModified": 1709524024, + "narHash": "sha256-WNB/1h5mu0tTLBHfKBx01HQ882jSRVZbrWI//BKYGfc=", "owner": "homebrew", "repo": "homebrew-cask", - "rev": "d216ceb851be55e9dfeb9d5b739d2e1f2a5d103a", + "rev": "422ef679484d2b684c00558268eb6944175207b2", "type": "github" }, "original": { @@ -209,11 +209,11 @@ "homebrew-core": { "flake": false, "locked": { - "lastModified": 1706880160, - "narHash": "sha256-OocK1RxG74yC2jWTbr8f7A33ABIiBjSFOLngsLPBiZc=", + "lastModified": 1709531328, + "narHash": "sha256-wtqwOBg5i3qsU2zbucOHwoO8osbvfkqKFNtXksxmSII=", "owner": "homebrew", "repo": "homebrew-core", - "rev": "e25e07f30fdb4075b08ff4bfe3fd92b1a1099d77", + "rev": "8f3d5c308d9ca2e2db8b73b38b2ef7fd54fc3e0a", "type": "github" }, "original": { @@ -222,6 +222,167 @@ "type": "github" } }, + "hypridle": { + "inputs": { + "hyprlang": "hyprlang", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1709223573, + "narHash": "sha256-xi7yscjt7t8tFcJDgHzxgW15Obcp7dEghG41f6tUmRc=", + "owner": "hyprwm", + "repo": "Hypridle", + "rev": "029f08805a2297966d295a52a6e62c3801926a52", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hypridle", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "hyprlang": "hyprlang_2", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_2", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1709506828, + "narHash": "sha256-4gmgQvJZX5KM5i9bqGEOsHSBVRQhyfSF9BvvfpBFmQE=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "9d89b7109da9b58904caf7c53a7af4b6daed1696", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1691753796, + "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprlang": { + "inputs": { + "nixpkgs": [ + "hypridle", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708212860, + "narHash": "sha256-nW3Zrhh9RJcMTvOcXAaKADnJM/g6tDf3121lJtTHnYo=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "11d5ccda071c153dfdc18ef65338956a51cef96a", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprlang_2": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1708787654, + "narHash": "sha256-7ACgM3ZuAhPqurXHUvR2nWMRcnmzGGPjLK6q4DSTelI=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "0fce791ba2334aca183f2ed42399518947550d0d", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprlang_3": { + "inputs": { + "nixpkgs": [ + "hyprlock", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708212860, + "narHash": "sha256-nW3Zrhh9RJcMTvOcXAaKADnJM/g6tDf3121lJtTHnYo=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "11d5ccda071c153dfdc18ef65338956a51cef96a", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprlock": { + "inputs": { + "hyprlang": "hyprlang_3", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_3" + }, + "locked": { + "lastModified": 1709517267, + "narHash": "sha256-t15sJ0yi0Snv4TP2dmXP71lcmNHDxq6yx9hDhjNuzAk=", + "owner": "hyprwm", + "repo": "Hyprlock", + "rev": "49ef1d306c92bbfef057272ae0bdefe8aea8d0c7", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprlock", + "type": "github" + } + }, "nix-darwin": { "inputs": { "nixpkgs": "nixpkgs" @@ -292,11 +453,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1706550542, - "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=", + "lastModified": 1709237383, + "narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=", "owner": "nixos", "repo": "nixpkgs", - "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652", + "rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8", "type": "github" }, "original": { @@ -313,6 +474,9 @@ "home-manager": "home-manager", "homebrew-cask": "homebrew-cask", "homebrew-core": "homebrew-core", + "hypridle": "hypridle", + "hyprland": "hyprland", + "hyprlock": "hyprlock", "nix-homebrew": "nix-homebrew", "nixpkgs": "nixpkgs_3", "snowfall-lib": "snowfall-lib" @@ -358,6 +522,51 @@ } }, "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "systems_4": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -372,7 +581,7 @@ "type": "github" } }, - "systems_2": { + "systems_5": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -386,6 +595,58 @@ "repo": "default", "type": "github" } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1708558866, + "narHash": "sha256-Mz6hCtommq7RQfcPnxLINigO4RYSNt23HeJHC6mVmWI=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "0cb091f1a2d345f37d2ee445f4ffd04f7f4ec9e5", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "rev": "0cb091f1a2d345f37d2ee445f4ffd04f7f4ec9e5", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1708696469, + "narHash": "sha256-shh5wmpeYy3MmsBfkm4f76yPsBDGk6OLYRVG+ARy2F0=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "1b713911c2f12b96c2574474686e4027ac4bf826", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/nix/flake.nix b/nix/flake.nix index 23f8ba3..4c91fa1 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -25,6 +25,18 @@ url = "github:homebrew/homebrew-cask"; flake = false; }; + hypridle = { + url = "github:hyprwm/Hypridle"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + hyprlock = { + url = "github:hyprwm/Hyprlock"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + hyprland = { + url = "github:hyprwm/Hyprland"; + inputs.nixpkgs.follows = "nixpkgs"; + }; # Home manager home-manager = { diff --git a/nix/homes/aarch64-darwin/sab@mbp13/default.nix b/nix/homes/aarch64-darwin/sab@mbp13/default.nix new file mode 100644 index 0000000..10f0e88 --- /dev/null +++ b/nix/homes/aarch64-darwin/sab@mbp13/default.nix @@ -0,0 +1,44 @@ +{ + lib, + pkgs, + config, + osConfig ? {}, + format ? "unknown", + ... +}: +with lib.custom; { + custom = { + user = { + enable = true; + name = config.snowfallorg.user.name; + }; + + cli-apps = { + home-manager = enabled; + atuin = enabled; + neovim = enabled; + yazi = enabled; + }; + + tools = { + git = enabled; + gh = enabled; + bat = enabled; + }; + + desktop = { + addons = { + wezterm = enabled; + }; + }; + security = { + vault = enabled; + }; + }; + + home.sessionPath = [ + "$HOME/bin" + ]; + + home.stateVersion = "23.11"; +} diff --git a/nix/homes/x86_64-linux/sab@nz/default.nix b/nix/homes/x86_64-linux/sab@nz/default.nix new file mode 100644 index 0000000..98c3b68 --- /dev/null +++ b/nix/homes/x86_64-linux/sab@nz/default.nix @@ -0,0 +1,48 @@ +{ + lib, + pkgs, + config, + osConfig ? {}, + format ? "unknown", + ... +}: +with lib.custom; { + custom = { + user = { + enable = true; + name = config.snowfallorg.user.name; + }; + + desktop = { + hyprland = enabled; + addons = { + hyprpaper = enabled; + mako = enabled; + rofi = enabled; + kitty = disabled; + swaylock = enabled; + hypridle = enabled; + waybar = enabled; + wlogout = enabled; + hyprlock = disabled; + wezterm = enabled; + }; + }; + + cli-apps = { + atuin = enabled; + yazi = enabled; + home-manager = enabled; + fastfetch = enabled; + }; + tools = { + gh = enabled; + git = enabled; + direnv = disabled; + }; + security = { + rbw = enabled; + vault = enabled; + }; + }; +} diff --git a/nix/modules/darwin/cli-apps/lf/default.nix b/nix/modules/darwin/cli-apps/lf/default.nix new file mode 100644 index 0000000..bea901b --- /dev/null +++ b/nix/modules/darwin/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 + ]; + custom.home.file.".config/lf/lfrc".source = ./lfrc; + custom.home.file.".config/lf/icons".source = ./icons; + custom.home.file.".config/lf/lf_kitty_clean" = { + source = ./lf_kitty_clean; + executable = true; + }; + custom.home.file.".config/lf/lf_kitty_preview" = { + source = ./lf_kitty_preview; + executable = true; + }; + }; +} diff --git a/nix/modules/darwin/cli-apps/lf/icons b/nix/modules/darwin/cli-apps/lf/icons new file mode 100644 index 0000000..409ca88 --- /dev/null +++ b/nix/modules/darwin/cli-apps/lf/icons @@ -0,0 +1,357 @@ +# vim:ft=conf + +# These examples require Nerd Fonts or a compatible font to be used. +# See https://www.nerdfonts.com for more information. + +# default values from lf (with matching order) +# ln l # LINK +# or l # ORPHAN +# tw t # STICKY_OTHER_WRITABLE +# ow d # OTHER_WRITABLE +# st t # STICKY +# di d # DIR +# pi p # FIFO +# so s # SOCK +# bd b # BLK +# cd c # CHR +# su u # SETUID +# sg g # SETGID +# ex x # EXEC +# fi - # FILE + +# file types (with matching order) +ln  # LINK +or  # ORPHAN +tw t # STICKY_OTHER_WRITABLE +ow  # OTHER_WRITABLE +st t # STICKY +di  # DIR +pi p # FIFO +so s # SOCK +bd b # BLK +cd c # CHR +su u # SETUID +sg g # SETGID +ex  # EXEC +fi  # FILE + +# file extensions (vim-devicons) +*.styl  +*.sass  +*.scss  +*.htm  +*.html  +*.slim  +*.haml  +*.ejs  +*.css  +*.less  +*.md  +*.mdx  +*.markdown  +*.rmd  +*.json  +*.webmanifest  +*.js  +*.mjs  +*.jsx  +*.rb  +*.gemspec  +*.rake  +*.php  +*.py  +*.pyc  +*.pyo  +*.pyd  +*.coffee  +*.mustache  +*.hbs  +*.conf  +*.ini  +*.yml  +*.yaml  +*.toml  +*.bat  +*.mk  +*.jpg  +*.jpeg  +*.bmp  +*.png  +*.webp  +*.gif  +*.ico  +*.twig  +*.cpp  +*.c++  +*.cxx  +*.cc  +*.cp  +*.c  +*.cs  +*.h  +*.hh  +*.hpp  +*.hxx  +*.hs  +*.lhs  +*.nix  +*.lua  +*.java  +*.sh  +*.fish  +*.bash  +*.zsh  +*.ksh  +*.csh  +*.awk  +*.ps1  +*.ml λ +*.mli λ +*.diff  +*.db  +*.sql  +*.dump  +*.clj  +*.cljc  +*.cljs  +*.edn  +*.scala  +*.go  +*.dart  +*.xul  +*.sln  +*.suo  +*.pl  +*.pm  +*.t  +*.rss  +'*.f#'  +*.fsscript  +*.fsx  +*.fs  +*.fsi  +*.rs  +*.rlib  +*.d  +*.erl  +*.hrl  +*.ex  +*.exs  +*.eex  +*.leex  +*.heex  +*.vim  +*.ai  +*.psd  +*.psb  +*.ts  +*.tsx  +*.jl  +*.pp  +*.vue ﵂ +*.elm  +*.swift  +*.xcplayground  +*.tex ﭨ +*.r ﳒ +*.rproj 鉶 +*.sol ﲹ +*.pem  + +# file names (vim-devicons) (case-insensitive not supported in lf) +*gruntfile.coffee  +*gruntfile.js  +*gruntfile.ls  +*gulpfile.coffee  +*gulpfile.js  +*gulpfile.ls  +*mix.lock  +*dropbox  +*.ds_store  +*.gitconfig  +*.gitignore  +*.gitattributes  +*.gitlab-ci.yml  +*.bashrc  +*.zshrc  +*.zshenv  +*.zprofile  +*.vimrc  +*.gvimrc  +*_vimrc  +*_gvimrc  +*.bashprofile  +*favicon.ico  +*license  +*node_modules  +*react.jsx  +*procfile  +*dockerfile  +*docker-compose.yml  +*rakefile  +*config.ru  +*gemfile  +*makefile  +*cmakelists.txt  +*robots.txt ﮧ + +# file names (case-sensitive adaptations) +*Gruntfile.coffee  +*Gruntfile.js  +*Gruntfile.ls  +*Gulpfile.coffee  +*Gulpfile.js  +*Gulpfile.ls  +*Dropbox  +*.DS_Store  +*LICENSE  +*React.jsx  +*Procfile  +*Dockerfile  +*Docker-compose.yml  +*Rakefile  +*Gemfile  +*Makefile  +*CMakeLists.txt  + +# file patterns (vim-devicons) (patterns not supported in lf) +# .*jquery.*\.js$  +# .*angular.*\.js$  +# .*backbone.*\.js$  +# .*require.*\.js$  +# .*materialize.*\.js$  +# .*materialize.*\.css$  +# .*mootools.*\.js$  +# .*vimrc.*  +# Vagrantfile$  + +# file patterns (file name adaptations) +*jquery.min.js  +*angular.min.js  +*backbone.min.js  +*require.min.js  +*materialize.min.js  +*materialize.min.css  +*mootools.min.js  +*vimrc  +Vagrantfile  + +# archives or compressed (extensions from dircolors defaults) +*.tar  +*.tgz  +*.arc  +*.arj  +*.taz  +*.lha  +*.lz4  +*.lzh  +*.lzma  +*.tlz  +*.txz  +*.tzo  +*.t7z  +*.zip  +*.z  +*.dz  +*.gz  +*.lrz  +*.lz  +*.lzo  +*.xz  +*.zst  +*.tzst  +*.bz2  +*.bz  +*.tbz  +*.tbz2  +*.tz  +*.deb  +*.rpm  +*.jar  +*.war  +*.ear  +*.sar  +*.rar  +*.alz  +*.ace  +*.zoo  +*.cpio  +*.7z  +*.rz  +*.cab  +*.wim  +*.swm  +*.dwm  +*.esd  + +# image formats (extensions from dircolors defaults) +*.jpg  +*.jpeg  +*.mjpg  +*.mjpeg  +*.gif  +*.bmp  +*.pbm  +*.pgm  +*.ppm  +*.tga  +*.xbm  +*.xpm  +*.tif  +*.tiff  +*.png  +*.svg  +*.svgz  +*.mng  +*.pcx  +*.mov  +*.mpg  +*.mpeg  +*.m2v  +*.mkv  +*.webm  +*.ogm  +*.mp4  +*.m4v  +*.mp4v  +*.vob  +*.qt  +*.nuv  +*.wmv  +*.asf  +*.rm  +*.rmvb  +*.flc  +*.avi  +*.fli  +*.flv  +*.gl  +*.dl  +*.xcf  +*.xwd  +*.yuv  +*.cgm  +*.emf  +*.ogv  +*.ogx  + +# audio formats (extensions from dircolors defaults) +*.aac  +*.au  +*.flac  +*.m4a  +*.mid  +*.midi  +*.mka  +*.mp3  +*.mpc  +*.ogg  +*.ra  +*.wav  +*.oga  +*.opus  +*.spx  +*.xspf  + +# other formats +*.pdf  diff --git a/nix/modules/darwin/cli-apps/lf/lf_kitty_clean b/nix/modules/darwin/cli-apps/lf/lf_kitty_clean new file mode 100755 index 0000000..16a2e66 --- /dev/null +++ b/nix/modules/darwin/cli-apps/lf/lf_kitty_clean @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +kitty +kitten icat --clear --stdin no --silent --transfer-mode file < /dev/null > /dev/tty diff --git a/nix/modules/darwin/cli-apps/lf/lf_kitty_preview b/nix/modules/darwin/cli-apps/lf/lf_kitty_preview new file mode 100755 index 0000000..562864c --- /dev/null +++ b/nix/modules/darwin/cli-apps/lf/lf_kitty_preview @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +file=$1 +w=$2 +h=$3 +x=$4 +y=$5 + +if [[ "$( file -Lb --mime-type "$file")" =~ ^image ]]; then + # kitty +icat --silent --transfer-mode file --place "${w}x${h}@${x}x${y}" "$file" + kitty +kitten icat --silent --stdin no --transfer-mode file --place "${w}x${h}@${x}x${y}" "$file" < /dev/null > /dev/tty + exit 1 +elif [[ "$( file -Lb --mime-type "$file")" =~ ^video ]]; then + thumb_dir="$HOME/.cache/ffmpegthumbnailer" + if [[ ! -d "$thumb_dir" ]]; then + mkdir -p $thumb_dir + fi + md5sum=$(echo $file | md5) + thumb_file="$thumb_dir/$md5sum.jpg" + ffmpeg -ss 00:00:05.000 -i "$file" -vframes 1 "$thumb_file" + kitty +kitten icat --silent --stdin no --transfer-mode file --place "${w}x${h}@${x}x${y}" "$thumb_file" < /dev/null > /dev/tty + exit 1 +fi + +bat --color=always --style=plain "$file" diff --git a/nix/modules/darwin/cli-apps/lf/lfrc b/nix/modules/darwin/cli-apps/lf/lfrc new file mode 100644 index 0000000..a90f671 --- /dev/null +++ b/nix/modules/darwin/cli-apps/lf/lfrc @@ -0,0 +1,68 @@ +set previewer ~/.config/lf/lf_kitty_preview +set cleaner ~/.config/lf/lf_kitty_clean +set icons true +set drawbox + +# Custom Functions +cmd mkdir ${{ + printf "Directory Name: " + read ans + mkdir -p $ans +}} + +cmd mkfile ${{ + printf "File Name: " + read ans + $EDITOR $ans +}} + +cmd open ${{ + case $(file --mime-type $f -b) in + text/*) $EDITOR "$fx";; + *) for f in "$fx"; do open $f > /dev/null 2> /dev/null & done;; + esac +}} + +cmd edit_config :{{ + $$EDITOR ~/.config/lf/lfrc + source ~/.config/lf/lfrc +}} + +cmd trash ${{ + set -f + if gio trash 2>/dev/null; then + gio trash "$fx" + else + mkdir -p /tmp/trash + echo "$fx" | while read line; do + mv -- "$line" /tmp/trash + done + fi +}} + +map . set hidden! +map open +map mf mkfile +map md mkdir +map toggle +map DD trash +map R reload +map G !nvim +Git +map Q quit +map quit + +# Movement +map c cd ~/ +map gd cd ~/Documents +map gD cd ~/Downloads +map gp cd ~/Pictures +map gc cd ~/.config +map gn cd ~/dotfiles/nix/ + +# Tips + +# notice: +# nerd-fonts must be installed for icons +# image preview does not work in tmux +# image preview require ImageMagick +# https://github.com/gokcehan/lf/wiki/Tips diff --git a/nix/modules/darwin/cli-apps/neovim/default.nix b/nix/modules/darwin/cli-apps/neovim/default.nix index 1a6d42a..31cef5a 100644 --- a/nix/modules/darwin/cli-apps/neovim/default.nix +++ b/nix/modules/darwin/cli-apps/neovim/default.nix @@ -14,10 +14,8 @@ in { }; config = mkIf cfg.enable { - programs.neovim = { - enable = true; - defaultEditor = true; - vimAlias = true; - }; + environment.systemPackages = with pkgs; [ + neovim + ]; }; } diff --git a/nix/modules/darwin/cli-apps/tmux/default.nix b/nix/modules/darwin/cli-apps/tmux/default.nix new file mode 100644 index 0000000..0d2a511 --- /dev/null +++ b/nix/modules/darwin/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 + ]; + custom.home.file.".tmux.conf".source = ./tmux.conf; + }; +} diff --git a/nix/modules/darwin/cli-apps/tmux/tmux.conf b/nix/modules/darwin/cli-apps/tmux/tmux.conf new file mode 100644 index 0000000..9787439 --- /dev/null +++ b/nix/modules/darwin/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/darwin/desktop/addons/skhd/default.nix b/nix/modules/darwin/desktop/addons/skhd/default.nix index 0ae5746..3025a52 100644 --- a/nix/modules/darwin/desktop/addons/skhd/default.nix +++ b/nix/modules/darwin/desktop/addons/skhd/default.nix @@ -35,8 +35,10 @@ in { 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') + alt - up : yabai -m space --focus 3 + alt - down : yabai -m space --focus 6 + alt - left : yabai -m space --focus prev + alt - right : yabai -m space --focus next # change focus between external displays (left and right) ctrl + alt - left : yabai -m display --focus west @@ -59,10 +61,6 @@ in { 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 @@ -138,7 +136,7 @@ in { ctrl + shift - d : yabai -m space --destroy # Applications - alt - x : /Users/sab/.nix-profile/bin/kitty + alt - x : /Applications/Nix\ Apps/WezTerm.app/wezterm ctrl + alt - b: /Applications/Firefox.App/Contents/MacOS/firefox # -- Starting/Stopping/Restarting Yabai -- diff --git a/nix/modules/darwin/desktop/addons/wezterm/default.nix b/nix/modules/darwin/desktop/addons/wezterm/default.nix new file mode 100644 index 0000000..290504b --- /dev/null +++ b/nix/modules/darwin/desktop/addons/wezterm/default.nix @@ -0,0 +1,22 @@ +inputs @ { + 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 or not to enable wezterm."; + }; + + config = mkIf cfg.enable { + # System package required as program via home-manager don't appear in Apps + environment.systemPackages = with pkgs; [ + wezterm + ]; + }; +} diff --git a/nix/modules/darwin/desktop/yabai/default.nix b/nix/modules/darwin/desktop/yabai/default.nix index cb7f797..7a42ed6 100644 --- a/nix/modules/darwin/desktop/yabai/default.nix +++ b/nix/modules/darwin/desktop/yabai/default.nix @@ -17,7 +17,6 @@ in { config = mkIf cfg.enable { custom.desktop.addons = { skhd = enabled; - spacebar = disabled; }; launchd.user.agents.yabai.serviceConfig = { StandardOutPath = "/tmp/yabai.log"; @@ -77,10 +76,13 @@ in { 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="^Safari$" space=3 + yabai -m rule --add app="^Firefox$" space=3 yabai -m rule --add app="^Kitty$" space=3 yabai -m rule --add app="^kitty$" space=3 + yabai -m rule --add app="^wezterm$" space=6 + yabai -m rule --add app="^wezterm-gui$" space=6 + yabai -m rule --add app="^WezTerm$" space=6 yabai -m rule --add app="^Telegram$" space=1 yabai -m rule --add app="^Slack$" space=1 yabai -m rule --add app="^Teams$" space=1 @@ -94,6 +96,7 @@ in { 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 + yabai -m rule --add app="^Raycast$" manage=off # Load scripting addition yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa" diff --git a/nix/modules/darwin/nix/default.nix b/nix/modules/darwin/nix/default.nix index 789805a..5ad62ee 100644 --- a/nix/modules/darwin/nix/default.nix +++ b/nix/modules/darwin/nix/default.nix @@ -20,6 +20,7 @@ in { nixfmt nix-index nix-prefetch-git + nvd ]; nix = let @@ -68,5 +69,14 @@ in { generateNixPathFromInputs = true; linkInputs = true; }; + system.activationScripts.postUserActivation = + { + text = '' + ${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig" + ''; + } + // lib.optionalAttrs pkgs.stdenv.isLinux { + supportsDryActivation = true; + }; }; } diff --git a/nix/modules/darwin/suites/common/default.nix b/nix/modules/darwin/suites/common/default.nix index 3b6aa48..93caaec 100644 --- a/nix/modules/darwin/suites/common/default.nix +++ b/nix/modules/darwin/suites/common/default.nix @@ -19,28 +19,22 @@ in { custom = { nix = enabled; - # apps = { - # iterm2 = enabled; - # }; - cli-apps = { - neovim = enabled; + tmux = disabled; }; - # tools = { - # git = enabled; - # flake = enabled; - # }; - + tools = { + http.enable = true; + misc.enable = true; + k8s.enable = true; + net.enable = true; + homebrew.enable = true; + }; 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 index 36c26fb..a9b4fbb 100644 --- a/nix/modules/darwin/suites/development/default.nix +++ b/nix/modules/darwin/suites/development/default.nix @@ -7,33 +7,20 @@ }: with lib; with lib.custom; let - cfg = config.custom.suites.development; + cfg = config.custom.suites.develop; in { - options.custom.suites.development = with types; { + options.custom.suites.develop = 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; }; + custom.tools = { + lsp.enable = true; + linters.enable = true; + k8s.enable = true; }; }; } diff --git a/nix/modules/darwin/system/fonts/default.nix b/nix/modules/darwin/system/fonts/default.nix index bf500c4..d3fcdd7 100644 --- a/nix/modules/darwin/system/fonts/default.nix +++ b/nix/modules/darwin/system/fonts/default.nix @@ -26,6 +26,7 @@ in { fonts = with pkgs; [ noto-fonts + dejavu_fonts noto-fonts-cjk-sans noto-fonts-cjk-serif noto-fonts-emoji diff --git a/nix/modules/darwin/system/interface/default.nix b/nix/modules/darwin/system/interface/default.nix index 8132885..4aec85d 100644 --- a/nix/modules/darwin/system/interface/default.nix +++ b/nix/modules/darwin/system/interface/default.nix @@ -24,7 +24,7 @@ in { finder = { AppleShowAllExtensions = true; FXEnableExtensionChangeWarning = false; - _FXShowPosixPathInTitle = false; + _FXShowPosixPathInTitle = true; }; # NSGlobalDomain = { diff --git a/nix/modules/darwin/tools/homebrew/default.nix b/nix/modules/darwin/tools/homebrew/default.nix new file mode 100644 index 0000000..8577efb --- /dev/null +++ b/nix/modules/darwin/tools/homebrew/default.nix @@ -0,0 +1,49 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.tools.homebrew; +in { + options.custom.tools.homebrew = { + enable = mkBoolOpt false "Whether or not to enable homebrew."; + masEnable = mkBoolOpt false "Whether or not to enable Mac App Store downloads."; + }; + + config = mkIf cfg.enable { + homebrew = { + enable = true; + + global = { + brewfile = true; + autoUpdate = true; + }; + + onActivation = { + autoUpdate = true; + cleanup = "uninstall"; + upgrade = true; + }; + + brews = [ + "bitwarden-cli" + ]; + + casks = [ + "raycast" + "vlc" + ]; + + # taps = [ + # "homebrew/bundle" + # "homebrew/cask-fonts" + # "homebrew/cask-versions" + # "homebrew/services" + # ]; + }; + }; +} diff --git a/nix/modules/darwin/tools/http/default.nix b/nix/modules/darwin/tools/http/default.nix new file mode 100644 index 0000000..fb25ed5 --- /dev/null +++ b/nix/modules/darwin/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/darwin/tools/k8s/default.nix b/nix/modules/darwin/tools/k8s/default.nix new file mode 100644 index 0000000..fe18d04 --- /dev/null +++ b/nix/modules/darwin/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/darwin/tools/linters/default.nix b/nix/modules/darwin/tools/linters/default.nix new file mode 100644 index 0000000..f8bb160 --- /dev/null +++ b/nix/modules/darwin/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/darwin/tools/lsp/default.nix b/nix/modules/darwin/tools/lsp/default.nix new file mode 100644 index 0000000..6920eef --- /dev/null +++ b/nix/modules/darwin/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/darwin/tools/misc/default.nix b/nix/modules/darwin/tools/misc/default.nix new file mode 100644 index 0000000..aa4b0cf --- /dev/null +++ b/nix/modules/darwin/tools/misc/default.nix @@ -0,0 +1,34 @@ +{ + 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 { + # xdg.configFile."wgetrc".text = ""; + + environment.systemPackages = with pkgs; [ + bat + fd + file + fzf + jq + killall + ripgrep + rsync + tree + unzip + yq + zoxide + ]; + }; +} diff --git a/nix/modules/darwin/tools/net/default.nix b/nix/modules/darwin/tools/net/default.nix new file mode 100644 index 0000000..09a1025 --- /dev/null +++ b/nix/modules/darwin/tools/net/default.nix @@ -0,0 +1,24 @@ +{ + 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 { + + environment.systemPackages = with pkgs; [ + dig + iftop + ipfetch + ]; + }; +} diff --git a/nix/modules/darwin/user/default.nix b/nix/modules/darwin/user/default.nix index 72271c2..678665a 100644 --- a/nix/modules/darwin/user/default.nix +++ b/nix/modules/darwin/user/default.nix @@ -11,11 +11,18 @@ is-linux = pkgs.stdenv.isLinux; is-darwin = pkgs.stdenv.isDarwin; + home-directory = + if cfg.name == null + then null + else if is-darwin + then "/Users/${cfg.name}" + else "/home/${cfg.name}"; 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."; + name = mkOpt types.str "sab" "The name to use for the user account."; + fullName = mkOpt types.str "Sergei Bulavintsev" "The full name of the user."; + email = mkOpt types.str "bulavintsev.sergey@gmail.com" "The email of the user."; + uid = mkOpt (types.nullOr types.int) 501 "The uid for the user account."; }; config = { @@ -27,6 +34,16 @@ in { shell = pkgs.fish; }; + programs = { + fish = { + enable = true; + shellAliases = { + nixup = "darwin-rebuild switch --flake ~/dotfiles/nix"; + nixt = "darwin-rebuild check --flake ~/dotfiles/nix"; + }; + }; + }; + snowfallorg.user.${config.custom.user.name}.home.config = { home = { file = { diff --git a/nix/modules/darwin/virtualisation/virt-manager/default.nix b/nix/modules/darwin/virtualisation/virt-manager/default.nix new file mode 100644 index 0000000..449f719 --- /dev/null +++ b/nix/modules/darwin/virtualisation/virt-manager/default.nix @@ -0,0 +1,21 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.virtualisation.virt-manager; +in { + options.custom.virtualisation.virt-manager = with types; { + enable = mkBoolOpt false "Whether or not to enable virt-manager."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + virt-manager + ]; + }; +} diff --git a/nix/modules/nixos/cli-apps/atuin/default.nix b/nix/modules/home/cli-apps/atuin/default.nix similarity index 79% rename from nix/modules/nixos/cli-apps/atuin/default.nix rename to nix/modules/home/cli-apps/atuin/default.nix index fbff256..80e1534 100644 --- a/nix/modules/nixos/cli-apps/atuin/default.nix +++ b/nix/modules/home/cli-apps/atuin/default.nix @@ -3,9 +3,10 @@ config, pkgs, ... -}: -with lib; -with lib.custom; let +}: let + inherit (lib) mkEnableOption mkIf; + inherit (lib.custom) enabled; + cfg = config.custom.cli-apps.atuin; in { options.custom.cli-apps.atuin = { @@ -13,7 +14,7 @@ in { }; config = mkIf cfg.enable { - home.programs.atuin = { + programs.atuin = { enable = true; # Does not work right now, injecting via fish enableBashIntegration = true; diff --git a/nix/modules/home/cli-apps/fastfetch/default.nix b/nix/modules/home/cli-apps/fastfetch/default.nix new file mode 100644 index 0000000..c718694 --- /dev/null +++ b/nix/modules/home/cli-apps/fastfetch/default.nix @@ -0,0 +1,24 @@ +{ + lib, + config, + pkgs, + ... +}: let + inherit (lib) mkEnableOption mkIf; + inherit (lib.custom) enabled; + + cfg = config.custom.cli-apps.fastfetch; +in { + options.custom.cli-apps.fastfetch = { + enable = mkEnableOption "Fastfetch"; + }; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + fastfetch + ]; + home.shellAliases = { + neofetch = "fastfetch"; + }; + }; +} diff --git a/nix/modules/home/cli-apps/home-manager/default.nix b/nix/modules/home/cli-apps/home-manager/default.nix new file mode 100644 index 0000000..a1a3859 --- /dev/null +++ b/nix/modules/home/cli-apps/home-manager/default.nix @@ -0,0 +1,18 @@ +{ + lib, + config, + ... +}: let + inherit (lib) mkEnableOption mkIf; + inherit (lib.custom) enabled; + + cfg = config.custom.cli-apps.home-manager; +in { + options.custom.cli-apps.home-manager = { + enable = mkEnableOption "home-manager"; + }; + + config = mkIf cfg.enable { + programs.home-manager = enabled; + }; +} diff --git a/nix/modules/home/cli-apps/neovim/default.nix b/nix/modules/home/cli-apps/neovim/default.nix new file mode 100644 index 0000000..ad369cb --- /dev/null +++ b/nix/modules/home/cli-apps/neovim/default.nix @@ -0,0 +1,26 @@ +{ + lib, + config, + pkgs, + ... +}: let + inherit (lib) mkEnableOption mkIf; + + cfg = config.custom.cli-apps.neovim; +in { + options.custom.cli-apps.neovim = { + enable = mkEnableOption "Neovim"; + }; + + config = mkIf cfg.enable { + programs.neovim = { + enable = true; + defaultEditor = true; + vimAlias = true; + }; + + # xdg.configFile = { + # "dashboard-nvim/.keep".text = ""; + # }; + }; +} diff --git a/nix/modules/nixos/cli-apps/yazi/configs/keymap.toml b/nix/modules/home/cli-apps/yazi/configs/keymap.toml similarity index 100% rename from nix/modules/nixos/cli-apps/yazi/configs/keymap.toml rename to nix/modules/home/cli-apps/yazi/configs/keymap.toml diff --git a/nix/modules/nixos/cli-apps/yazi/configs/theme.toml b/nix/modules/home/cli-apps/yazi/configs/theme.toml similarity index 100% rename from nix/modules/nixos/cli-apps/yazi/configs/theme.toml rename to nix/modules/home/cli-apps/yazi/configs/theme.toml diff --git a/nix/modules/nixos/cli-apps/yazi/default.nix b/nix/modules/home/cli-apps/yazi/default.nix similarity index 94% rename from nix/modules/nixos/cli-apps/yazi/default.nix rename to nix/modules/home/cli-apps/yazi/default.nix index db91a90..51a16d0 100644 --- a/nix/modules/nixos/cli-apps/yazi/default.nix +++ b/nix/modules/home/cli-apps/yazi/default.nix @@ -14,7 +14,7 @@ in { }; config = mkIf cfg.enable { - home.programs.yazi = { + programs.yazi = { enable = true; package = pkgs.yazi; @@ -37,7 +37,7 @@ in { }; }; - home.configFile = { + xdg.configFile = { "yazi" = { source = lib.cleanSourceWith { src = lib.cleanSource ./configs/.; diff --git a/nix/modules/home/desktop/addons/hypridle/default.nix b/nix/modules/home/desktop/addons/hypridle/default.nix new file mode 100644 index 0000000..d8c287d --- /dev/null +++ b/nix/modules/home/desktop/addons/hypridle/default.nix @@ -0,0 +1,47 @@ +{ + inputs, + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.hypridle; + inherit (inputs) hypridle; +in { + imports = [hypridle.homeManagerModules.default]; + + options.custom.desktop.addons.hypridle = with types; { + enable = mkBoolOpt false "Whether to enable the hypridle"; + }; + + config = mkIf cfg.enable { + services.hypridle = { + enable = true; + # package = pkgs.hypridle; + + lockCmd = "${pkgs.swaylock-effects}/bin/swaylock -fF"; + afterSleepCmd = "${getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch dpms on"; + + # 5 min lock, 10min turn the screen off, 20 min suspend + listeners = [ + { + timeout = 300; + onTimeout = "${pkgs.swaylock-effects}/bin/swaylock -fF"; + } + { + timeout = 600; + onTimeout = "${getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch dpms off"; + onResume = "${getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch dpms on"; + } + { + timeout = 1200; + onTimeout = "${pkgs.systemd}/bin/systemctl suspend"; + onResume = "${getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch dpms on"; + } + ]; + }; + }; +} diff --git a/nix/modules/home/desktop/addons/hyprlock/default.nix b/nix/modules/home/desktop/addons/hyprlock/default.nix new file mode 100644 index 0000000..b76db36 --- /dev/null +++ b/nix/modules/home/desktop/addons/hyprlock/default.nix @@ -0,0 +1,51 @@ +{ + inputs, + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.desktop.addons.hyprlock; + inherit (inputs) hyprlock; +in { + imports = [hyprlock.homeManagerModules.default]; + + options.custom.desktop.addons.hyprlock = with types; { + enable = mkBoolOpt false "Whether to enable the hyprlock"; + }; + + config = mkIf cfg.enable { + programs.hyprlock = { + enable = true; + # package = pkgs.hyprlock; + + # input_field = { + # outer_color = "rgb(24, 25, 38)"; + # inner_color = "rgb(91, 96, 120)"; + # font_color = "rgb(202, 211, 245)"; + # halign = "center"; + # valign = "center"; + # size.width = 300; + # size.height = 40; + # }; + + # label = { + # text = "$TIME, $USER"; + # color = "rgb(237, 135, 150)"; + # font_family = "FiraCode"; + # font_size = 72; + # halign = "center"; + # valign = "center"; + # }; + + backgrounds = [ + { + path = "/home/sab/Pictures/wallpaper.png"; + } + ]; + }; + }; +} diff --git a/nix/modules/home/desktop/addons/hyprpaper/default.nix b/nix/modules/home/desktop/addons/hyprpaper/default.nix new file mode 100644 index 0000000..cdedeb7 --- /dev/null +++ b/nix/modules/home/desktop/addons/hyprpaper/default.nix @@ -0,0 +1,40 @@ +{ + 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 { + xdg.configFile = { + "hypr/hyprpaper.conf".text = '' + preload = ${wallpaper} + wallpaper = eDP-1,${wallpaper} + wallpaper = DP-1,${wallpaper} + wallpaper = DP-2,${wallpaper} + ''; + }; + systemd.user.services.hyprpaper = { + Install.WantedBy = ["hyprland-session.target"]; + + Unit = { + Description = "Hyprpaper Service"; + PartOf = ["graphical-session.target"]; + }; + + Service = { + ExecStart = "${getExe pkgs.hyprpaper}"; + Restart = "always"; + }; + }; + }; +} diff --git a/nix/modules/nixos/desktop/addons/kitty/default.nix b/nix/modules/home/desktop/addons/kitty/default.nix similarity index 97% rename from nix/modules/nixos/desktop/addons/kitty/default.nix rename to nix/modules/home/desktop/addons/kitty/default.nix index 34e83f2..afbc259 100644 --- a/nix/modules/nixos/desktop/addons/kitty/default.nix +++ b/nix/modules/home/desktop/addons/kitty/default.nix @@ -14,7 +14,7 @@ in { }; config = mkIf cfg.enable { - home.programs.kitty = { + programs.kitty = { enable = true; font = { name = "CaskaydiaCove Nerd Font"; diff --git a/nix/modules/nixos/desktop/addons/mako/default.nix b/nix/modules/home/desktop/addons/mako/default.nix similarity index 92% rename from nix/modules/nixos/desktop/addons/mako/default.nix rename to nix/modules/home/desktop/addons/mako/default.nix index e4bcd3a..315cd91 100644 --- a/nix/modules/nixos/desktop/addons/mako/default.nix +++ b/nix/modules/home/desktop/addons/mako/default.nix @@ -14,8 +14,10 @@ in { }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [libnotify]; - home.services.mako = { + home.packages = with pkgs; [ + libnotify + ]; + services.mako = { enable = true; defaultTimeout = 5000; font = "FiraCode Nerd Font 10"; diff --git a/nix/modules/nixos/desktop/addons/rofi/default.nix b/nix/modules/home/desktop/addons/rofi/default.nix similarity index 98% rename from nix/modules/nixos/desktop/addons/rofi/default.nix rename to nix/modules/home/desktop/addons/rofi/default.nix index 1135185..c37ea10 100644 --- a/nix/modules/nixos/desktop/addons/rofi/default.nix +++ b/nix/modules/home/desktop/addons/rofi/default.nix @@ -15,8 +15,11 @@ in { }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [rofi-rbw wtype]; - home.programs.rofi = { + home.packages = with pkgs; [ + rofi-rbw + wtype + ]; + programs.rofi = { enable = true; package = pkgs.rofi-wayland; plugins = with pkgs; [ diff --git a/nix/modules/nixos/desktop/addons/rofi/rofi/catppuccin-frappe.rasi b/nix/modules/home/desktop/addons/rofi/rofi/catppuccin-frappe.rasi similarity index 100% rename from nix/modules/nixos/desktop/addons/rofi/rofi/catppuccin-frappe.rasi rename to nix/modules/home/desktop/addons/rofi/rofi/catppuccin-frappe.rasi diff --git a/nix/modules/nixos/desktop/addons/swayidle/default.nix b/nix/modules/home/desktop/addons/swayidle/default.nix similarity index 79% rename from nix/modules/nixos/desktop/addons/swayidle/default.nix rename to nix/modules/home/desktop/addons/swayidle/default.nix index 64d87f5..3bed49c 100644 --- a/nix/modules/nixos/desktop/addons/swayidle/default.nix +++ b/nix/modules/home/desktop/addons/swayidle/default.nix @@ -14,13 +14,13 @@ in { }; config = mkIf cfg.enable { - home.services.swayidle = { + services.swayidle = { enable = true; events = [ { event = "lock"; - command = "${pkgs.swaylock-effects}/bin/swaylock -efF"; + command = "${pkgs.swaylock-effects}/bin/swaylock -fF"; } { event = "after-resume"; @@ -28,14 +28,14 @@ in { } { event = "before-sleep"; - command = "${pkgs.swaylock-effects}/bin/swaylock -efF"; + command = "${pkgs.swaylock-effects}/bin/swaylock -fF"; } ]; # 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"; + command = "${pkgs.swaylock-effects}/bin/swaylock -fF -C ~/.config/swaylock/config"; } { timeout = 600; diff --git a/nix/modules/nixos/desktop/addons/swaylock/default.nix b/nix/modules/home/desktop/addons/swaylock/default.nix similarity index 97% rename from nix/modules/nixos/desktop/addons/swaylock/default.nix rename to nix/modules/home/desktop/addons/swaylock/default.nix index acad238..e4cd009 100644 --- a/nix/modules/nixos/desktop/addons/swaylock/default.nix +++ b/nix/modules/home/desktop/addons/swaylock/default.nix @@ -14,7 +14,7 @@ in { }; config = mkIf cfg.enable { - home.programs.swaylock = { + programs.swaylock = { enable = true; package = pkgs.swaylock-effects; settings = { diff --git a/nix/modules/nixos/desktop/addons/waybar/default.nix b/nix/modules/home/desktop/addons/waybar/default.nix similarity index 68% rename from nix/modules/nixos/desktop/addons/waybar/default.nix rename to nix/modules/home/desktop/addons/waybar/default.nix index 84e6b5d..b553188 100644 --- a/nix/modules/nixos/desktop/addons/waybar/default.nix +++ b/nix/modules/home/desktop/addons/waybar/default.nix @@ -1,4 +1,3 @@ - { options, config, @@ -18,7 +17,7 @@ in { }; config = mkIf cfg.enable { - home.programs.waybar = { + programs.waybar = { enable = true; package = pkgs.waybar; @@ -69,13 +68,59 @@ in { }; "hyprland/workspaces" = { - format = "{icon}"; + format = "{icon} {windows}"; on-click = "activate"; - all-outputs = true; + all-outputs = false; + active-only = "false"; format-icons = { - "urgent" = " "; - "active" = " "; - "default" = " "; + "1" = "󰎤"; + "2" = "󰎧"; + "3" = "󰎪"; + "4" = "󰎭"; + "5" = "󰎱"; + "6" = "󰎳"; + "7" = "󰎶"; + "8" = "󰎹"; + "9" = "󰎼"; + "10" = "󰽽"; + "urgent" = "󱨇"; + "default" = ""; + "empty" = "󱓼"; + }; + window-rewrite-default = ""; + window-rewrite = { + "class<1Password>" = "󰢁"; + "class" = "󰈎"; + "class" = "󰊤"; + "class" = ""; + "class" = ""; + "class" = "󰒱"; + "class" = "󱋒"; + "class" = "󱋒"; + "class" = "󰨞"; + "code-url-handler" = "󰨞"; + "class" = "󰙯"; + "class" = ""; + "class title<.*github.*>" = ""; + "class title<.*twitch|youtube|plex|tntdrama|bally sports.*>" = ""; + "class" = ""; + "class" = ""; + "class" = "󱂷"; + "class" = "󰄄"; + "class" = ""; + "class<.pitivi-wrapped>" = "󱄢"; + "class" = ""; + "class" = ""; + "class" = "󰢹"; + "class" = "󰕼"; + "class" = "󰉋"; + "class" = "󰉋"; + "class" = ""; + "title" = ""; + "class" = "󰽉"; + "class" = ""; + "class" = "󱎏"; + "class" = "󱎐"; }; }; diff --git a/nix/modules/home/desktop/addons/waybar/style.css b/nix/modules/home/desktop/addons/waybar/style.css new file mode 100644 index 0000000..47da4e0 --- /dev/null +++ b/nix/modules/home/desktop/addons/waybar/style.css @@ -0,0 +1,132 @@ +/* +* +* Catppuccin Macchiato palette +* +*/ + +@define-color base #24273a; +@define-color mantle #1e2030; +@define-color crust #181926; + +@define-color text #cad3f5; +@define-color subtext0 #b8c0e0; +@define-color subtext1 #a5adcb; + +@define-color surface0 #363a4f; +@define-color surface1 #494d64; +@define-color surface2 #5b6078; + +@define-color overlay0 #6e738d; +@define-color overlay1 #8087a2; +@define-color overlay2 #939ab7; + +@define-color blue #8aadf4; +@define-color lavender #b7bdf8; +@define-color sapphire #7dc4e4; +@define-color sky #91d7e3; +@define-color teal #8bd5ca; +@define-color green #a6da95; +@define-color yellow #eed49f; +@define-color peach #f5a97f; +@define-color maroon #ee99a0; +@define-color red #ed8796; +@define-color mauve #c6a0f6; +@define-color pink #f5bde6; +@define-color flamingo #f0c6c6; +@define-color rosewater #f4dbd6; +* { + border: none; + border-radius: 0; + font-family: FiraCode Nerd Font, Helvetica, Arial, sans-serif; + font-size: 13px; + min-height: 0; +} + +window#waybar { + background: rgba(0, 0, 0, 0.4); + /* background: rgba(30, 32, 48, 0.5); */ + /* background: rgba(0, 0, 0, 0.4); */ + color: rgba(255, 255, 255, 1); + border-bottom: 1px solid rgba(255, 255, 255, 0.2); +} + +tooltip { + background: rgba(255, 255, 255, 0.8); + border-radius: 8px; + border: 1px solid rgba(0, 0, 0, 0.2); +} +tooltip label { + font-size: 13px; + color: rgba(0, 0, 0, 0.8); +} + +widget label, +widget image { + padding: 0 8px; + background: rgba(255, 255, 255, 0.1); +} + +#window, +#custom-media { + background: rgba(0, 0, 0, 0); + padding-right: 20px; +} + +.modules-right, +.modules-center { + color: white; + /* padding: 0 8px; */ +} + +@keyframes blink { + to { + background-color: #ffffff; + color: black; + } +} + +#battery.warning:not(.charging) { + background: #f87171; + color: white; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + + +#workspaces { + color: white; + /* background: rgba(255, 255, 255, 0.2); */ + margin-right: 8px; +} + +#workspaces label { + padding: 0 6px 0 8px; + font-size: 14px; +} + +#workspaces button { + color: white; + padding: 0; +} + +#workspaces button.empty { + color: @overlay0; +} + +#workspaces button.visible { + color: @blue; +} + +#workspaces button.active { + background-color: @surface0; + color: @sapphire; +} + +#workspaces button.urgent { + box-shadow: 2px 2px 2px 2px; + border-radius: 1em; + color: @red; +} diff --git a/nix/modules/nixos/desktop/addons/wezterm/colors.lua b/nix/modules/home/desktop/addons/wezterm/colors.lua similarity index 100% rename from nix/modules/nixos/desktop/addons/wezterm/colors.lua rename to nix/modules/home/desktop/addons/wezterm/colors.lua diff --git a/nix/modules/nixos/desktop/addons/wezterm/default.nix b/nix/modules/home/desktop/addons/wezterm/default.nix similarity index 77% rename from nix/modules/nixos/desktop/addons/wezterm/default.nix rename to nix/modules/home/desktop/addons/wezterm/default.nix index d3c841e..00c94a5 100644 --- a/nix/modules/nixos/desktop/addons/wezterm/default.nix +++ b/nix/modules/home/desktop/addons/wezterm/default.nix @@ -9,12 +9,12 @@ 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"; + options.custom.desktop.addons.wezterm = { + enable = mkEnableOption "Whether to enable the wezterm terminal"; }; config = mkIf cfg.enable { - home.programs.wezterm = { + programs.wezterm = { enable = true; extraConfig = # Generate wezterm.lua; order of files are important diff --git a/nix/modules/nixos/desktop/addons/wezterm/events.lua b/nix/modules/home/desktop/addons/wezterm/events.lua similarity index 100% rename from nix/modules/nixos/desktop/addons/wezterm/events.lua rename to nix/modules/home/desktop/addons/wezterm/events.lua diff --git a/nix/modules/nixos/desktop/addons/wezterm/mappings.lua b/nix/modules/home/desktop/addons/wezterm/mappings.lua similarity index 100% rename from nix/modules/nixos/desktop/addons/wezterm/mappings.lua rename to nix/modules/home/desktop/addons/wezterm/mappings.lua diff --git a/nix/modules/nixos/desktop/addons/wezterm/tabs.lua b/nix/modules/home/desktop/addons/wezterm/tabs.lua similarity index 100% rename from nix/modules/nixos/desktop/addons/wezterm/tabs.lua rename to nix/modules/home/desktop/addons/wezterm/tabs.lua diff --git a/nix/modules/nixos/desktop/addons/wezterm/wezterm.lua b/nix/modules/home/desktop/addons/wezterm/wezterm.lua similarity index 89% rename from nix/modules/nixos/desktop/addons/wezterm/wezterm.lua rename to nix/modules/home/desktop/addons/wezterm/wezterm.lua index 8e006df..f620ae3 100644 --- a/nix/modules/nixos/desktop/addons/wezterm/wezterm.lua +++ b/nix/modules/home/desktop/addons/wezterm/wezterm.lua @@ -16,7 +16,12 @@ config.font = wezterm.font_with_fallback { { family = "Symbols Nerd Font Mono", scale = 0.9 }, { family = "DejaVu Sans", weight = "Regular", scale = 0.75 }, } -config.font_size = 14 +if wezterm.target_triple == "aarch64-apple-darwin" then + config.font_size = 18 + -- Linux Setup +else + config.font_size = 14 +end -- }}} -- Windows -- {{{ diff --git a/nix/modules/nixos/desktop/addons/wlogout/default.nix b/nix/modules/home/desktop/addons/wlogout/default.nix similarity index 91% rename from nix/modules/nixos/desktop/addons/wlogout/default.nix rename to nix/modules/home/desktop/addons/wlogout/default.nix index 12e88f6..1143d02 100644 --- a/nix/modules/nixos/desktop/addons/wlogout/default.nix +++ b/nix/modules/home/desktop/addons/wlogout/default.nix @@ -14,7 +14,7 @@ in { }; config = mkIf cfg.enable { - home.programs.wlogout = { + programs.wlogout = { enable = true; }; }; diff --git a/nix/modules/home/desktop/hyprland/default.nix b/nix/modules/home/desktop/hyprland/default.nix new file mode 100644 index 0000000..00a3bc5 --- /dev/null +++ b/nix/modules/home/desktop/hyprland/default.nix @@ -0,0 +1,26 @@ +{ + 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 { + wayland.windowManager.hyprland = { + enable = true; + extraConfig = + builtins.readFile ./hyprland.conf; + + systemd.enable = true; + xwayland.enable = true; + }; + }; +} diff --git a/nix/modules/nixos/desktop/hyprland/hyprland.conf b/nix/modules/home/desktop/hyprland/hyprland.conf similarity index 84% rename from nix/modules/nixos/desktop/hyprland/hyprland.conf rename to nix/modules/home/desktop/hyprland/hyprland.conf index fd25f65..32dbe85 100644 --- a/nix/modules/nixos/desktop/hyprland/hyprland.conf +++ b/nix/modules/home/desktop/hyprland/hyprland.conf @@ -4,7 +4,6 @@ autogenerated = 0 # remove this line to remove the warning monitor=,preferred,auto,auto monitor=HDMI-A-1, 1920x1080, 0x0, 1 - # See https://wiki.hyprland.org/Configuring/Keywords/ for more # Execute your favorite apps at launch @@ -12,7 +11,10 @@ monitor=HDMI-A-1, 1920x1080, 0x0, 1 exec-once = mako exec-once = waybar exec-once = wl-paste --watch cliphist store -exec-once = hyprpaper +# exec-once = hyprpaper +exec-once = wezterm +exec-once = firefox +exec-once = slack exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP exec = nm-applet --indicator @@ -59,9 +61,7 @@ general { } decoration { # See https://wiki.hyprland.org/Configuring/Variables/ for more - rounding = 10 - blur { enabled = true size = 3 @@ -76,9 +76,7 @@ decoration { animations { enabled = yes - # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more - bezier = myBezier, 0.05, 0.9, 0.1, 1.05 animation = windows, 1, 7, myBezier @@ -89,8 +87,6 @@ animations { animation = workspaces, 1, 6, default } - - dwindle { # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below @@ -113,20 +109,13 @@ device:epic-mouse-v1 { sensitivity = -0.5 } -# Example windowrule v1 -# windowrule = float, ^(kitty)$ -# Example windowrule v2 -# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ -# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more - - # See https://wiki.hyprland.org/Configuring/Keywords/ for more $mainMod = SUPER # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more bind = $mainMod, X, exec, wezterm bind = $mainMod, Q, killactive, -bind = $mainMod, M, exit, +bind = $mainMod SHIFT, M, exit bind = $mainMod, B, exec, firefox bind = $mainMod, F, fullscreen, bind = $mainMod, V, togglefloating, @@ -134,11 +123,10 @@ bind = $mainMod, R, exec, rofi -show drun 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 SHIFT, L, exec, swaylock bind = $mainMod, U, pseudo, # dwindle bind = $mainMod, J, togglesplit, # dwindle 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 @@ -209,3 +197,32 @@ bind = ,Print, exec, grim -g "$(slurp)" ~/Pictures/Screenshots/$(date +'ss_%s.pn bind = CONTROL, Print, exec, grim -g "$(slurp)" - | wl-copy # Screenshot full screen bind = SHIFT, Print, exec, grim ~/Pictures/Screenshots/$(date +'ss_%s.png') +# +# Example windowrule v1 +# windowrule = float, ^(kitty)$ +# Example windowrule v2 +# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ +# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more +windowrule = float,class:Rofi +windowrule = float,class:viewnior +windowrule = float,class:feh +windowrule = float,class:wlogout +windowrule = float,class:file_progress +windowrule = float,class:confirm +windowrule = float,class:dialog +windowrule = float,class:download +windowrule = float,class:notification +windowrule = float,class:error +windowrule = float,class:splash +windowrule = float,class:confirmreset +windowrule = float,class:^(blueman-manager)$ +windowrule = float,class:^(nm-connection-editor)$ +windowrulev2 = workspace 1, class:^(wezterm)$, +windowrulev2 = workspace 1, class:^(org\.wezfurlong\.wezterm)$ +windowrulev2 = workspace 2, title:^(?!.*(Twitch|TNTdrama|YouTube|Bally Sports|Video Entertainment|Plex)).*(Firefox).*$ +windowrulev2 = workspace 3 silent, class:^(Slack)$ +windowrulev2 = workspace 4 silent, class:^(org.telegram.desktop)$ +windowrulev2 = workspace 4 silent, class:^(zoom)$ +windowrulev2 = workspace 5, class:^(mpv|vlc|mpdevil)$ +windowrulev2 = workspace 5, title:&(.*QEMU.*) +windowrulev2 = workspace 6, class:^(virt-manager)$ diff --git a/nix/modules/home/host/default.nix b/nix/modules/home/host/default.nix new file mode 100644 index 0000000..58db3df --- /dev/null +++ b/nix/modules/home/host/default.nix @@ -0,0 +1,15 @@ +{ + lib, + config, + pkgs, + host ? null, + format ? "unknown", + ... +}: let + inherit (lib) types; + inherit (lib.custom) mkOpt; +in { + options.custom.host = { + name = mkOpt (types.nullOr types.str) host "The host name."; + }; +} diff --git a/nix/modules/nixos/system/security/rbw/default.nix b/nix/modules/home/security/rbw/default.nix similarity index 77% rename from nix/modules/nixos/system/security/rbw/default.nix rename to nix/modules/home/security/rbw/default.nix index e7dd37e..385656e 100644 --- a/nix/modules/nixos/system/security/rbw/default.nix +++ b/nix/modules/home/security/rbw/default.nix @@ -8,20 +8,20 @@ }: with lib; with lib.custom; let - cfg = config.system.security.rbw; + cfg = config.custom.security.rbw; in { - options.system.security.rbw = with types; { + options.custom.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; [ + home.packages = with pkgs; [ rbw pinentry-gnome ]; - home.programs = { + programs = { rbw = { enable = true; settings = { diff --git a/nix/modules/home/security/vault/default.nix b/nix/modules/home/security/vault/default.nix new file mode 100644 index 0000000..7fe5932 --- /dev/null +++ b/nix/modules/home/security/vault/default.nix @@ -0,0 +1,22 @@ +{ + options, + config, + pkgs, + lib, + inputs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.security.vault; +in { + options.custom.security.vault = with types; { + enable = mkBoolOpt false "Whether or not to enable Hashicort Vault."; + }; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + vault + ]; + }; +} diff --git a/nix/modules/home/tools/bat/default.nix b/nix/modules/home/tools/bat/default.nix new file mode 100644 index 0000000..68a371d --- /dev/null +++ b/nix/modules/home/tools/bat/default.nix @@ -0,0 +1,38 @@ +{ + config, + lib, + options, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.tools.bat; +in { + options.custom.tools.bat = { + enable = mkBoolOpt true "Whether or not to enable bat."; + }; + + config = mkIf cfg.enable { + programs.bat = { + enable = true; + + config = { + style = "auto,header-filesize"; + }; + + extraPackages = with pkgs.bat-extras; [ + batdiff + batgrep + batman + batpipe + batwatch + prettybat + ]; + }; + + home.shellAliases = { + cat = "bat"; + }; + }; +} diff --git a/nix/modules/nixos/tools/direnv/default.nix b/nix/modules/home/tools/direnv/default.nix similarity index 70% rename from nix/modules/nixos/tools/direnv/default.nix rename to nix/modules/home/tools/direnv/default.nix index fda7a6f..0d8bd7a 100644 --- a/nix/modules/nixos/tools/direnv/default.nix +++ b/nix/modules/home/tools/direnv/default.nix @@ -14,11 +14,9 @@ in { }; config = mkIf cfg.enable { - home.extraOptions = { - programs.direnv = { - enable = true; - nix-direnv = enabled; - }; + programs.direnv = { + enable = true; + nix-direnv = enabled; }; }; } diff --git a/nix/modules/home/tools/gh/default.nix b/nix/modules/home/tools/gh/default.nix new file mode 100644 index 0000000..eb6707d --- /dev/null +++ b/nix/modules/home/tools/gh/default.nix @@ -0,0 +1,21 @@ +{ + options, + config, + pkgs, + lib, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.tools.gh; +in { + options.custom.tools.gh = with types; { + enable = mkBoolOpt false "Whether or not to install and configure gh."; + }; + + config = mkIf cfg.enable { + programs.gh = { + enable = true; + }; + }; +} diff --git a/nix/modules/home/tools/git/default.nix b/nix/modules/home/tools/git/default.nix new file mode 100644 index 0000000..2a2faa7 --- /dev/null +++ b/nix/modules/home/tools/git/default.nix @@ -0,0 +1,60 @@ +{ + lib, + config, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.tools.git; + 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 { + programs.git = { + enable = true; + inherit (cfg) userName userEmail; + lfs = enabled; + extraConfig = { + init = { + defaultBranch = "master"; + templatedir = "~/.git_template"; + whitespace = "trailing-space,space-before-tab"; + }; + core = { + pager = "bat"; + }; + pull = {rebase = true;}; + push = {autoSetupRemote = true;}; + 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/home/user/default.nix b/nix/modules/home/user/default.nix new file mode 100644 index 0000000..2ae28c5 --- /dev/null +++ b/nix/modules/home/user/default.nix @@ -0,0 +1,51 @@ +{ + lib, + config, + pkgs, + osConfig ? {}, + ... +}: let + inherit (lib) types mkIf mkDefault mkMerge; + inherit (lib.custom) mkOpt; + + cfg = config.custom.user; + + is-linux = pkgs.stdenv.isLinux; + is-darwin = pkgs.stdenv.isDarwin; + + home-directory = + if cfg.name == null + then null + else if is-darwin + then "/Users/${cfg.name}" + else "/home/${cfg.name}"; +in { + options.custom.user = { + enable = mkOpt types.bool false "Whether to configure the user account."; + name = mkOpt types.str "sab" "The name to use for the user account."; + fullName = mkOpt types.str "Sergei Bulavintsev" "The full name of the user."; + email = mkOpt types.str "bulavintsev.sergey@gmail.com" "The email of the user."; + + home = mkOpt (types.nullOr types.str) home-directory "The user's home directory."; + }; + + config = mkIf cfg.enable (mkMerge [ + { + assertions = [ + { + assertion = cfg.name != null; + message = "custom.user.name must be set"; + } + { + assertion = cfg.home != null; + message = "custom.user.home must be set"; + } + ]; + + home = { + username = mkDefault cfg.name; + homeDirectory = mkDefault cfg.home; + }; + } + ]); +} diff --git a/nix/modules/nixos/desktop/hyprland/default.nix b/nix/modules/nixos/desktop/addons/hyprland-utils/default.nix similarity index 60% rename from nix/modules/nixos/desktop/hyprland/default.nix rename to nix/modules/nixos/desktop/addons/hyprland-utils/default.nix index 561ab5a..c513e89 100644 --- a/nix/modules/nixos/desktop/hyprland/default.nix +++ b/nix/modules/nixos/desktop/addons/hyprland-utils/default.nix @@ -7,38 +7,22 @@ }: with lib; with lib.custom; let - cfg = config.custom.desktop.hyprland; + cfg = config.custom.desktop.addons.hyprland-utils; in { - options.custom.desktop.hyprland = with types; { - enable = mkBoolOpt false "Whether or not to install Hyprland and dependencies."; + options.custom.desktop.addons.hyprland-utils = with types; { + enable = mkBoolOpt false "Whether or not to add support for hyprland."; }; 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; + # Required as deps + programs.hyprland = { + enable = true; + xwayland.enable = true; }; - home.configFile."hypr/hyprland.conf".source = ./hyprland.conf; - environment.systemPackages = with pkgs; [ - hyprland - hyprland-protocols + # hyprland + # hyprland-protocols hyprpaper hyprpicker @@ -68,22 +52,10 @@ in { 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). diff --git a/nix/modules/nixos/desktop/addons/hyprpaper/default.nix b/nix/modules/nixos/desktop/addons/hyprpaper/default.nix deleted file mode 100644 index 59b0bc1..0000000 --- a/nix/modules/nixos/desktop/addons/hyprpaper/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - 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/waybar/style.css b/nix/modules/nixos/desktop/addons/waybar/style.css deleted file mode 100644 index ee4c409..0000000 --- a/nix/modules/nixos/desktop/addons/waybar/style.css +++ /dev/null @@ -1,79 +0,0 @@ -* { - border: none; - border-radius: 0; - font-family: FiraCode Nerd Font, Helvetica, Arial, sans-serif; - font-size: 13px; - min-height: 0; -} - -window#waybar { - background: rgba(0, 0, 0, 0.4); - background: rgba(30, 32, 48, 0.5); - /* background: rgba(0, 0, 0, 0.4); */ - color: rgba(255, 255, 255, 1); - border-bottom: 1px solid rgba(255, 255, 255, 0.2); -} - -tooltip { - background: rgba(255, 255, 255, 0.8); - border-radius: 8px; - border: 1px solid rgba(0, 0, 0, 0.2); -} -tooltip label { - font-size: 13px; - color: rgba(0, 0, 0, 0.8); -} - -widget label, -widget image { - padding: 0 8px; - background: rgba(255, 255, 255, 0.1); -} - -#window, -#custom-media { - background: rgba(0, 0, 0, 0); - padding-right: 20px; -} - -.modules-right, -.modules-center { - color: white; - /* padding: 0 8px; */ -} - -#workspaces { - color: white; - background: rgba(255, 255, 255, 0.2); - margin-right: 8px; -} - -#workspaces button { - padding: 0; -} -#workspaces button label { - padding: 0 6px 0 8px; - color: white; - font-size: 14px; -} - -#workspaces button.focused { - background: rgba(255, 255, 255, 0.3); -} - -@keyframes blink { - to { - background-color: #ffffff; - color: black; - } -} - -#battery.warning:not(.charging) { - background: #f87171; - color: white; - animation-name: blink; - animation-duration: 0.5s; - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; -} diff --git a/nix/modules/nixos/home/default.nix b/nix/modules/nixos/home/default.nix index d69ec10..a72f4e5 100644 --- a/nix/modules/nixos/home/default.nix +++ b/nix/modules/nixos/home/default.nix @@ -19,18 +19,15 @@ with lib.custom; { 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; + home.stateVersion = config.system.stateVersion; xdg.configFile = mkAliasDefinitions options.home.configFile; programs = mkAliasDefinitions options.home.programs; - services = mkAliasDefinitions options.home.services; }; home-manager = { diff --git a/nix/modules/nixos/suites/common/default.nix b/nix/modules/nixos/suites/common/default.nix index 6a5d74e..0721d36 100644 --- a/nix/modules/nixos/suites/common/default.nix +++ b/nix/modules/nixos/suites/common/default.nix @@ -37,17 +37,14 @@ in { 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 index eb6aece..3ad70b3 100644 --- a/nix/modules/nixos/suites/desktop/default.nix +++ b/nix/modules/nixos/suites/desktop/default.nix @@ -14,10 +14,13 @@ in { }; config = mkIf cfg.enable { - system.security.rbw.enable = true; custom = { - desktop = { - hyprland = enabled; + desktop.addons = { + keyring = enabled; + gtk = enabled; + regreet = enabled; + xdg-portal = enabled; + hyprland-utils = enabled; }; apps = { firefox = enabled; diff --git a/nix/modules/nixos/system/nix/default.nix b/nix/modules/nixos/system/nix/default.nix index eae707d..9619c45 100644 --- a/nix/modules/nixos/system/nix/default.nix +++ b/nix/modules/nixos/system/nix/default.nix @@ -21,10 +21,12 @@ in { config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ + cachix rnix-lsp nixfmt nix-index nix-prefetch-git + nvd ]; nix = let @@ -32,21 +34,26 @@ in { 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; - }); + 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; + substituters = [ + "https://cache.nixos.org" + "https://nix-community.cachix.org" + "https://hyprland.cachix.org" + ]; + trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + ]; + }; gc = { automatic = true; @@ -59,5 +66,11 @@ in { generateNixPathFromInputs = true; linkInputs = true; }; + system.activationScripts.diff = { + supportsDryActivation = true; + text = '' + ${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig" + ''; + }; }; } diff --git a/nix/modules/nixos/system/shell/default.nix b/nix/modules/nixos/system/shell/default.nix index 8778b72..2f078d2 100644 --- a/nix/modules/nixos/system/shell/default.nix +++ b/nix/modules/nixos/system/shell/default.nix @@ -17,7 +17,6 @@ in { environment.systemPackages = with pkgs; [ eza bat - neofetch zoxide starship ]; diff --git a/nix/modules/nixos/system/xkb/default.nix b/nix/modules/nixos/system/xkb/default.nix index a2392e9..df5d3dc 100644 --- a/nix/modules/nixos/system/xkb/default.nix +++ b/nix/modules/nixos/system/xkb/default.nix @@ -14,10 +14,10 @@ in { config = mkIf cfg.enable { console.useXkbConfig = true; - services.xserver = { + services.xserver.xkb = { layout = "dh,ru"; # xkbOptions = "grp:shift_caps_toggle,grp_led:caps,terminate:ctrl_alt_bksp"; - xkbOptions = "terminate:ctrl_alt_bksp"; + options = "terminate:ctrl_alt_bksp"; extraLayouts.dh = { description = "Colemak-DH ergo"; languages = ["eng"]; diff --git a/nix/modules/nixos/tools/git/default.nix b/nix/modules/nixos/tools/git/default.nix deleted file mode 100644 index b2c3bfb..0000000 --- a/nix/modules/nixos/tools/git/default.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ - 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/virtualisation/kvm/default.nix b/nix/modules/nixos/virtualisation/kvm/default.nix new file mode 100644 index 0000000..b446d8d --- /dev/null +++ b/nix/modules/nixos/virtualisation/kvm/default.nix @@ -0,0 +1,104 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.virtualisation.kvm; + user = config.custom.user; +in { + options.custom.virtualisation.kvm = with types; { + enable = mkBoolOpt false "Whether or not to enable KVM virtualisation."; + vfioIds = + mkOpt (listOf str) [] + "The hardware IDs to pass through to a virtual machine."; + platform = + mkOpt (enum ["amd" "intel"]) "amd" + "Which CPU platform the machine is using."; + # Use `machinectl` and then `machinectl status ` to + # get the unit "*.scope" of the virtual machine. + machineUnits = + mkOpt (listOf str) [] + "The systemd *.scope units to wait for before starting Scream."; + }; + + config = mkIf cfg.enable { + boot = { + kernelModules = [ + "kvm-${cfg.platform}" + "vfio_virqfd" + "vfio_pci" + "vfio_iommu_type1" + "vfio" + ]; + kernelParams = [ + "${cfg.platform}_iommu=on" + "${cfg.platform}_iommu=pt" + "kvm.ignore_msrs=1" + # "vfio-pci.ids=${concatStringsSep "," cfg.vfioIds}" + ]; + extraModprobeConfig = + optionalString (length cfg.vfioIds > 0) + '' + softdep amdgpu pre: vfio vfio-pci + options vfio-pci ids=${concatStringsSep "," cfg.vfioIds} + ''; + }; + + systemd.tmpfiles.rules = [ + "f /dev/shm/looking-glass 0660 ${user.name} qemu-libvirtd -" + "f /dev/shm/scream 0660 ${user.name} qemu-libvirtd -" + ]; + + virtualisation = { + libvirtd = { + enable = true; + extraConfig = '' + user="${user.name}" + ''; + + onBoot = "ignore"; + onShutdown = "shutdown"; + + qemu = { + package = pkgs.qemu_kvm; + ovmf = enabled; + swtpm = enabled; + verbatimConfig = '' + namespaces = [] + user = "+${builtins.toString config.users.users.${user.name}.uid}" + ''; + }; + }; + }; + + custom.virtualisation = { + virt-manager.enable = true; + }; + + users.users.${user.name}.extraGroups = ["qemu-libvirtd" "libvirtd" "disk"]; + home = { + extraOptions = { + systemd.user.services.scream = { + Unit.Description = "Scream"; + Unit.After = + [ + "libvirtd.service" + "pipewire-pulse.service" + "pipewire.service" + "sound.target" + ] + ++ cfg.machineUnits; + Service.ExecStart = "${pkgs.scream}/bin/scream -n scream -o pulse -m /dev/shm/scream"; + Service.Restart = "always"; + Service.StartLimitIntervalSec = "5"; + Service.StartLimitBurst = "1"; + Install.RequiredBy = cfg.machineUnits; + }; + }; + }; + # }; + }; +} diff --git a/nix/modules/nixos/virtualisation/virt-manager/default.nix b/nix/modules/nixos/virtualisation/virt-manager/default.nix new file mode 100644 index 0000000..449f719 --- /dev/null +++ b/nix/modules/nixos/virtualisation/virt-manager/default.nix @@ -0,0 +1,21 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.virtualisation.virt-manager; +in { + options.custom.virtualisation.virt-manager = with types; { + enable = mkBoolOpt false "Whether or not to enable virt-manager."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + virt-manager + ]; + }; +} diff --git a/nix/systems/aarch64-darwin/mbp/default.nix b/nix/systems/aarch64-darwin/mbp13/default.nix similarity index 51% rename from nix/systems/aarch64-darwin/mbp/default.nix rename to nix/systems/aarch64-darwin/mbp13/default.nix index a5b0be3..f76bea0 100644 --- a/nix/systems/aarch64-darwin/mbp/default.nix +++ b/nix/systems/aarch64-darwin/mbp13/default.nix @@ -7,12 +7,18 @@ with lib.custom; { custom = { suites = { common = enabled; - development = enabled; + develop = enabled; + }; + + virtualisation = { + virt-manager = enabled; }; desktop.yabai = enabled; + desktop.addons.wezterm = enabled; }; + # suites.common.enable = true; # Enables the basics, like audio, networking, ssh, etc. environment.systemPath = [ "/opt/homebrew/bin" ]; diff --git a/nix/systems/x86_64-linux/nz/default.nix b/nix/systems/x86_64-linux/nz/default.nix index ec4af25..24ab81c 100644 --- a/nix/systems/x86_64-linux/nz/default.nix +++ b/nix/systems/x86_64-linux/nz/default.nix @@ -11,12 +11,14 @@ # # Any particular packages only for this host # ]; + # Suites managed by nix, see suites by home-manager in homes 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; + custom.virtualisation = { + virt-manager.enable = true; + kvm.enable = false; }; # ======================== DO NOT CHANGE THIS ======================== diff --git a/nix/systems/x86_64-linux/nz/hardware-configuration.nix b/nix/systems/x86_64-linux/nz/hardware-configuration.nix index dc20ebd..5220ceb 100644 --- a/nix/systems/x86_64-linux/nz/hardware-configuration.nix +++ b/nix/systems/x86_64-linux/nz/hardware-configuration.nix @@ -44,6 +44,8 @@ networking.useDHCP = lib.mkDefault true; networking.hosts = { "192.168.89.200" = ["truenas.sbulav.ru"]; + "100.91.128.100" = ["vault-c11.pyn.ru"]; + "100.92.128.100" = ["vault-c12.pyn.ru"]; }; # networking.interfaces.enp2s0f0.useDHCP = lib.mkDefault true; # networking.interfaces.enp5s0.useDHCP = lib.mkDefault true; diff --git a/nvim/after/plugin/keymap.vim b/nvim/after/plugin/keymap.vim index 3c54691..88fdcc0 100644 --- a/nvim/after/plugin/keymap.vim +++ b/nvim/after/plugin/keymap.vim @@ -216,17 +216,16 @@ nnoremap o :w %bd e# bd# nnoremap ; q:A " Simply run a make command -nnoremap m :Telescope marks nnoremap md :delmarks! :delmarks A-Z :lua require("utils.marks").refresh() -nnoremap mo mO :lua require("utils.marks").refresh() nnoremap `N nnoremap `E nnoremap `I nnoremap `O -nnoremap n mN :lua require("utils.marks").refresh() -nnoremap e mE :lua require("utils.marks").refresh() -nnoremap i mI :lua require("utils.marks").refresh() -nnoremap o mO :lua require("utils.marks").refresh() +nnoremap m :lua require("utils.marks").marks_to_quickfix_list() +nnoremap n mN :lua require("utils.marks").refresh() +nnoremap e mE :lua require("utils.marks").refresh() +nnoremap i mI :lua require("utils.marks").refresh() +nnoremap o mO :lua require("utils.marks").refresh() nnoremap mn mN :lua require("utils.marks").refresh() nnoremap me mE :lua require("utils.marks").refresh() nnoremap mi mI :lua require("utils.marks").refresh() diff --git a/nvim/lua/plugins/qf_helper.lua b/nvim/lua/plugins/qf_helper.lua index d84c4b2..e256267 100644 --- a/nvim/lua/plugins/qf_helper.lua +++ b/nvim/lua/plugins/qf_helper.lua @@ -3,6 +3,15 @@ return { "stevearc/qf_helper.nvim", event = "VeryLazy", config = function() - require("qf_helper").setup {} + require("qf_helper").setup { + quickfix = { + autoclose = true, -- Autoclose qf if it's the only open window + default_bindings = true, -- Set up recommended bindings in qf window + default_options = true, -- Set recommended buffer and window options + max_height = 10, -- Max qf height when using open() or toggle() + min_height = 1, -- Min qf height when using open() or toggle() + track_location = false, -- Keep qf updated with your current location + }, + } end, } diff --git a/nvim/lua/utils/init.lua b/nvim/lua/utils/init.lua index 81cf616..46a5bb7 100644 --- a/nvim/lua/utils/init.lua +++ b/nvim/lua/utils/init.lua @@ -54,10 +54,10 @@ function M.cheatSheetCommand(detect_language) local command = "" if searchPhrase == nil then - command = language + command = language else - command = language .. "/" .. searchPhrase - end + command = language .. "/" .. searchPhrase + end M.info("cht.sh/" .. command, "Cheat Sheet Query") return ("!curl -s cht.sh/" .. command) diff --git a/nvim/lua/utils/marks.lua b/nvim/lua/utils/marks.lua index ef792d3..bbca96f 100644 --- a/nvim/lua/utils/marks.lua +++ b/nvim/lua/utils/marks.lua @@ -17,7 +17,9 @@ end local function is_lower(char) return (97 <= char:byte() and char:byte() <= 122) end - +local function path_exists(path) + return vim.loop.fs_stat(path) and true or false +end local function define_sign(name) if is_upper(name) then vim.fn.sign_define(name, { @@ -68,6 +70,33 @@ local function add_local_marks() end end +function M.marks_to_quickfix_list() + local global_marks = { + items = vim.fn.getmarklist(), + name_func = function(mark, _) + -- get buffer name if it is opened, otherwise get file name + return vim.api.nvim_get_mark(mark, {})[4] + end, + } + local marks_table = {} + for _, v in ipairs(global_marks.items) do + -- strip the first single quote character + local mark_name = string.sub(v.mark, 2, 3) + local _, lnum, col, _ = unpack(v.pos) + local row = { + text = mark_name, + filename = vim.fs.normalize(v.file), + lnum = lnum, + col = col, + } + if string.find("NEIO", mark_name) and path_exists(row.filename) then + table.insert(marks_table, row) + end + end + vim.fn.setqflist({}, " ", { title = "Bookmarks", id = "$", items = marks_table }) + vim.cmd [[QFToggle]] +end + function M.setup(user_config) if not user_config then config = Defaults