From 4bba4871b48715a102eff033c3e735f0226ef861 Mon Sep 17 00:00:00 2001 From: Satria Date: Sun, 8 Feb 2026 11:03:31 +0700 Subject: [PATCH] home config migration --- README.md | 4 +- modules/home/core/apps.nix | 50 ++++ modules/home/core/cli.nix | 85 ++++++ modules/home/core/xdg.nix | 26 ++ modules/home/core/zed.nix | 50 ++++ modules/home/core/zsh.nix | 74 +++++ modules/home/default.nix | 17 ++ modules/home/desktop.nix | 30 ++ modules/home/misc/kde-connect.nix | 6 + modules/home/rice/cursor.nix | 8 + modules/home/rice/dunst.nix | 21 ++ modules/home/rice/hypridle.nix | 38 +++ modules/home/rice/hyprland.nix | 163 +++++++++++ modules/home/rice/hyprlock.nix | 74 +++++ modules/home/rice/keybinds.nix | 172 +++++++++++ modules/home/rice/rofi.nix | 42 +++ modules/home/rice/theme.nix | 42 +++ modules/home/rice/waybar.nix | 266 ++++++++++++++++++ modules/home/rice/wlogout.nix | 51 ++++ modules/system/core/shell.nix | 6 + modules/system/default.nix | 8 +- modules/system/desktop.nix | 42 +++ .../system/misc/{desktop.nix => graphics.nix} | 17 +- modules/system/misc/programs.nix | 7 +- modules/system/misc/theme.nix | 13 + 25 files changed, 1296 insertions(+), 16 deletions(-) create mode 100644 modules/home/core/apps.nix create mode 100644 modules/home/core/cli.nix create mode 100644 modules/home/core/xdg.nix create mode 100644 modules/home/core/zed.nix create mode 100644 modules/home/core/zsh.nix create mode 100644 modules/home/default.nix create mode 100644 modules/home/desktop.nix create mode 100644 modules/home/misc/kde-connect.nix create mode 100644 modules/home/rice/cursor.nix create mode 100644 modules/home/rice/dunst.nix create mode 100644 modules/home/rice/hypridle.nix create mode 100644 modules/home/rice/hyprland.nix create mode 100644 modules/home/rice/hyprlock.nix create mode 100644 modules/home/rice/keybinds.nix create mode 100644 modules/home/rice/rofi.nix create mode 100644 modules/home/rice/theme.nix create mode 100644 modules/home/rice/waybar.nix create mode 100644 modules/home/rice/wlogout.nix create mode 100644 modules/system/core/shell.nix create mode 100644 modules/system/desktop.nix rename modules/system/misc/{desktop.nix => graphics.nix} (68%) create mode 100644 modules/system/misc/theme.nix diff --git a/README.md b/README.md index 6544a6c..1d67865 100644 --- a/README.md +++ b/README.md @@ -16,5 +16,5 @@ rewrite of my nixos flake with hopefully better structuring and modularity - [X] apps list - [X] user config (not hm) -- [ ] home manager config -- [ ] rice config (everything in /rice) \ No newline at end of file +- [X] home manager config +- [X] rice config (everything in /rice) diff --git a/modules/home/core/apps.nix b/modules/home/core/apps.nix new file mode 100644 index 0000000..f5f2acf --- /dev/null +++ b/modules/home/core/apps.nix @@ -0,0 +1,50 @@ +{ pkgs, ... }: { + home = { + sessionVariables = { + EDITOR = "nvim"; + BROWSER = "brave"; + TERMINAL = "kitty"; + }; + packages = with pkgs; [ + vscode # lets see how long you survive as my default code editor + zed-editor + + discord + slack + brave + + appimage-run + #winboat + libreoffice + #keepassxc + vlc + remmina + moonlight-qt + kdePackages.kdenlive + inkscape + #davinci-resolve + + (wrapOBS { + plugins = with obs-studio-plugins; [ + wlrobs + obs-backgroundremoval + obs-pipewire-audio-capture + ]; + }) + + portablemc + ferium + virt-manager + + # CLI tools moved to core/cli.nix + go + bun + #nodejs # pkgs.buildEnv error: two given paths contain a conflicting subpath + nodePackages.npm + nodePackages.pnpm + nodePackages.yarn + python314 + jdk25_headless + ]; + }; +} \ No newline at end of file diff --git a/modules/home/core/cli.nix b/modules/home/core/cli.nix new file mode 100644 index 0000000..d0a8b9b --- /dev/null +++ b/modules/home/core/cli.nix @@ -0,0 +1,85 @@ +{ pkgs, git, rice, ... }: { + programs = { + tmux.enable = true; + vim.enable = true; + bat.enable = true; + kitty = { + enable = true; + package = pkgs.kitty; + settings = { + font_family = rice.font; + background_opacity = 0.8; + background_blur = 4; + window_padding_width = 8; + cursor_shape = "beam"; + cursor_trail = 10; + copy_on_select = true; + }; + }; + ranger = { + enable = true; + aliases = { + "sh" = "shell zsh"; + "zed" = "shell zeditor ."; + "vim" = "shell vim"; + "img" = "shell eog ."; + }; + }; + btop = { + enable = true; + settings = { + update_ms = 100; + shown_boxes = "proc cpu"; + }; + }; + neovim = { + enable = true; + defaultEditor = true; + vimAlias = true; + initLua = '' + vim.opt.clipboard = "unnamedplus" + vim.opt.termguicolors = true + require("nvim-tree").setup() + vim.api.nvim_create_autocmd("VimEnter", { + callback = function() + -- vim.cmd("NvimTreeOpen") + vim.cmd.wincmd 'p' + end, + }) + ''; + plugins = with pkgs.vimPlugins; [ + bufferline-nvim + nvim-web-devicons + nvim-treesitter + nvim-lspconfig + telescope-file-browser-nvim + nvim-tree-lua + nvim-cmp + barbar-nvim + indent-blankline-nvim + markdown-preview-nvim + ]; + }; + gh = { + enable = true; + settings.editor = "nvim"; + gitCredentialHelper.enable = true; + extensions = with pkgs; [ + gh-dash + gh-skyline + gh-eco + ]; + }; + git = { + enable = true; + settings = { + pull.rebase = "true"; + user = { + name = git.user; + email = git.email; + }; + }; + }; + + }; +} \ No newline at end of file diff --git a/modules/home/core/xdg.nix b/modules/home/core/xdg.nix new file mode 100644 index 0000000..141e9c0 --- /dev/null +++ b/modules/home/core/xdg.nix @@ -0,0 +1,26 @@ +{ ... }: { + xdg = { + autostart.enable = true; + mimeApps = { + enable = true; + defaultApplications = { + "text/plain" = "nvim.desktop"; + "text/html" = "brave-browser.desktop"; + "application/pdf" = "brave-browser.desktop"; + "x-scheme-handler/http" = "brave-browser.desktop"; + "x-scheme-handler/https" = "brave-browser.desktop"; + "x-scheme-handler/terminal" = "kitty.desktop"; + "x-terminal-emulator" = "kitty.desktop"; + "inode/directory" = "pcmanfm-qt.desktop"; + "audio/mpeg" = "vlc.desktop"; + "audio/mp3" = "vlc.desktop"; + "audio/wav" = "vlc.desktop"; + "audio/flac" = "vlc.desktop"; + "video/mp4" = "vlc.desktop"; + "video/x-matroska" = "vlc.desktop"; + "video/webm" = "vlc.desktop"; + "video/x-msvideo" = "vlc.desktop"; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/home/core/zed.nix b/modules/home/core/zed.nix new file mode 100644 index 0000000..f535d21 --- /dev/null +++ b/modules/home/core/zed.nix @@ -0,0 +1,50 @@ +{ pkgs, ... }: { + programs.zed-editor = { + enable = true; + package = pkgs.zed-editor; + extensions = [ "nix" ]; + userSettings = { + format_on_save = "off"; + features.edit_prediction_provider = "copilot"; + vim_mode = true; + git.inline_blame.enabled = true; + gutter.line_numbers = true; + relative_line_numbers = "enabled"; + minimap.show = "never"; + autosave.after_delay.milliseconds = 1000; + tab_size = 2; + ui_font_size = 16; + buffer_font_size = 15; + base_keymap = "VSCode"; + file_types.tailwindcss = [ "*.css" ]; + auto_install_extensions.catppuccin-icons = true; + icon_theme = "Catppuccin Mocha"; + theme = { + mode = "dark"; + light = "Catppuccin Mocha (sapphire)"; + dark = "Catppuccin Mocha (sapphire)"; + }; + lsp.discord_presence.initialization_options = { + application_id = "1263505205522337886"; + base_icons_url = "https://raw.githubusercontent.com/xhyrom/zed-discord-presence/main/assets/icons/"; + state = "Working on {filename}"; + details = "In {workspace}"; + large_image = "{base_icons_url}/{language:lo}.png"; + large_text = "{language:u}"; + small_image = "{base_icons_url}/zed.png"; + small_text = "Zed"; + git_integration = true; + idle = { + timeout = 300; + action = "change_activity"; + state = "Idling"; + details = "In Zed"; + large_image = "{base_icons_url}/zed.png"; + large_text = "Zed"; + small_image = "{base_icons_url}/idle.png"; + small_text = "Idle"; + }; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/home/core/zsh.nix b/modules/home/core/zsh.nix new file mode 100644 index 0000000..52c5a0b --- /dev/null +++ b/modules/home/core/zsh.nix @@ -0,0 +1,74 @@ +{ hostname, flake-path, mc, ... }: { + programs = { + pay-respects = { + enable = true; + enableZshIntegration = true; + options = [ + "--alias" + "f" + ]; + }; + zsh = { + enable = true; + autocd = true; + syntaxHighlighting.enable = true; + envExtra = '' + NIXPKGS_ALLOW_UNFREE=1 + WINEPREFIX="~/.wine" + WINEARCH="win64" + DISPLAY=":0" + EDITOR="nvim" + PORT="3000" + ''; + shellAliases = { + "cd-gvfs" = "cd /run/user/$(id -u)/gvfs"; + "wlp-set" = "swww img --transition-type=grow --transition-duration=1"; + "ssh" = "TERM=xterm-256color ssh"; + + "sys" = "sudo systemctl"; + "sys-log" = "journalctl -f -b -u"; + "user" = "systemctl --user"; + "user-log" = "journalctl -f -b --user-unit"; + + "ts" = "sudo tailscale"; + "tsip" = "tailscale ip -4"; + "rmall" = "rm -rf ./* ./.*"; # scary! + "srmall" = "sudo rm -rf ./* ./.*"; # also scary! + + "fetch-update" ="rm -f ~/.fetch.sh && wget https://raw.githubusercontent.com/SX-9/fetch.sh/master/fetch.sh -O ~/.fetch.sh && chmod +x ~/.fetch.sh"; + "fetch" = "~/.fetch.sh"; + + "hm-sw" = "home-manager switch -b bak-hm --flake"; + "nix-sw" = "sudo nixos-rebuild switch --flake"; + "nix-hw-conf" = "nixos-generate-config --show-hardware-config"; + "cd-conf" = "cd ${flake-path}"; + "code-conf" = "zeditor ${flake-path}"; + + "mkdistro" = "distrobox create -Y -i"; + "mkdistro-arch" = "mkdistro archlinux -n arch"; + "mkdistro-deb" = "mkdistro debian -n deb"; + "win11-compose" = "docker compose --file ~/.config/winapps/compose.yaml"; + "wm-ctl" = "hyprctl --instance 0"; + "wm-lock" = "wm-ctl dispatch exec loginctl lock-session && notify-send ${hostname} 'Manual lock triggered'"; + "wm-dpms" = "wm-ctl dispatch dpms"; + + "git-author-setup" = "git config user.name $(gh api -H \"Accept: application/vnd.github+json\" -H \"X-GitHub-Api-Version: 2022-11-28\" /user | jq -r .login) && git config user.email $(gh api -H \"Accept: application/vnd.github+json\" -H \"X-GitHub-Api-Version: 2022-11-28\" /user/emails | jq -r \".[1].email\")"; + "mcl" = "portablemc start ${mc.version} -l ${mc.email}"; + "mc" = "ferium upgrade; mcl"; + + "please" = "SUDO_PROMPT=\"What is the magic word? \" sudo"; + "pls" = "SUDO_PROMPT=\"What is the magic word? \" sudo"; + }; + initContent = '' + if [[ -z "$SSH_CONNECTION" && $(tput cols) -ge 64 && $(tput lines) -ge 16 ]]; then + # ~/.fetch.sh -c 2> /dev/null + fi + ''; + oh-my-zsh = { + enable = true; + plugins = ["git"]; + theme = "refined"; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/home/default.nix b/modules/home/default.nix new file mode 100644 index 0000000..40b8e02 --- /dev/null +++ b/modules/home/default.nix @@ -0,0 +1,17 @@ +{ username, ... }: { + imports = [ + ./misc/kde-connect.nix + ./core/apps.nix + ./core/zed.nix + ./core/xdg.nix + ./core/cli.nix + ./core/zsh.nix + ./desktop.nix + ]; + + home = { + stateVersion = "24.11"; + username = "${username}"; + homeDirectory = "/home/${username}"; + }; +} diff --git a/modules/home/desktop.nix b/modules/home/desktop.nix new file mode 100644 index 0000000..93658cc --- /dev/null +++ b/modules/home/desktop.nix @@ -0,0 +1,30 @@ +{ pkgs, ... }: { + imports = [ + ./rice/hyprland.nix + ./rice/hyprlock.nix + ./rice/waybar.nix + ./rice/rofi.nix + ./rice/wlogout.nix + ./rice/hypridle.nix + ./rice/dunst.nix + ./rice/cursor.nix + ./rice/theme.nix + ./rice/keybinds.nix + ]; + + services = { + swww.enable = true; + hyprpolkitagent.enable = true; + }; + + home = { + packages = with pkgs; [ + playerctl brightnessctl + networkmanagerapplet + qt6Packages.qt6ct kdePackages.qtstyleplugin-kvantum + nwg-displays + lxqt.pcmanfm-qt + hyprshot wl-clipboard cliphist + ]; + }; +} diff --git a/modules/home/misc/kde-connect.nix b/modules/home/misc/kde-connect.nix new file mode 100644 index 0000000..f465969 --- /dev/null +++ b/modules/home/misc/kde-connect.nix @@ -0,0 +1,6 @@ +{ ... }: { + services.kdeconnect = { + enable = true; + indicator = true; + }; +} \ No newline at end of file diff --git a/modules/home/rice/cursor.nix b/modules/home/rice/cursor.nix new file mode 100644 index 0000000..9a193c5 --- /dev/null +++ b/modules/home/rice/cursor.nix @@ -0,0 +1,8 @@ +{ pkgs, ctp-opt, ... }: { + home.pointerCursor = { + gtk.enable = true; + package = pkgs.catppuccin-cursors."${ctp-opt.flavor}Light"; + name = "catppuccin-${ctp-opt.flavor}-light-cursors"; + size = 24; + }; +} \ No newline at end of file diff --git a/modules/home/rice/dunst.nix b/modules/home/rice/dunst.nix new file mode 100644 index 0000000..4d3afe1 --- /dev/null +++ b/modules/home/rice/dunst.nix @@ -0,0 +1,21 @@ +{ pkgs, rice, ... }: { + services.dunst = { + enable = true; + settings.global = { + font = "${rice.font} 8"; + width = 300; + origin = "${if rice.bar.top then "top" else "bottom"}-right"; + offset = "${toString rice.gap.outer}x${toString rice.gap.outer}"; + corner_radius = rice.borders.rounded; + frame_width = rice.borders.size; + notification_limit = 0; + mouse_left_click = "close_current"; + mouse_middle_click = "do_action"; + mouse_right_click = "context"; + }; + }; + + home.packages = with pkgs; [ + dunst + ]; +} \ No newline at end of file diff --git a/modules/home/rice/hypridle.nix b/modules/home/rice/hypridle.nix new file mode 100644 index 0000000..18d162d --- /dev/null +++ b/modules/home/rice/hypridle.nix @@ -0,0 +1,38 @@ +{ pkgs, ... }: { + services.hypridle = { + enable = true; + settings = { + general = { + lock_cmd = "hyprlock"; + unlock_cmd = "pkill -USR1 hyprlock"; + before_sleep_cmd = "hyprctl dispatch dpms off && hyprlock"; + after_sleep_cmd = "hyprctl dispatch dpms on && pkill -USR2 hyprlock"; + }; + listener = [ + { + timeout = 120; + on-timeout = "brightnessctl s 10%-"; + on-resume = "brightnessctl s +10%"; + } + { + timeout = 300; + on-timeout = "hyprlock"; + on-resume = "pkill -USR2 hyprlock"; + } + { + timeout = 420; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + { + timeout = 600; + on-timeout = "systemctl suspend"; + } + ]; + }; + }; + + home.packages = with pkgs; [ + hypridle + ]; +} \ No newline at end of file diff --git a/modules/home/rice/hyprland.nix b/modules/home/rice/hyprland.nix new file mode 100644 index 0000000..3e5ccd5 --- /dev/null +++ b/modules/home/rice/hyprland.nix @@ -0,0 +1,163 @@ +{ pkgs, rice, ctp-opt, ... }: { + imports = [ + ./keybinds.nix + ]; + + wayland.windowManager.hyprland = { + enable = true; + systemd.enable = false; + package = pkgs.hyprland; # inputs.hl.packages."${pkgs.system}".hyprland; + xwayland.enable = true; + settings = { + debug = { + error_position = 1; + disable_logs = true; + }; + + # monitor = [ + # "eDP-1,preferred,auto,1" + # ",preferred,auto,1" + # ]; + source = [ + "~/.config/hypr/monitors.conf" + "~/.config/hypr/workspaces.conf" + ]; # nwg-displays + + exec-once = [ + "hyprctl setcursor catppuccin-mocha-light-cursors 24" + "wl-paste --type text --watch cliphist store" + "wl-paste --type image --watch cliphist store" + + #"dunst &" + #"hypridle &" + #"swww-daemon &" + "uwsm app -s s -- waybar &" + "uwsm app -s b -- sunshine &" + + "uwsm app -s b -- blueman-applet &" + "uwsm app -s b -- nm-applet &" + "uwsm app -s b -- tailscale-systray &" + #"keepassxc &" + ]; + + env = [ + "XCURSOR_SIZE,24" + "XCURSOR_THEME,catppuccin-${ctp-opt.flavor}-light-cursors" + "HYPRCURSOR_SIZE,24" + "HYPRCURSOR_THEME,catppuccin-${ctp-opt.flavor}-light-cursors" + + "CLIPHIST_MAX_ITEMS,36" + + "GTK_APPLICATION_PREFER_DARK_THEME,1" + "GTK_THEME,Adwaita:dark" + "QT_QPA_PLATFORMTHEME,kvantum" + ]; + + general = { + gaps_in = rice.gap.inner; + gaps_out = rice.gap.outer; + border_size = rice.borders.size; + resize_on_border = true; + allow_tearing = false; + layout = "dwindle"; + + "col.active_border" = if rice.borders.colored then "$accent" else "$overlay0"; + "col.inactive_border" = if rice.borders.colored then "$overlay2" else "$crust"; + }; + + dwindle = { + preserve_split = true; + pseudotile = true; + }; + + decoration = { + rounding = rice.borders.rounded; + rounding_power = 2; + active_opacity = 1.0; + inactive_opacity = 0.9; + + shadow = { + enabled = true; + range = 6; + render_power = 3; + color_inactive = "rgba($crustAlpha99)"; + color = "rgba($crustAlphaee)"; + }; + + blur = { + enabled = true; + size = 3; + passes = 1; + vibrancy = 0.1696; + }; + }; + + animations = { + enabled = true; + #first_launch_animation = false; + + bezier = [ + "easeOutQuint,0.23,1,0.32,1" + "quick,0.15,0,0.1,1" + "overshot,0.05,0.9,0.1,1.1" + "instant,0,0,1,1" + ]; + + animation = [ + "global, 1, 10, default" + "fade, 1, 3, quick" + "border, 1, 10, quick" + "layers, 1, 5, easeOutQuint, slidevert" + "windows, 1, 5, easeOutQuint, popin 87%" + "workspaces, 1, 5, easeOutQuint, slidefade 20%" + "specialWorkspace, 1, 5, easeOutQuint, slidefadevert ${if rice.bar.top then "" else "-"}20%" + "zoomFactor, 1, 1, instant" + ]; + }; + + misc = { + force_default_wallpaper = 0; + disable_hyprland_logo = true; + focus_on_activate = true; + middle_click_paste = false; + exit_window_retains_fullscreen = true; + on_focus_under_fullscreen = 1; + background_color = "$base"; + vfr = true; + }; + + input = { + kb_layout = "us"; + kb_options = "caps:none"; + follow_mouse = 1; + sensitivity = 0; + touchpad = { + natural_scroll = true; + middle_button_emulation = 0; + }; + }; + + layerrule = [ + "no_anim on, match:namespace selection" # hyprshot overlay + "animation fade, match:namespace swww-daemon" + "animation fade, match:namespace logout_dialog" + "above_lock false, match:namespace waybar" + "above_lock true, match:namespace notifications" + "above_lock true, match:namespace selection" + "above_lock true, match:namespace logout_dialog" + ]; + + windowrule = [ + "suppress_event minimize, match:class .*" + "no_focus on, match:class ^$, match:title ^$, match:xwayland 1, match:float 1, match:fullscreen 0, match:pin 0" + + "stay_focused on, suppress_event fullscreen maximize, dim_around on, float on, match:title ^(Hyprland Polkit Agent|Unlock Login Keyring|KeePassXC -.*)$" + "keep_aspect_ratio on, pin on, match:title ^(Picture in picture)$" + + "float on, match:title ^(Open|Print|Save|Rename|Move|Copy|Confirm).*" + "float on, match:title ^(Preferences|Settings|Options|About|Passbolt).*" + "float on, match:title ^(MainPicker|Volume Control|File Operation Progress|Network Connections|Choose an Application| )$" + ]; + }; + }; +} diff --git a/modules/home/rice/hyprlock.nix b/modules/home/rice/hyprlock.nix new file mode 100644 index 0000000..70abdf0 --- /dev/null +++ b/modules/home/rice/hyprlock.nix @@ -0,0 +1,74 @@ +{ rice, ... }: { + programs.hyprlock = { + enable = true; + settings = { + + general = { + ignore_empty_input = true; + hide_cursor = false; + }; + + animation = { + bezier = [ + "easeOutQuint,0.23,1,0.32,1" + "quick,0.15,0,0.1,1" + "overshot,0.05,0.9,0.1,1.1" + ]; + + animation = [ + "fade, 1, 3.5, easeOutQuint" + ]; + }; + + background = [ + { + path = "screenshot"; + brightness = 0.25; + blur_passes = 3; + blur_size = 1; + } + ]; + + label = [ + { + text = " 󰌾 "; + color = "$subtext1"; + font_size = 64; + position = "0, 0"; + shadow_passes = 1; + shadow_boost = 0.5; + halign = "center"; + valign = "center"; + } + ]; + + input-field = [ + { + size = "200, 50"; + position = "0, ${builtins.toString (rice.gap.outer + (if rice.bar.top then 0 else 60))}"; + valign = "bottom"; + halign = "center"; + + dots_center = true; + fade_on_empty = false; + outline_thickness = rice.borders.size; + shadow_passes = 8; + rounding = rice.borders.rounded; + + outer_color = if rice.borders.colored then "$accent" else "$overlay0"; + inner_color = "$crust"; + font_color = "$text"; + placeholder_text = "Type your password"; + font_family = rice.font; + # font_family = "monospace"; + + capslock_color = "$yellow"; + check_color = "$green"; + fail_color = "$red"; + fail_text = " $FAIL ($ATTEMPTS)"; + } + ]; + + }; + }; +} \ No newline at end of file diff --git a/modules/home/rice/keybinds.nix b/modules/home/rice/keybinds.nix new file mode 100644 index 0000000..b67f22a --- /dev/null +++ b/modules/home/rice/keybinds.nix @@ -0,0 +1,172 @@ +{ pkgs, hostname, ... }: { + services.fusuma = { + extraPackages = with pkgs; [ systemd coreutils-full xorg.xprop ]; + enable = true; + settings = { + swipe = { + "4".down.sendkey = "LEFTMETA+L"; + "4".up.sendkey = "LEFTMETA+M"; + "3".up.sendkey = "LEFTMETA+W"; + + "3".down.sendkey = "LEFTMETA+DOWN"; + "3".right.sendkey = "LEFTMETA+LEFT"; + "3".left.sendkey = "LEFTMETA+RIGHT"; + }; + hold = { + "3".sendkey = "LEFTMETA+TAB"; + "4".sendkey = "LEFTMETA+SPACE"; + }; + }; + }; + wayland.windowManager.hyprland = { + settings = { + gestures = { + #workspace_swipe = true; + workspace_swipe_forever = true; + }; + + # gesture = [ + # "3, up, fullscreen, maximize" + # "3, down, scale: 0.5, special, hidden" + # "3, left, workspace, -1" + # "3, right, workspace, +1" + # ]; + + binde = [ + "ALT, TAB, cyclenext," + "ALT, TAB, bringactivetotop," + "ALT SHIFT, TAB, cyclenext, prev" + "ALT SHIFT, TAB, bringactivetotop," + + "SUPER SHIFT, right, movetoworkspace, +1" + "SUPER SHIFT, left, movetoworkspace, -1" + "SUPER SHIFT, 1, movetoworkspace, 1" + "SUPER SHIFT, 2, movetoworkspace, 2" + "SUPER SHIFT, 3, movetoworkspace, 3" + "SUPER SHIFT, 4, movetoworkspace, 4" + + "SUPER, right, workspace, +1" + "SUPER, left, workspace, -1" + "SUPER, 1, workspace, 1" + "SUPER, 2, workspace, 2" + "SUPER, 3, workspace, 3" + "SUPER, 4, workspace, 4" + ]; + + bindm = [ + "SUPER, mouse:272, movewindow" + "SUPER, mouse:273, resizewindow" + ]; + + bindc = [ + "SUPER, mouse:274, killactive" + ]; + + bindl = [ + ", switch:on:Lid Switch, exec, systemctl suspend" + ", PRINT, exec, hyprshot -m region -o ~/Pictures/Screenshots" + "SUPER, SPACE, exec, playerctl play-pause" + "SUPER, M, exec, wlogout" + "SUPER, TAB, exec, pkill -SIGUSR1 waybar" + ]; + + bindel = [ + ",XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+" + ",XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + ",XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + ",XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + ",XF86MonBrightnessUp, exec, brightnessctl s 10%+" + ",XF86MonBrightnessDown, exec, brightnessctl s 10%-" + ]; + + bind = [ + # ",XF86Tools, exec, " + # ",XF86Bluetooth, exec, " + # ",XF86Keyboard, exec, " + # ",XF86Favorites, exec, " + + ",XF86Display, exec, [float; size 75%] uwsm app -- nwg-displays" + "CTRL ALT, DELETE, exec, wlogout" + "CTRL SHIFT, ESCAPE, exec, [float; size 75%] uwsm app -- kitty btop" + "SUPER, Grave, exec, dunstctl set-paused toggle" + + "SUPER, N, exec, uwsm app -- rofi-network-manager" + + "SUPER, J, exec, notify-send -u critical ${hostname} 'Caffein Mode' && notify-send '(SUPER+X to reset)' && systemctl --user stop hypridle" + "SUPER, K, exec, notify-send -u critical ${hostname} 'Focus Mode' && notify-send '(SUPER+X to reset)' && systemctl --user stop swww && pkill -SIGUSR1 waybar && hyprctl --batch 'keyword decoration:inactive_opacity 1.0; keyword decoration:blur:enabled 0; keyword general:gaps_in 0; keyword general:gaps_out 0; keyword general:border_size 1; keyword decoration:rounding 0; keyword decoration:shadow:enabled false'" + "SUPER, B, submap, disabled-all-keybinds" + "SUPER, H, exec, notify-send ${hostname} 'Animations Off' && hyprctl keyword animations:enabled 0" + "SUPER, X, exec, dunstctl close-all && hyprctl reload && hyprctl dispatch submap reset && pkill -SIGUSR2 waybar && systemctl --user restart swww hypridle fusuma" + "SUPER, Z, exec, dunstctl close-all" + + "SUPER SHIFT, S, exec, hyprshot -m region -o ~/Pictures/Screenshots" + "ALT, PRINT, exec, hyprshot -m output -o ~/Pictures/Screenshots" + + "SUPER, R, exec, rofi -show drun -show-icons -display-drun '' -run-command \"uwsm app -- {cmd}\"" + "SUPER, V, exec, rofi -modi clipboard:cliphist-rofi-img -show clipboard -show-icons" + # "SUPER, B, exec, rofi -show calc -modi calc -no-show-match -no-sort" + + "SUPER, A, exec, uwsm app -- zeditor" + "SUPER, T, exec, uwsm app -- kitty" + "SUPER, E, exec, uwsm app -- pcmanfm-qt ~" # kitty ranger ~" + "SUPER, C, exec, [float; size 75%] uwsm app -- kitty btop" + "SUPER SHIFT, C, exec, [float; size 75%] uwsm app -- kitty zsh -c 'fastfetch; exec zsh -i'" + "SUPER, Y, exec, uwsm app -- brave --restore-last-session" + "SUPER, D, exec, uwsm app -- steam steam://open/bigpicture" + "SUPER SHIFT, D, exec, uwsm app -- steam" + + "SUPER, Q, killactive," + "SUPER SHIFT, Q, forcekillactive," + "SUPER, W, fullscreen, 1" + "SUPER, S, fullscreen, 0" + "SUPER, F, togglefloating," + "SUPER, G, togglesplit," + "SUPER, L, exec, loginctl lock-session" + + "SUPER, down, togglespecialworkspace, hidden" + "SUPER SHIFT, down, movetoworkspace, special:hidden" + "SUPER SHIFT, up, movetoworkspace, +0" + + "SUPER, P, submap, move" + "SUPER, O, submap, resize" + "SUPER, I, submap, focus" + "SUPER, U, submap, swap" + ]; + }; + + extraConfig = '' + submap = move + binde = , right, movewindow, r + binde = , left, movewindow, l + binde = , up, movewindow, u + binde = , down, movewindow, d + bind = , catchall, submap, reset + + submap = resize + binde = , right, resizeactive, 10 0 + binde = , left, resizeactive, -10 0 + binde = , up, resizeactive, 0 -10 + binde = , down, resizeactive, 0 10 + bind = , catchall, submap, reset + + submap = swap + bind = , right, swapwindow, r + bind = , left, swapwindow, l + bind = , up, swapwindow, u + bind = , down, swapwindow, d + bind = , catchall, submap, reset + + submap = focus + bind = , right, movefocus, r + bind = , left, movefocus, l + bind = , up, movefocus, u + bind = , down, movefocus, d + bind = , catchall, submap, reset + + submap = disabled-all-keybinds + bind = , ESCAPE, submap, reset + + submap = reset + ''; # https://github.com/nix-community/home-manager/issues/6062 + }; +} \ No newline at end of file diff --git a/modules/home/rice/rofi.nix b/modules/home/rice/rofi.nix new file mode 100644 index 0000000..4747523 --- /dev/null +++ b/modules/home/rice/rofi.nix @@ -0,0 +1,42 @@ +{ config, pkgs, rice, ctp-opt, ... }: { + programs.rofi = { + enable = true; + terminal = "${pkgs.kitty}/bin/kitty"; + # location = "top"; + # yoffset = 10; + theme = let inherit (config.lib.formats.rasi) mkLiteral; in { + "entry".placeholder = "Search..."; + "scrollbar".border-radius = rice.borders.rounded; + # "element-icon".size = mkLiteral "2em"; + "*" = { + font = "${rice.font} 12"; + normal-foreground = mkLiteral "@text"; + alternate-normal-foreground = mkLiteral "@text"; + foreground = mkLiteral "@${ctp-opt.accent}"; + border-color = mkLiteral (if rice.borders.colored then "@foreground" else "@overlay0"); + }; + "window" = { + border-radius = rice.borders.rounded; + border = rice.borders.size; + # fullscreen = true; + }; + "listview" = { + columns = 2; # 3; + lines = 9; # 3; + fixed-columns = false; + }; + "element" = { + border-radius = rice.borders.rounded; + padding = mkLiteral "4px"; + spacing = mkLiteral "8px"; + # orientation = mkLiteral "vertical"; + }; + }; + }; + + home.packages = with pkgs; [ + rofi-network-manager + rofi-power-menu + rofi + ]; +} \ No newline at end of file diff --git a/modules/home/rice/theme.nix b/modules/home/rice/theme.nix new file mode 100644 index 0000000..0888d6a --- /dev/null +++ b/modules/home/rice/theme.nix @@ -0,0 +1,42 @@ +{ lib, pkgs, ctp-opt, ... }: { + catppuccin = { + hyprlock.useDefaultConfig = false; + hyprland.accent = ctp-opt.primary; + flavor = ctp-opt.flavor; + accent = ctp-opt.accent; + enable = true; + }; + + dconf = { + enable = true; + settings."org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + gtk-theme = "Adwaita-dark"; + }; + }; + + gtk = { + enable = true; + gtk3.extraConfig.gtk-application-prefer-dark-theme = 1; + iconTheme = { + name = "Papirus-Dark"; + package = lib.mkForce pkgs.papirus-icon-theme; + }; + theme = { + name = "Adwaita-dark"; + package = pkgs.gnome-themes-extra; + }; + }; + + qt = { + enable = true; + platformTheme.name = "kvantum"; + style = { + name = "kvantum"; + package = pkgs.catppuccin-kvantum.override { + variant = ctp-opt.flavor; + accent = ctp-opt.accent; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/home/rice/waybar.nix b/modules/home/rice/waybar.nix new file mode 100644 index 0000000..829a0cc --- /dev/null +++ b/modules/home/rice/waybar.nix @@ -0,0 +1,266 @@ +{ username, hostname, ctp-opt, rice, ... }: { + programs.waybar = { + enable = true; + settings = [ + { + layer = "top"; + position = if rice.bar.top then "top" else "bottom"; + margin-top = if rice.bar.top then rice.gap.outer else 0; + margin-bottom = if rice.bar.top then 0 else rice.gap.outer; + margin-right = rice.gap.outer; + margin-left = rice.gap.outer; + + modules-left = [ + "custom/start" + "hyprland/workspaces" + "hyprland/window" + "mpris" + ]; + modules-center = if rice.bar.minimal then [] else [ + "custom/dunst" + "clock" + "tray" + "hyprland/submap" + ]; + modules-right = if rice.bar.minimal then [ + "tray" + "pulseaudio" + "network" + "battery" + "clock" + "custom/dunst" + ] else [ + "temperature" + "cpu" + "memory" + "disk" + "pulseaudio" + "network" + "battery" + ]; + "cpu" = { + states = { + critical = 85; + }; + interval = 1; + format = " {usage:2}% {avg_frequency}GHz"; + on-click = "auto-cpufreq-gtk"; + on-click-right = "pkexec systemctl restart thermald throttled && notify-send ${hostname} 'CPU Underclocking Restarted'"; + on-click-middle = "pkexec systemctl stop thermald throttled && notify-send ${hostname} 'CPU Underclocking Stopped'"; + }; + "memory" = { + states = { + critical = 85; + }; + interval = 1; + format = " {used:0.1f}GiB"; + on-click = "hyprctl dispatch exec '[float; size 75%]' kitty btop"; + }; + "disk" = { + states = { + critical = 85; + }; + interval = 5; + format = " {used}"; + on-click = "hyprctl dispatch exec '[float; size 75%]' kitty btop"; + on-click-right = "kitty sh -c 'sudo nix-collect-garbage -d; nix-collect-garbage -d; read'"; + }; + "network" = { + interval = 1; + format-ethernet = " {ifname}"; + format-wifi = " {signalStrength}%"; + format-disconnected = ""; + format-disabled = ""; + tooltip = false; + on-click = "nm-connection-editor"; + on-click-middle = "kitty sh -c 'ping 1.1 -c 3 && ping google.com -c 3; read'"; + on-click-right = "pkexec systemctl restart systemd-resolved NetworkManager tailscaled cloudflare-warp && notify-send ${hostname} 'Network Restarted'"; + }; + "temperature" = { + hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input"; + critical-threshold = 80; + format = " {temperatureC}°C"; + interval = 1; + on-click = "hyprctl dispatch exec '[float; size 75%]' kitty btop"; + }; + "power-profiles-daemon" = { + format = "{icon} {profile}"; + format-icons = { + performance = ""; + power-saver = ""; + balanced = ""; + }; + }; + "hyprland/workspaces" = { + format = "{name}"; + format-icons = { + default = " "; + active = " "; + urgent = " "; + }; + on-scroll-down = "hyprctl dispatch workspace e+1"; + on-scroll-up = "hyprctl dispatch workspace e-1"; + }; + "custom/dunst" = { + format = "{}"; + exec = "echo \"$([ $(dunstctl is-paused) = 'false' ] && echo '' || echo '') $(dunstctl count history)\""; + on-click = "dunstctl set-paused toggle"; + on-click-right = "dunstctl history-clear"; + on-scroll-up = "dunstctl history-pop"; + on-scroll-down = "dunstctl close"; + interval = 1; + }; + "mpris" = { + intelval = 1; + format = " {title} - {artist}"; + max-length = 25; + format-paused = " {title} - {artist}"; + on-click-middle = "playerctl play-pause"; + on-click-right = "playerctl next"; + on-click = "playerctl previous"; + }; + "hyprland/window" = { + icon = true; + max-length = 35; + separate-outputs = false; + rewrite = { + "" = "${username}@${hostname}"; + "~" = "${username}@${hostname}"; + "btop" = "${username}@${hostname}"; + }; + on-click-right = "hyprctl dispatch fullscreen 0"; + on-click-middle = "hyprctl dispatch killactive"; + on-click = "hyprctl dispatch fullscreen 1"; + on-scroll-up = "hyprctl dispatch cyclenext"; + on-scroll-down = "hyprctl dispatch cyclenext prev"; + }; + "hyprland/submap" = { + format = " {}"; + on-click = "hyprctl dispatch submap reset"; + }; + "clock" = { + format = "{:%b %d, %I:%M:%S %p}"; + interval = 1; + on-click = "pkexec systemctl restart tzupdate && notify-send ${hostname} 'Timezone Updated'"; + }; + "tray" = { + spacing = 12; + }; + "taskbar" = { + icon-size = 10; + icon-theme = "Papirus-Dark"; + on-click = "activate"; + on-click-right = "fullscreen"; + on-click-middle = "close"; + on-scroll-up = "maximize"; + on-scroll-down = "minimize"; + }; + "pulseaudio" = { + format = " {volume}%{format_source}"; + format-muted = " {volume}%{format_source_muted}"; + format-source = ""; + format-source-muted = " "; + on-click = "pavucontrol"; + on-click-middle = "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; + on-click-right = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; + }; + "battery" = { + states = { + warning = 30; + critical = 15; + }; + format = "{icon} {capacity}% {power}W"; + format-charging = " {capacity}%"; + format-plugged = " {capacity}%"; + format-icons = [ + "" + "" + "" + "" + "" + ]; + interval = 1; + on-click = "pkexec systemctl restart auto-cpufreq"; + }; + "custom/start" = { + format = ""; + on-click-middle = "wlogout"; + on-click-right = "hyprctl dispatch togglespecialworkspace hidden"; + on-click = "rofi -show drun -show-icons -display-drun '' -run-command \"uwsm app -- {cmd}\""; + }; + } + ]; + style = '' + * { + font-size: 12px; + font-family: Font Awesome, ${rice.font}; + font-weight: bold; + color: @text; + transition: none; + transition: all, 0.25s ease-out; + } + + window#waybar, .modules-left, .modules-center, .modules-right { border-radius: ${toString rice.borders.rounded}px; } + .modules-left, .modules-center, .modules-right { padding: 0 5px; } + window#waybar${if rice.bar.fragmented then ":not(.empty):not(.floating)" else ""}, .modules-left, ${if rice.bar.minimal then "" else ".modules-center,"} .modules-right { + background-color: @crust; + border: ${toString rice.borders.size}px solid @surface0; + } + ${if rice.bar.fragmented then " + window#waybar:not(.empty):not(.floating) .modules-right, window#waybar:not(.empty):not(.floating) .modules-center{ + border-left: none; + } + window#waybar:not(.empty):not(.floating) .modules-left, window#waybar:not(.empty):not(.floating) .modules-center { + border-right: none; + } + " else ""} + window#waybar${if rice.bar.fragmented then ":not(.empty):not(.floating)" else ""} .modules-center { + border-radius: 0px; + } + window#waybar${if rice.bar.fragmented then ":not(.empty):not(.floating)" else ""} .modules-left { + border-radius: ${toString rice.borders.rounded}px 0px 0px ${toString rice.borders.rounded}px; + } + window#waybar${if rice.bar.fragmented then ":not(.empty):not(.floating)" else ""} .modules-right { + border-radius: 0px ${toString rice.borders.rounded}px ${toString rice.borders.rounded}px 0px; + } + window#waybar { + background: rgba(0,0,0,0); + border: ${toString rice.borders.size}px solid transparent; + } + + #window, #submap { padding: 0px 5px; } + #submap, #workspaces, #cpu, #memory, #disk, #clock, #window, #tray, #pulseaudio, #battery, #network, #temperature, #power-profiles-daemon, #custom-exit, #custom-start, #custom-dunst, #mpris { padding: 0px 5px; margin: 0px 5px; } + + #workspaces button { + border-radius: 0px; + margin: 0px; + background: none; + border: none; + } + + #workspaces button:hover, #custom-start:hover, #window:hover, #mpris:hover { + border: none; + outline: none; + background: none; + color: @text; + background-size: 300% 300%; + background: @base; + } + + #workspaces button.active, #submap { + background: @surface0; + } + + #custom-start { + padding: 0px 5px; + color: @${ctp-opt.primary}; + font-size: 16px; + font-weight: normal; + } + + .critical, .muted, .performance { color: @red; } + .warning, .urgent, .disabled, .disconnected, .paused { color: @yellow; } + .charging, .plugged, .power-saver { color: @green; } + ''; + }; +} diff --git a/modules/home/rice/wlogout.nix b/modules/home/rice/wlogout.nix new file mode 100644 index 0000000..56da15a --- /dev/null +++ b/modules/home/rice/wlogout.nix @@ -0,0 +1,51 @@ +{ rice, ... }: { + programs.wlogout = { + enable = true; + layout = [ + { + label = "shutdown"; + action = "systemctl poweroff"; + text = "(S)hutdown"; + keybind = "s"; + } + { + label = "reboot"; + action = "systemctl reboot"; + text = "(R)eboot"; + keybind = "r"; + } + { + label = "hibernate"; + action = "systemctl hibernate"; + text = "(H)ibernate"; + keybind = "h"; + } + { + label = "suspend"; + action = "systemctl suspend"; + text = "Sus(p)end"; + keybind = "p"; + } + { + label = "logout"; + action = "uwsm stop"; + text = "L(o)gout"; + keybind = "o"; + } + { + label = "lock"; + action = "loginctl lock-session"; + text = "(L)ock"; + keybind = "l"; + } + ]; + style = '' + button { + border-width: ${toString rice.borders.size}px; + border-radius: ${toString rice.borders.rounded}px; + margin: ${toString rice.gap.inner}px; + font-family: ${rice.font}; + } + ''; + }; +} \ No newline at end of file diff --git a/modules/system/core/shell.nix b/modules/system/core/shell.nix new file mode 100644 index 0000000..b3a4927 --- /dev/null +++ b/modules/system/core/shell.nix @@ -0,0 +1,6 @@ +{ ... }: { + programs = { + nix-ld.enable = true; + zsh.enable = true; + }; +} \ No newline at end of file diff --git a/modules/system/default.nix b/modules/system/default.nix index 67b64ba..2d1474a 100644 --- a/modules/system/default.nix +++ b/modules/system/default.nix @@ -5,9 +5,11 @@ ./core/filesystem.nix ./core/network.nix ./core/kernel.nix + ./core/shell.nix ./core/user.nix ./misc/programs.nix - ./misc/desktop.nix + ./misc/graphics.nix + ./desktop.nix ./base.nix ]; @@ -20,8 +22,4 @@ Defaults passwd_tries = 5 ''; }; - - fonts.packages = with pkgs; [ - corefonts - ]; } diff --git a/modules/system/desktop.nix b/modules/system/desktop.nix new file mode 100644 index 0000000..16f96e1 --- /dev/null +++ b/modules/system/desktop.nix @@ -0,0 +1,42 @@ + +{ pkgs, enable-dm, ... }: { + imports = [ + ./misc/theme.nix + ]; + + programs.hyprland = { + enable = true; + withUWSM = true; + xwayland.enable = true; + package = pkgs.hyprland; # if rice.enable then inputs.hl.packages."${pkgs.system}".hyprland else pkgs.hyprland; + portalPackage = pkgs.xdg-desktop-portal-hyprland; # inputs.hl.packages.${pkgs.system}.xdg-desktop-portal-hyprland; + }; + + xdg.portal = { + enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal-hyprland #inputs.hl.packages.${pkgs.system}.xdg-desktop-portal-hyprland + pkgs.xdg-desktop-portal-gtk + ]; + }; + + services.displayManager.sddm = { + enable = enable-dm; + wayland.enable = true; + package = pkgs.kdePackages.sddm; + extraPackages = with pkgs.kdePackages; [ + qtmultimedia qtsvg + ]; + }; + + environment = { + systemPackages = with pkgs; [ + libsecret libnotify kdePackages.kdeconnect-kde + ]; + sessionVariables = { + XDG_RUNTIME_DIR = "/run/user/$UID"; # https://discourse.nixos.org/t/login-keyring-did-not-get-unlocked-hyprland/40869/10 + WLR_NO_HARDWARE_CURSORS = "1"; + NIXOS_OZONE_WL = "1"; + }; + }; +} diff --git a/modules/system/misc/desktop.nix b/modules/system/misc/graphics.nix similarity index 68% rename from modules/system/misc/desktop.nix rename to modules/system/misc/graphics.nix index abf8d4e..7bd0bdf 100644 --- a/modules/system/misc/desktop.nix +++ b/modules/system/misc/graphics.nix @@ -1,11 +1,10 @@ -{ pkgs, enable-dm, ... }: { +{ pkgs, ... }: { hardware.graphics = { enable = true; extraPackages = [ pkgs.libva-vdpau-driver ]; }; services = { - displayManager.gdm.enable = enable-dm; xserver = { enable = true; xkb = { @@ -25,6 +24,18 @@ blueman.enable = true; pulseaudio.enable = false; }; - + + fonts = { + enableDefaultPackages = true; + packages = with pkgs; [ + nerd-fonts.droid-sans-mono + noto-fonts-cjk-sans + noto-fonts + font-awesome + corefonts + ]; + }; + + programs.xfconf.enable = true; security.rtkit.enable = true; } \ No newline at end of file diff --git a/modules/system/misc/programs.nix b/modules/system/misc/programs.nix index fbe6f80..1680ee3 100644 --- a/modules/system/misc/programs.nix +++ b/modules/system/misc/programs.nix @@ -13,16 +13,11 @@ }; programs = { - gdk-pixbuf.modulePackages = [ pkgs.librsvg ]; - zsh.enable = true; - nix-ld.enable = true; steam.enable = true; + gdk-pixbuf.modulePackages = [ pkgs.librsvg ]; appimage = { enable = true; binfmt = true; }; - kdeconnect = { - enable = true; - }; }; } \ No newline at end of file diff --git a/modules/system/misc/theme.nix b/modules/system/misc/theme.nix new file mode 100644 index 0000000..e0754ff --- /dev/null +++ b/modules/system/misc/theme.nix @@ -0,0 +1,13 @@ +{ ctp-opt, ... }: { + qt = { + enable = true; + platformTheme = "gnome"; + style = "adwaita-dark"; + }; + + catppuccin = { + enable = true; + flavor = ctp-opt.flavor; + accent = ctp-opt.accent; + }; +} \ No newline at end of file