From bb2fe560820de4c21cd7923bb9d70df647f18f71 Mon Sep 17 00:00:00 2001 From: gwg313 Date: Thu, 3 Jul 2025 10:34:00 -0400 Subject: [PATCH] style Signed-off-by: gwg313 --- common/networking/hosts.nix | 3 + common/nixos/restic.nix | 2 +- common/style/vars/candlekeep.nix | 18 -- common/style/vars/grymforge.nix | 18 -- common/style/vars/vars.nix | 97 ++++++ home-manager/machines/candlekeep.nix | 50 +-- home-manager/machines/grymforge.nix | 48 +-- home-manager/modules/common-gui.nix | 1 - home-manager/modules/common.nix | 2 + home-manager/modules/fzf.nix | 6 +- home-manager/modules/gammastep.nix | 12 + home-manager/modules/hypridle.nix | 28 -- home-manager/modules/hyprland.nix | 206 ------------ home-manager/modules/hyprland/animations.nix | 2 +- home-manager/modules/hyprland/default.nix | 93 ++++-- home-manager/modules/hyprland/hypridle.nix | 9 +- home-manager/modules/hyprland/hyprland.nix | 200 ------------ home-manager/modules/hyprland/hyprlock.nix | 14 +- home-manager/modules/hyprland/hyprpanel.nix | 314 ++++++++++--------- home-manager/modules/hyprlock.nix | 89 ------ home-manager/modules/hyprpanel.nix | 186 ----------- home-manager/modules/hyprspace.nix | 20 -- home-manager/modules/mime.nix | 6 +- home-manager/modules/xdg.nix | 13 - hosts/grymforge/configuration.nix | 2 + hosts/grymforge/sleep.nix | 34 ++ hosts/panopticon/configuration.nix | 2 + hosts/panopticon/grafana.nix | 21 +- hosts/panopticon/loki-config.yaml | 30 ++ hosts/panopticon/loki.nix | 51 +-- hosts/panopticon/promtail.nix | 4 + hosts/panopticon/routes.nix | 36 +++ hosts/panopticon/services.nix | 27 ++ hosts/panopticon/traefik.nix | 33 +- hosts/panopticon/uptime-kuma.nix | 9 + hosts/seikan/routes.nix | 14 + hosts/waypoint/routes.nix | 8 + hosts/waypoint/routes_zerotier.nix | 8 + hosts/waypoint/services.nix | 8 +- secrets/secrets.yaml | 15 +- 40 files changed, 595 insertions(+), 1144 deletions(-) delete mode 100644 common/style/vars/candlekeep.nix delete mode 100644 common/style/vars/grymforge.nix create mode 100644 common/style/vars/vars.nix create mode 100644 home-manager/modules/gammastep.nix delete mode 100644 home-manager/modules/hypridle.nix delete mode 100644 home-manager/modules/hyprland.nix delete mode 100644 home-manager/modules/hyprland/hyprland.nix delete mode 100644 home-manager/modules/hyprlock.nix delete mode 100644 home-manager/modules/hyprpanel.nix delete mode 100644 home-manager/modules/hyprspace.nix delete mode 100644 home-manager/modules/xdg.nix create mode 100644 hosts/grymforge/sleep.nix create mode 100644 hosts/panopticon/loki-config.yaml create mode 100644 hosts/panopticon/routes.nix create mode 100644 hosts/panopticon/services.nix create mode 100644 hosts/panopticon/uptime-kuma.nix diff --git a/common/networking/hosts.nix b/common/networking/hosts.nix index 9f60001..54126d5 100644 --- a/common/networking/hosts.nix +++ b/common/networking/hosts.nix @@ -12,6 +12,7 @@ _: { 10.147.17.246 s3-console.zerotier.gwg313.xyz 10.147.17.246 registry.zerotier.gwg313.xyz 10.147.17.246 ci.zerotier.gwg313.xyz + 10.147.17.246 uptime.zerotier.gwg313.xyz @@ -22,5 +23,7 @@ _: { 10.1.10.50 s3.gwg313.xyz 10.1.10.50 s3-console.gwg313.xyz 10.1.10.50 pastebin.gwg313.xyz + 10.1.10.50 audiobooks.gwg313.xyz + 10.1.10.9 uptime.gwg313.xyz ''; } diff --git a/common/nixos/restic.nix b/common/nixos/restic.nix index 995ac2d..cb89774 100644 --- a/common/nixos/restic.nix +++ b/common/nixos/restic.nix @@ -27,7 +27,7 @@ ]; # extraBackupArgs = [ "--exclude-file=/home/gwg313/Documents/Celsus" ]; timerConfig = { - OnCalendar = "23:00"; + OnCalendar = "06:40"; }; }; }; diff --git a/common/style/vars/candlekeep.nix b/common/style/vars/candlekeep.nix deleted file mode 100644 index 792a435..0000000 --- a/common/style/vars/candlekeep.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - rounding = 0; - gaps-in = 5; - gaps-out = 10; - active-opacity = 1; - inactive-opacity = 1; - blur = false; - border-size = 3; - animation-speed = "medium"; # "fast" | "medium" | "slow" - fetch = "fastfetch"; # "nerdfetch" | "neofetch" | "pfetch" | "none" - - bar = { - position = "top"; # "top" | "bottom" - transparent = true; - transparentButtons = false; - floating = true; - }; -} diff --git a/common/style/vars/grymforge.nix b/common/style/vars/grymforge.nix deleted file mode 100644 index e8f7191..0000000 --- a/common/style/vars/grymforge.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - rounding = 0; - gaps-in = 5; - gaps-out = 10; - active-opacity = 1; - inactive-opacity = 1; - blur = false; - border-size = 4; - animation-speed = "slow"; # "fast" | "medium" | "slow" - fetch = "fastfetch"; # "nerdfetch" | "neofetch" | "pfetch" | "none" - - bar = { - position = "top"; # "top" | "bottom" - transparent = true; - transparentButtons = false; - floating = true; - }; -} diff --git a/common/style/vars/vars.nix b/common/style/vars/vars.nix new file mode 100644 index 0000000..d059ef8 --- /dev/null +++ b/common/style/vars/vars.nix @@ -0,0 +1,97 @@ +{ + lib, + pkgs, + config, + ... +}: +{ + options.theme = lib.mkOption { + type = lib.types.attrs; + default = { + rounding = 20; + gaps-in = 10; + gaps-out = 10 * 2; + active-opacity = 0.96; + inactive-opacity = 0.92; + blur = true; + border-size = 3; + animation-speed = "fast"; # "fast" | "medium" | "slow" + fetch = "none"; # "nerdfetch" | "neofetch" | "pfetch" | "none" + textColorOnWallpaper = config.lib.stylix.colors.base01; # Color of the text displayed on the wallpaper (Lockscreen, display manager, ...) + + bar = { + # Hyprpanel + position = "top"; # "top" | "bottom" + transparent = true; + transparentButtons = false; + floating = true; + }; + }; + description = "Theme configuration options"; + }; + + config.stylix = { + enable = true; + + # See https://tinted-theming.github.io/tinted-gallery/ for more schemes + base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-latte.yaml"; + # base16Scheme = { + # base00 = "09090B"; # Default Background + # base01 = "1c1e1f"; # Lighter Background (Used for status bars, line number and folding marks) + # base02 = "313244"; # Selection Background + # base03 = "45475a"; # Comments, Invisibles, Line Highlighting + # base04 = "585b70"; # Dark Foreground (Used for status bars) + # base05 = "cdd6f4"; # Default Foreground, Caret, Delimiters, Operators + # base06 = "f5e0dc"; # Light Foreground (Not often used) + # base07 = "b4befe"; # Light Background (Not often used) + # base08 = "f38ba8"; # Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted + # base09 = "fab387"; # Integers, Boolean, Constants, XML Attributes, Markup Link Url + # base0A = "f9e2af"; # Classes, Markup Bold, Search Text Background + # base0B = "a6e3a1"; # Strings, Inherited Class, Markup Code, Diff Inserted + # base0C = "94e2d5"; # Support, Regular Expressions, Escape Characters, Markup Quotes + # base0D = "c5afd4"; # Functions, Methods, Attribute IDs, Headings, Accent color + # base0E = "cba6f7"; # Keywords, Storage, Selector, Markup Italic, Diff Changed + # base0F = "f2cdcd"; # Deprecated, Opening/Closing Embedded Language Tags, e.g. + # }; + + cursor = { + name = "phinger-cursors-light"; + package = pkgs.phinger-cursors; + size = 20; + }; + + fonts = { + serif = { + package = pkgs.lmodern; + name = "Latin Modern Roman"; + }; + + sansSerif = { + package = pkgs.inter; + name = "Inter"; + }; + + monospace = { + package = pkgs.fira-code; + name = "Fire Code"; + }; + + emoji = { + package = pkgs.noto-fonts-emoji; + name = "Noto Color Emoji"; + }; + sizes = { + applications = 13; + desktop = 13; + popups = 13; + terminal = 13; + }; + }; + + polarity = "light"; + image = pkgs.fetchurl { + url = "https://raw.githubusercontent.com/anotherhadi/awesome-wallpapers/refs/heads/main/app/static/wallpapers/black-and-white-forest_minimalist_black-and-white.png"; + sha256 = "sha256-MOlLRQonZ6UAaSJlysjL8snxnMrSFH9VOLrjXaU82Kw="; + }; + }; +} diff --git a/home-manager/machines/candlekeep.nix b/home-manager/machines/candlekeep.nix index 8bd4b4b..6c9d961 100644 --- a/home-manager/machines/candlekeep.nix +++ b/home-manager/machines/candlekeep.nix @@ -24,7 +24,7 @@ ./candlekeep/variables.nix # ./nvim.nix ../modules/common.nix - # ../modules/hyprland.nix + ../../common/style/vars/vars.nix ../modules/hyprland ../modules/common-gui.nix ../modules/linux-gui.nix @@ -60,7 +60,6 @@ # patches = [ ./change-hello-to-hi.patch ]; # }); # }) - inputs.hyprpanel.overlay ]; # Configure your nixpkgs instance config = { @@ -76,53 +75,6 @@ homeDirectory = "/home/gwg313"; }; - stylix = { - fonts = { - sizes = { - applications = 13; # UI font (GTK/Qt) - terminal = 14; # Comfortable for reading code/math - desktop = 13; # WM, notifications - popups = 12; # Tooltips, menus - }; - }; - # base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-macchiato.yaml"; - base16Scheme = "${pkgs.base16-schemes}/share/themes/atelier-sulphurpool-light.yaml"; - image = ../../wallpapers/floating_city.jpg; - # polarity = "dark"; - autoEnable = true; - enable = true; - targets.nixvim.enable = false; - - opacity.terminal = 1.0; - - fonts = { - serif = { - package = pkgs.lmodern; - name = "Latin Modern Roman"; - }; - - sansSerif = { - package = pkgs.inter; - name = "Inter"; - }; - - monospace = { - package = pkgs.fira-code; - name = "Fire Code"; - }; - - emoji = { - package = pkgs.noto-fonts-emoji; - name = "Noto Color Emoji"; - }; - }; - cursor = { - package = pkgs.vanilla-dmz; - name = "Vanilla-DMZ"; - size = 24; - }; - }; - gtk = { enable = true; iconTheme = { diff --git a/home-manager/machines/grymforge.nix b/home-manager/machines/grymforge.nix index d63537b..04d966a 100644 --- a/home-manager/machines/grymforge.nix +++ b/home-manager/machines/grymforge.nix @@ -37,6 +37,7 @@ ../modules/yazi.nix ../modules/qutebrowser.nix ../scripts/default.nix + ../../common/style/vars/vars.nix ]; nixpkgs = { @@ -74,53 +75,6 @@ homeDirectory = "/home/gwg313"; }; - stylix = { - fonts = { - sizes = { - applications = 13; # UI font (GTK/Qt) - terminal = 14; # Comfortable for reading code/math - desktop = 13; # WM, notifications - popups = 12; # Tooltips, menus - }; - }; - base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-latte.yaml"; - # base16Scheme = "${pkgs.base16-schemes}/share/themes/atelier-sulphurpool-light.yaml"; - image = ../../wallpapers/nixos-wallpaper-catppuccin-latte.png; - # polarity = "dark"; - autoEnable = true; - enable = true; - targets.nixvim.enable = false; - - opacity.terminal = 1.0; - - fonts = { - serif = { - package = pkgs.lmodern; - name = "Latin Modern Roman"; - }; - - sansSerif = { - package = pkgs.inter; - name = "Inter"; - }; - - monospace = { - package = pkgs.fira-code; - name = "Fire Code"; - }; - - emoji = { - package = pkgs.noto-fonts-emoji; - name = "Noto Color Emoji"; - }; - }; - cursor = { - package = pkgs.vanilla-dmz; - name = "Vanilla-DMZ"; - size = 24; - }; - }; - gtk = { enable = true; iconTheme = { diff --git a/home-manager/modules/common-gui.nix b/home-manager/modules/common-gui.nix index 6d82b58..5d15883 100644 --- a/home-manager/modules/common-gui.nix +++ b/home-manager/modules/common-gui.nix @@ -8,7 +8,6 @@ ./obs.nix ./thunar.nix ./zen.nix - ./xdg.nix ./mime.nix ./nixcord.nix ]; diff --git a/home-manager/modules/common.nix b/home-manager/modules/common.nix index 368d3d9..69bffda 100644 --- a/home-manager/modules/common.nix +++ b/home-manager/modules/common.nix @@ -27,6 +27,8 @@ with pkgs; [ ncdu + minio-client + # Editors # neovim # Improved version of vim, often used with overlays. # vim # Highly configurable text editor popular for efficiency and extensibility. diff --git a/home-manager/modules/fzf.nix b/home-manager/modules/fzf.nix index dea844c..41568ba 100644 --- a/home-manager/modules/fzf.nix +++ b/home-manager/modules/fzf.nix @@ -1,5 +1,9 @@ # Fzf is a general-purpose command-line fuzzy finder. -{ config, lib, ... }: +{ + config, + lib, + ... +}: let accent = "#" + config.lib.stylix.colors.base0D; foreground = "#" + config.lib.stylix.colors.base05; diff --git a/home-manager/modules/gammastep.nix b/home-manager/modules/gammastep.nix new file mode 100644 index 0000000..1256e14 --- /dev/null +++ b/home-manager/modules/gammastep.nix @@ -0,0 +1,12 @@ +{ + services.gammastep = { + enable = true; + latitude = 45.4; + longitude = -75.7; + temperature = { + day = 6500; + night = 3500; + }; + tray = true; + }; +} diff --git a/home-manager/modules/hypridle.nix b/home-manager/modules/hypridle.nix deleted file mode 100644 index f7e4bf6..0000000 --- a/home-manager/modules/hypridle.nix +++ /dev/null @@ -1,28 +0,0 @@ -# Hypridle is a daemon that listens for user activity and runs commands when the user is idle. -{ pkgs, ... }: -{ - services.hypridle = { - enable = true; - settings = { - - general = { - ignore_dbus_inhibit = false; - lock_cmd = "pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock"; - before_sleep_cmd = "loginctl lock-session"; - after_sleep_cmd = "hyprctl dispatch dpms on"; - }; - - listener = [ - { - timeout = 600; - on-timeout = "pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock"; - } - - { - timeout = 660; - on-timeout = "systemctl suspend"; - } - ]; - }; - }; -} diff --git a/home-manager/modules/hyprland.nix b/home-manager/modules/hyprland.nix deleted file mode 100644 index afc4eb3..0000000 --- a/home-manager/modules/hyprland.nix +++ /dev/null @@ -1,206 +0,0 @@ -{ - config, - pkgs, - ... -}: -{ - imports = [ ./waybar.nix ]; - - # services.mako = { - # enable = true; - # defaultTimeout = 4000; - # borderRadius = 5; - # borderSize = 2; - # layer = "overlay"; - # }; - - wayland.windowManager.hyprland.enable = true; - - wayland.windowManager.hyprland.settings = { - xwayland.force_zero_scaling = true; - - input = { - sensitivity = 0.4; - # todo custom - accel_profile = "adaptive"; - # accel_profile = "custom 20000 0.755 0.05 0.855 0.06"; - touchpad = { - natural_scroll = true; - scroll_factor = 0.38; - clickfinger_behavior = true; - }; - }; - - general = { - gaps_in = 5; - gaps_out = 16; - resize_on_border = true; - hover_icon_on_border = false; - layout = "dwindle"; - }; - - master = { - # new_is_master = false; - smart_resizing = false; - }; - - dwindle = { - force_split = 2; - preserve_split = true; - }; - - decoration = { - rounding = 5; - active_opacity = 0.93; - inactive_opacity = 0.93; - fullscreen_opacity = 1; - # drop_shadow = false; - }; - animations = { - enabled = true; - bezier = [ - "myBezier, 0.22, 1, 0.36, 1" - "snap, 0, 1, 0, 1" - ]; - - animation = [ - "windows, 1, 7, myBezier" - "windowsOut, 1, 3, default, popin 60%" - "border, 1, 0.5, snap" - "borderangle, 1, 0.5, snap" - "fade, 1, 0.001, myBezier" - "workspaces, 1, 0.8, myBezier, fade" - ]; - }; - - # https://wiki.hyprland.org/Configuring/Variables/#gestures - gestures = { - workspace_swipe = true; - workspace_swipe_fingers = 3; - workspace_swipe_cancel_ratio = 0.6; - workspace_swipe_min_speed_to_force = 30; - workspace_swipe_distance = 2000; - workspace_swipe_invert = true; - }; - - misc = { - disable_hyprland_logo = true; - disable_splash_rendering = true; - force_default_wallpaper = 0; - mouse_move_enables_dpms = true; - key_press_enables_dpms = true; - }; - - "$mod" = "SUPER"; - - bind = [ - # general binds - ",switch:Lid Switch, exec, ${pkgs.hyprlock}/bin/hyprlock" # Lock when closing Lid - # "$mod, RETURN, exec, ${pkgs.alacritty}/bin/alacritty" - "$mod, RETURN, exec, ${pkgs.ghostty}/bin/ghostty" - "$shiftMod,SPACE, exec, hyprfocus-toggle" # Toggle HyprFocus - "$mod, Q, killactive" - "SUPER_SHIFT, Q, exec, ${pkgs.wlogout}/bin/wlogout" - "$mod, SPACE, exec, pkill fuzzel || ${pkgs.fuzzel}/bin/fuzzel" # pkill or allows for toggle - "SUPER_SHIFT, SPACE, togglefloating" - "$mod, F, fullscreen" - # "$mod,F, exec, hyprfocus-toggle" # Toggle HyprFocus - "$mod, L, exec, ${pkgs.hyprlock}/bin/hyprlock" - "$mod, B, exec, ${pkgs.grim}/bin/grim \"desktop-$(${pkgs.busybox}/bin/date +\"%Y%m%d%H%m\").png" - "SUPER_SHIFT, B, exec, ${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp -d)\" - | ${pkgs.wl-clipboard}/bin/wl-copy" # Screenshot selection directly to clipboard - - # Volume - ",XF86AudioRaiseVolume, exec, ${pkgs.ponymix}/bin/ponymix inc 2" - ",XF86AudioLowerVolume, exec, ${pkgs.ponymix}/bin/ponymix dec 2" - ",XF86AudioMute, exec, ${pkgs.ponymix}/bin/ponymix, toggle" - - # Screen Brightness - #",XF86MonBrightnessUp, exec, ${pkgs.light}/bin/light -A 10" - #",XF86MonBrightnessDown, exec, ${pkgs.light}/bin/light -U 10" - # ",XF86MonBrightnessUp, exec, ${pkgs.light}/bin/light -S \"$(${pkgs.light}/bin/light -G | ${pkgs.busybox}/bin/awk '{ print int(($1 + .72) * 1.4) }')\"" - # ",XF86MonBrightnessDown, exec, ${pkgs.light}/bin/light -S \"$(${pkgs.light}/bin/light -G | ${pkgs.busybox}/bin/awk '{ print int($1 / 1.4) }')\"" - ",XF86MonBrightnessUp, exec, brightness-up" # Brightness Up - ",XF86MonBrightnessDown, exec, brightness-down" # Brightness Down - # move focus - "$mod, left, movefocus, l" - "$mod, right, movefocus, r" - "$mod, up, movefocus, u" - "$mod, down, movefocus, d" - "$mod,right,workspace,+1" - "$mod,left,workspace,-1" - - # workspace switching - "$mod, 1, workspace, 1" - "$mod, 2, workspace, 2" - "$mod, 3, workspace, 3" - "$mod, 4, workspace, 4" - "$mod, 5, workspace, 5" - "$mod, 6, workspace, 6" - "$mod, 7, workspace, 7" - "$mod, 8, workspace, 8" - "$mod, 9, workspace, 9" - "$mod, 0, workspace, 10" - - # move window to workspace - "$mod SHIFT, 1, movetoworkspace, 1" - "$mod SHIFT, 2, movetoworkspace, 2" - "$mod SHIFT, 3, movetoworkspace, 3" - "$mod SHIFT, 4, movetoworkspace, 4" - "$mod SHIFT, 5, movetoworkspace, 5" - "$mod SHIFT, 6, movetoworkspace, 6" - "$mod SHIFT, 7, movetoworkspace, 7" - "$mod SHIFT, 8, movetoworkspace, 8" - "$mod SHIFT, 9, movetoworkspace, 9" - "$mod SHIFT, 0, movetoworkspace, 10" - - # Scroll through workspaces - "$mod, mouse_down, workspace, e+1" - "$mod, mouse_up, workspace, e-1" - ]; - - bindm = [ - # mouse movements - "$mod, mouse:272, movewindow" - "$mod_ALT, mouse:273, resizewindow" - "$mod_ALT, mouse:272, resizewindow" - ]; - - monitor = [ - # "eDP-1,highres,0x0,1" - # "DP-1,preferred,0x0,1" - # "HDMI-A-1,2560x0,auto,1" - ",preferred,auto,1" - ]; - # monitor = [ "DP-1,preferred,0x0,1" ]; - # monitor = [ "HDMI-A-1,2560x0,auto,1" ]; - - # monitor = [ "HDMI-A-1,1920x1080@144,auto,1" ]; - exec = [ "${pkgs.swaybg}/bin/swaybg -i ${config.stylix.image} -m fill" ]; - exec-once = [ - # Enables clipboard sync - "${pkgs.wl-clipboard}/bin/wl-paste -p | ${pkgs.wl-clipboard}/bin/wl-copy" - "${pkgs.wl-clipboard}/bin/wl-paste | ${pkgs.wl-clipboard}/bin/wl-copy -p" - ]; - }; - - wayland.windowManager.hyprland.extraConfig = '' - # will switch to a submap called resize - bind=$mod,R,submap,resize - - # will start a submap called "resize" - submap=resize - - # sets repeatable binds for resizing the active window - binde=,right,resizeactive,10 0 - binde=,left,resizeactive,-10 0 - binde=,up,resizeactive,0 -10 - binde=,down,resizeactive,0 10 - - # use reset to go back to the global submap - bind=,escape,submap,reset - - # will reset the submap, meaning end the current one and return to the global one - submap=reset - ''; - -} diff --git a/home-manager/modules/hyprland/animations.nix b/home-manager/modules/hyprland/animations.nix index 0ec3a3c..ec0c90e 100644 --- a/home-manager/modules/hyprland/animations.nix +++ b/home-manager/modules/hyprland/animations.nix @@ -1,6 +1,6 @@ { config, ... }: let - animationSpeed = config.var.theme.animation-speed; + animationSpeed = config.theme.animation-speed; animationDuration = if animationSpeed == "slow" then diff --git a/home-manager/modules/hyprland/default.nix b/home-manager/modules/hyprland/default.nix index 04f7bd6..26d34b7 100644 --- a/home-manager/modules/hyprland/default.nix +++ b/home-manager/modules/hyprland/default.nix @@ -1,29 +1,31 @@ +# So best window tiling manager { pkgs, config, inputs, + lib, ... }: let - border-size = config.var.theme.border-size; - gaps-in = config.var.theme.gaps-in; - gaps-out = config.var.theme.gaps-out; - active-opacity = config.var.theme.active-opacity; - inactive-opacity = config.var.theme.inactive-opacity; - rounding = config.var.theme.rounding; - blur = config.var.theme.blur; + border-size = config.theme.border-size; + gaps-in = config.theme.gaps-in; + gaps-out = config.theme.gaps-out; + active-opacity = config.theme.active-opacity; + inactive-opacity = config.theme.inactive-opacity; + rounding = config.theme.rounding; + blur = config.theme.blur; keyboardLayout = config.var.keyboardLayout; + background = "rgb(" + config.lib.stylix.colors.base00 + ")"; in { - imports = [ ./animations.nix ./bindings.nix ./polkitagent.nix - ./hyprlock.nix - ./hypridle.nix + ./hyprspace.nix ./hyprpanel.nix - # ./hyprspace.nix + ./hyprlock.nix + ../gammastep.nix ]; home.packages = with pkgs; [ @@ -52,21 +54,32 @@ in wayland.windowManager.hyprland = { enable = true; xwayland.enable = true; - systemd.enable = true; - package = inputs.hyprland.packages."${pkgs.system}".hyprland; + systemd = { + enable = false; + variables = [ + "--all" + ]; # https://wiki.hyprland.org/Nix/Hyprland-on-Home-Manager/#programs-dont-work-in-systemd-services-but-do-on-the-terminal + }; + package = null; + portalPackage = null; settings = { "$mod" = "SUPER"; "$shiftMod" = "SUPER_SHIFT"; + exec-once = [ + "dbus-update-activation-environment --systemd --all &" + "systemctl --user enable --now hyprpaper.service &" + "systemctl --user enable --now hypridle.service &" + "systemctl --user enable --now nextcloud-client.service &" + ]; + monitor = [ - "DP-1,2560x2880,0x0, 1" - "HDMI-A-1,3840x2160, 2560x0, 1" - ",prefered,auto,1" + "eDP-2,highres,0x0,1" # My internal laptop screen + ",prefered,auto,1" # default ]; env = [ - "XDG_SESSION_TYPE,wayland" "XDG_CURRENT_DESKTOP,Hyprland" "MOZ_ENABLE_WAYLAND,1" "ANKI_WAYLAND,1" @@ -78,7 +91,6 @@ in "QT_QPA_PLATFORM=wayland,xcb" "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" "ELECTRON_OZONE_PLATFORM_HINT,auto" - # "GTK_THEME,FlatColor:dark" "__GL_GSYNC_ALLOWED,0" "__GL_VRR_ALLOWED,0" "DISABLE_QT5_COMPAT,0" @@ -87,10 +99,8 @@ in "WLR_BACKEND,vulkan" "WLR_RENDERER,vulkan" "WLR_NO_HARDWARE_CURSORS,1" - "XDG_SESSION_TYPE,wayland" "SDL_VIDEODRIVER,wayland" "CLUTTER_BACKEND,wayland" - "AQ_DRM_DEVICES,/dev/dri/card2:/dev/dri/card1" # CHANGEME: Related to the GPU ]; cursor = { @@ -103,9 +113,8 @@ in gaps_in = gaps-in; gaps_out = gaps-out; border_size = border-size; - # border_part_of_window = true; - # layout = "master"; - layout = "dwindle"; + layout = "master"; + "col.inactive_border" = lib.mkForce background; }; decoration = { @@ -119,6 +128,7 @@ in }; blur = { enabled = if blur then "true" else "false"; + size = 18; }; }; @@ -128,11 +138,6 @@ in mfact = 0.5; }; - dwindle = { - force_split = 2; - preserve_split = true; - }; - gestures = { workspace_swipe = true; }; @@ -144,13 +149,40 @@ in disable_autoreload = true; focus_on_activate = true; new_window_takes_over_fullscreen = 2; - middle_click_paste = false; }; windowrulev2 = [ "float, tag:modal" "pin, tag:modal" "center, tag:modal" + # telegram media viewer + "float, title:^(Media viewer)$" + + # Bitwarden extension + "float, title:^(.*Bitwarden Password Manager.*)$" + + # gnome calculator + "float, class:^(org.gnome.Calculator)$" + "size 360 490, class:^(org.gnome.Calculator)$" + + # make Firefox/Zen PiP window floating and sticky + "float, title:^(Picture-in-Picture)$" + "pin, title:^(Picture-in-Picture)$" + + # idle inhibit while watching videos + "idleinhibit focus, class:^(mpv|.+exe|celluloid)$" + "idleinhibit focus, class:^(zen)$, title:^(.*YouTube.*)$" + "idleinhibit fullscreen, class:^(zen)$" + + "dimaround, class:^(gcr-prompter)$" + "dimaround, class:^(xdg-desktop-portal-gtk)$" + "dimaround, class:^(polkit-gnome-authentication-agent-1)$" + "dimaround, class:^(zen)$, title:^(File Upload)$" + + # fix xwayland apps + "rounding 0, xwayland:1" + "center, class:^(.*jetbrains.*)$, title:^(Confirm Exit|Open Project|win424|win201|splash)$" + "size 640 400, class:^(.*jetbrains.*)$, title:^(splash)$" ]; layerrule = [ @@ -161,7 +193,6 @@ in input = { # kb_layout = keyboardLayout; - # kb_options = "caps:escape"; follow_mouse = 1; sensitivity = 0.5; repeat_delay = 300; @@ -173,8 +204,6 @@ in clickfinger_behavior = true; }; }; - }; }; - systemd.user.targets.hyprland-session.Unit.Wants = [ "xdg-desktop-autostart.target" ]; } diff --git a/home-manager/modules/hyprland/hypridle.nix b/home-manager/modules/hyprland/hypridle.nix index f7e4bf6..7023b31 100644 --- a/home-manager/modules/hyprland/hypridle.nix +++ b/home-manager/modules/hyprland/hypridle.nix @@ -4,7 +4,6 @@ services.hypridle = { enable = true; settings = { - general = { ignore_dbus_inhibit = false; lock_cmd = "pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock"; @@ -18,10 +17,10 @@ on-timeout = "pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock"; } - { - timeout = 660; - on-timeout = "systemctl suspend"; - } + # { + # timeout = 660; + # on-timeout = "systemctl suspend"; + # } ]; }; }; diff --git a/home-manager/modules/hyprland/hyprland.nix b/home-manager/modules/hyprland/hyprland.nix deleted file mode 100644 index 66813a2..0000000 --- a/home-manager/modules/hyprland/hyprland.nix +++ /dev/null @@ -1,200 +0,0 @@ -{ - config, - pkgs, - ... -}: -{ - imports = [ ./waybar.nix ]; - - # services.mako = { - # enable = true; - # defaultTimeout = 4000; - # borderRadius = 5; - # borderSize = 2; - # layer = "overlay"; - # }; - - wayland.windowManager.hyprland.enable = true; - - wayland.windowManager.hyprland.settings = { - xwayland.force_zero_scaling = true; - - input = { - sensitivity = 0.4; - # todo custom - accel_profile = "adaptive"; - # accel_profile = "custom 20000 0.755 0.05 0.855 0.06"; - touchpad = { - natural_scroll = true; - scroll_factor = 0.38; - tap-and-drag = true; - middle_button_emulation = true; - tap-to-click = true; - }; - }; - - general = { - gaps_in = 5; - gaps_out = 16; - resize_on_border = true; - hover_icon_on_border = false; - layout = "dwindle"; - }; - - master = { - # new_is_master = false; - smart_resizing = false; - }; - - dwindle = { - force_split = 2; - preserve_split = true; - }; - - decoration = { - rounding = 5; - active_opacity = 0.93; - inactive_opacity = 0.93; - fullscreen_opacity = 1; - # drop_shadow = false; - }; - animations = { - enabled = true; - bezier = [ - "myBezier, 0.22, 1, 0.36, 1" - "snap, 0, 1, 0, 1" - ]; - - animation = [ - "windows, 1, 7, myBezier" - "windowsOut, 1, 3, default, popin 60%" - "border, 1, 0.5, snap" - "borderangle, 1, 0.5, snap" - "fade, 1, 0.001, myBezier" - "workspaces, 1, 0.8, myBezier, fade" - ]; - }; - - # https://wiki.hyprland.org/Configuring/Variables/#gestures - gestures = { - workspace_swipe = true; - workspace_swipe_fingers = 3; - workspace_swipe_cancel_ratio = 0.6; - workspace_swipe_min_speed_to_force = 30; - workspace_swipe_distance = 2000; - workspace_swipe_invert = true; - }; - - misc = { - disable_hyprland_logo = true; - disable_splash_rendering = true; - force_default_wallpaper = 0; - mouse_move_enables_dpms = true; - key_press_enables_dpms = true; - }; - - "$mod" = "SUPER"; - - bind = [ - # general binds - ",switch:Lid Switch, exec, ${pkgs.hyprlock}/bin/hyprlock" # Lock when closing Lid - # "$mod, RETURN, exec, ${pkgs.alacritty}/bin/alacritty" - "$mod, RETURN, exec, ${pkgs.kitty}/bin/kitty" - "$shiftMod,SPACE, exec, hyprfocus-toggle" # Toggle HyprFocus - "$mod, Q, killactive" - "SUPER_SHIFT, Q, exec, ${pkgs.wlogout}/bin/wlogout" - "$mod, SPACE, exec, pkill fuzzel || ${pkgs.fuzzel}/bin/fuzzel" # pkill or allows for toggle - "SUPER_SHIFT, SPACE, togglefloating" - # "$mod, F, fullscreen" - "$mod,F, exec, fullscreen" - "$mod, L, exec, ${pkgs.hyprlock}/bin/hyprlock" - "$mod, B, exec, ${pkgs.grim}/bin/grim \"desktop-$(${pkgs.busybox}/bin/date +\"%Y%m%d%H%m\").png" - "SUPER_SHIFT, B, exec, ${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp -d)\" - | ${pkgs.wl-clipboard}/bin/wl-copy" # Screenshot selection directly to clipboard - - # Volume - ",XF86AudioRaiseVolume, exec, ${pkgs.ponymix}/bin/ponymix inc 2" - ",XF86AudioLowerVolume, exec, ${pkgs.ponymix}/bin/ponymix dec 2" - ",XF86AudioMute, exec, ${pkgs.ponymix}/bin/ponymix, toggle" - - # Screen Brightness - #",XF86MonBrightnessUp, exec, ${pkgs.light}/bin/light -A 10" - #",XF86MonBrightnessDown, exec, ${pkgs.light}/bin/light -U 10" - # ",XF86MonBrightnessUp, exec, ${pkgs.light}/bin/light -S \"$(${pkgs.light}/bin/light -G | ${pkgs.busybox}/bin/awk '{ print int(($1 + .72) * 1.4) }')\"" - # ",XF86MonBrightnessDown, exec, ${pkgs.light}/bin/light -S \"$(${pkgs.light}/bin/light -G | ${pkgs.busybox}/bin/awk '{ print int($1 / 1.4) }')\"" - ",XF86MonBrightnessUp, exec, brightness-up" # Brightness Up - ",XF86MonBrightnessDown, exec, brightness-down" # Brightness Down - # move focus - "$mod, left, movefocus, l" - "$mod, right, movefocus, r" - "$mod, up, movefocus, u" - "$mod, down, movefocus, d" - "$mod,right,workspace,+1" - "$mod,left,workspace,-1" - - # workspace switching - "$mod, 1, workspace, 1" - "$mod, 2, workspace, 2" - "$mod, 3, workspace, 3" - "$mod, 4, workspace, 4" - "$mod, 5, workspace, 5" - "$mod, 6, workspace, 6" - "$mod, 7, workspace, 7" - "$mod, 8, workspace, 8" - "$mod, 9, workspace, 9" - "$mod, 0, workspace, 10" - - # move window to workspace - "$mod SHIFT, 1, movetoworkspace, 1" - "$mod SHIFT, 2, movetoworkspace, 2" - "$mod SHIFT, 3, movetoworkspace, 3" - "$mod SHIFT, 4, movetoworkspace, 4" - "$mod SHIFT, 5, movetoworkspace, 5" - "$mod SHIFT, 6, movetoworkspace, 6" - "$mod SHIFT, 7, movetoworkspace, 7" - "$mod SHIFT, 8, movetoworkspace, 8" - "$mod SHIFT, 9, movetoworkspace, 9" - "$mod SHIFT, 0, movetoworkspace, 10" - - # Scroll through workspaces - "$mod, mouse_down, workspace, e+1" - "$mod, mouse_up, workspace, e-1" - ]; - - bindm = [ - # mouse movements - "$mod, mouse:272, movewindow" - "$mod_ALT, mouse:273, resizewindow" - "$mod_ALT, mouse:272, resizewindow" - ]; - - monitor = [ ",preferred,auto,1" ]; - # monitor = [ "HDMI-A-1,1920x1080@144,auto,1" ]; - exec = [ "${pkgs.swaybg}/bin/swaybg -i ${config.stylix.image} -m fill" ]; - exec-once = [ - # Enables clipboard sync - "${pkgs.wl-clipboard}/bin/wl-paste -p | ${pkgs.wl-clipboard}/bin/wl-copy" - "${pkgs.wl-clipboard}/bin/wl-paste | ${pkgs.wl-clipboard}/bin/wl-copy -p" - ]; - }; - - wayland.windowManager.hyprland.extraConfig = '' - # will switch to a submap called resize - bind=$mod,R,submap,resize - - # will start a submap called "resize" - submap=resize - - # sets repeatable binds for resizing the active window - binde=,right,resizeactive,10 0 - binde=,left,resizeactive,-10 0 - binde=,up,resizeactive,0 -10 - binde=,down,resizeactive,0 10 - - # use reset to go back to the global submap - bind=,escape,submap,reset - - # will reset the submap, meaning end the current one and return to the global one - submap=reset - ''; - -} diff --git a/home-manager/modules/hyprland/hyprlock.nix b/home-manager/modules/hyprland/hyprlock.nix index 26d4117..74f8b1c 100644 --- a/home-manager/modules/hyprland/hyprlock.nix +++ b/home-manager/modules/hyprland/hyprlock.nix @@ -1,7 +1,10 @@ -{ config, lib, ... }: +{ + config, + lib, + ... +}: let - foreground = "rgba(216, 222, 233, 0.70)"; - imageStr = toString config.stylix.image; + foreground = "rgba(${config.theme.textColorOnWallpaper}ee)"; font = config.stylix.fonts.serif.name; in { @@ -17,7 +20,6 @@ in # BACKGROUND background = { monitor = ""; - # path = imageStr; blur_passes = 0; contrast = 0.8916; brightness = 0.7172; @@ -73,8 +75,8 @@ in dots_size = 0.2; # Scale of input-field height, 0.2 - 0.8 dots_spacing = 0.2; # Scale of dots' absolute size, 0.0 - 1.0 dots_center = true; - outer_color = "rgba(255, 255, 255, 0)"; - inner_color = "rgba(255, 255, 255, 0.1)"; + outer_color = "rgba(25, 25, 25, 0)"; + inner_color = "rgba(25, 25, 25, 0.1)"; font_color = foreground; fade_on_empty = false; font_family = font + " Bold"; diff --git a/home-manager/modules/hyprland/hyprpanel.nix b/home-manager/modules/hyprland/hyprpanel.nix index f5a8996..1cd1bb1 100644 --- a/home-manager/modules/hyprland/hyprpanel.nix +++ b/home-manager/modules/hyprland/hyprpanel.nix @@ -1,49 +1,51 @@ # Hyprpanel is the bar on top of the screen -# Display informations like workspaces, battery, wifi, ... -{ inputs, config, ... }: +# Display information like workspaces, battery, wifi, ... +{ config, ... }: let - transparentButtons = config.var.theme.bar.transparentButtons; + transparentButtons = config.theme.bar.transparentButtons; accent = "#${config.lib.stylix.colors.base0D}"; accent-alt = "#${config.lib.stylix.colors.base03}"; background = "#${config.lib.stylix.colors.base00}"; background-alt = "#${config.lib.stylix.colors.base01}"; foreground = "#${config.lib.stylix.colors.base05}"; + foregroundOnWallpaper = "#${config.theme.textColorOnWallpaper}"; font = "${config.stylix.fonts.serif.name}"; - fontSize = "${toString config.stylix.fonts.sizes.desktop}"; + fontSizeForHyprpanel = "${toString config.stylix.fonts.sizes.desktop}px"; - rounding = config.var.theme.rounding; - border-size = config.var.theme.border-size; + rounding = config.theme.rounding; + border-size = config.theme.border-size; - gaps-out = config.var.theme.gaps-out; - gaps-in = config.var.theme.gaps-in; + gaps-out = config.theme.gaps-out; + gaps-in = config.theme.gaps-in; - floating = config.var.theme.bar.floating; - transparent = config.var.theme.bar.transparent; - position = config.var.theme.bar.position; + floating = config.theme.bar.floating; + transparent = config.theme.bar.transparent; + position = config.theme.bar.position; # "top" ou "bottom" + + notificationOpacity = 90; location = config.var.location; in { - - imports = [ inputs.hyprpanel.homeManagerModules.hyprpanel ]; + wayland.windowManager.hyprland.settings.exec-once = [ "hyprpanel" ]; programs.hyprpanel = { enable = true; - systemd.enable = true; - hyprland.enable = true; - overwrite.enable = true; - overlay.enable = true; + settings = { layout = { - "bar.layouts" = { - "0" = { + bar.layouts = { + "*" = { "left" = [ "dashboard" "workspaces" "windowtitle" ]; - "middle" = [ "media" ]; + "middle" = [ + "media" + "cava" + ]; "right" = [ "systray" "volume" @@ -56,131 +58,157 @@ in }; }; }; - }; - override = { - "theme.font.name" = "${font}"; - "theme.font.size" = "${fontSize}px"; - "theme.bar.outer_spacing" = "${if floating && transparent then "0" else "8"}px"; - "theme.bar.buttons.y_margins" = "${if floating && transparent then "0" else "8"}px"; - "theme.bar.buttons.spacing" = "0.3em"; - "theme.bar.buttons.radius" = "${ - if transparent then toString rounding else toString (rounding - 8) - }px"; - "theme.bar.floating" = "${if floating then "true" else "false"}"; - "theme.bar.buttons.padding_x" = "0.8rem"; - "theme.bar.buttons.padding_y" = "0.4rem"; - "theme.bar.buttons.workspaces.hover" = "${accent-alt}"; - "theme.bar.buttons.workspaces.active" = "${accent}"; - "theme.bar.buttons.workspaces.available" = "${accent-alt}"; - "theme.bar.buttons.workspaces.occupied" = "${accent-alt}"; - "theme.bar.margin_top" = "${if position == "top" then toString (gaps-in * 2) else "0"}px"; - "theme.bar.margin_bottom" = "${if position == "top" then "0" else toString (gaps-in * 2)}px"; - "theme.bar.margin_sides" = "${toString gaps-out}px"; - "theme.bar.border_radius" = "${toString rounding}px"; - "bar.launcher.icon" = ""; - "theme.bar.transparent" = "${if transparent then "true" else "false"}"; - "bar.workspaces.show_numbered" = false; - "bar.workspaces.workspaces" = 5; - "bar.workspaces.hideUnoccupied" = false; - "bar.windowtitle.label" = true; - "bar.volume.label" = false; - "bar.network.truncation_size" = 12; - "bar.bluetooth.label" = false; - "bar.clock.format" = "%a %b %d %I:%M %p"; - "bar.notifications.show_total" = true; - "theme.notification.border_radius" = "${toString rounding}px"; - "theme.osd.enable" = true; - "theme.osd.orientation" = "vertical"; - "theme.osd.location" = "left"; - "theme.osd.radius" = "${toString rounding}px"; - "theme.osd.margins" = "0px 0px 0px 10px"; - "theme.osd.muted_zero" = true; - "menus.clock.weather.location" = "${location}"; - "menus.clock.weather.unit" = "metric"; - "menus.dashboard.powermenu.confirmation" = false; - "menus.dashboard.shortcuts.left.shortcut1.icon" = ""; - "menus.dashboard.shortcuts.left.shortcut1.command" = "zen"; - "menus.dashboard.shortcuts.left.shortcut1.tooltip" = "Zen"; - "menus.dashboard.shortcuts.left.shortcut2.icon" = "󰅶"; - "menus.dashboard.shortcuts.left.shortcut2.command" = "caffeine"; - "menus.dashboard.shortcuts.left.shortcut2.tooltip" = "Caffeine"; - "menus.dashboard.shortcuts.left.shortcut3.icon" = "󰖔"; - "menus.dashboard.shortcuts.left.shortcut3.command" = "night-shift"; - "menus.dashboard.shortcuts.left.shortcut3.tooltip" = "Night-shift"; - "menus.dashboard.shortcuts.left.shortcut4.icon" = ""; - "menus.dashboard.shortcuts.left.shortcut4.command" = "menu"; - "menus.dashboard.shortcuts.left.shortcut4.tooltip" = "Search Apps"; - "menus.dashboard.shortcuts.right.shortcut1.icon" = ""; - "menus.dashboard.shortcuts.right.shortcut1.command" = "hyprpicker -a"; - "menus.dashboard.shortcuts.right.shortcut1.tooltip" = "Color Picker"; - "menus.dashboard.shortcuts.right.shortcut3.icon" = "󰄀"; - "menus.dashboard.shortcuts.right.shortcut3.command" = "screenshot region swappy"; - "menus.dashboard.shortcuts.right.shortcut3.tooltip" = "Screenshot"; + theme.font.name = font; + theme.font.size = fontSizeForHyprpanel; - "theme.bar.menus.monochrome" = true; - "wallpaper.enable" = false; - "theme.bar.menus.background" = "${background}"; - "theme.bar.menus.cards" = "${background-alt}"; - "theme.bar.menus.card_radius" = "${toString rounding}px"; - "theme.bar.menus.label" = "${foreground}"; - "theme.bar.menus.text" = "${foreground}"; - "theme.bar.menus.border.size" = "${toString border-size}px"; - "theme.bar.menus.border.color" = "${accent}"; - "theme.bar.menus.border.radius" = "${toString rounding}px"; - "theme.bar.menus.popover.text" = "${foreground}"; - "theme.bar.menus.popover.background" = "${background-alt}"; - "theme.bar.menus.listitems.active" = "${accent}"; - "theme.bar.menus.icons.active" = "${accent}"; - "theme.bar.menus.switch.enabled" = "${accent}"; - "theme.bar.menus.check_radio_button.active" = "${accent}"; - "theme.bar.menus.buttons.default" = "${accent}"; - "theme.bar.menus.buttons.active" = "${accent}"; - "theme.bar.menus.iconbuttons.active" = "${accent}"; - "theme.bar.menus.progressbar.foreground" = "${accent}"; - "theme.bar.menus.slider.primary" = "${accent}"; - "theme.bar.menus.tooltip.background" = "${background-alt}"; - "theme.bar.menus.tooltip.text" = "${foreground}"; - "theme.bar.menus.dropdownmenu.background" = "${background-alt}"; - "theme.bar.menus.dropdownmenu.text" = "${foreground}"; - "theme.bar.background" = "${background + (if transparentButtons && transparent then "00" else "")}"; - "theme.bar.buttons.style" = "default"; - "theme.bar.buttons.monochrome" = true; - "theme.bar.buttons.text" = "${foreground}"; - "theme.bar.buttons.background" = "${ - (if transparent then background else background-alt) + (if transparentButtons then "00" else "") - }"; - "theme.bar.buttons.icon" = "${accent}"; - "theme.bar.buttons.notifications.background" = "${background-alt}"; - "theme.bar.buttons.hover" = "${background}"; - "theme.bar.buttons.notifications.hover" = "${background}"; - "theme.bar.buttons.notifications.total" = "${accent}"; - "theme.bar.buttons.notifications.icon" = "${accent}"; - "theme.notification.background" = "${background-alt}"; - "theme.notification.actions.background" = "${accent}"; - "theme.notification.actions.text" = "${foreground}"; - "theme.notification.label" = "${accent}"; - "theme.notification.border" = "${background-alt}"; - "theme.notification.text" = "${foreground}"; - "theme.notification.labelicon" = "${accent}"; - "theme.osd.bar_color" = "${accent}"; - "theme.osd.bar_overflow_color" = "${accent-alt}"; - "theme.osd.icon" = "${background}"; - "theme.osd.icon_container" = "${accent}"; - "theme.osd.label" = "${accent}"; - "theme.osd.bar_container" = "${background-alt}"; - "theme.bar.menus.menu.media.background.color" = "${background-alt}"; - "theme.bar.menus.menu.media.card.color" = "${background-alt}"; - "theme.bar.menus.menu.media.card.tint" = 90; - "bar.customModules.updates.pollingInterval" = 1440000; - "bar.media.show_active_only" = true; - "theme.bar.location" = "${position}"; - "bar.workspaces.numbered_active_indicator" = "color"; - "bar.workspaces.monitorSpecific" = false; - "bar.workspaces.applicationIconEmptyWorkspace" = ""; - "bar.workspaces.showApplicationIcons" = true; - "bar.workspaces.showWsIcons" = true; - "theme.bar.dropdownGap" = "4.5em"; + theme.bar.outer_spacing = if floating && transparent then "0px" else "8px"; + theme.bar.buttons.y_margins = if floating && transparent then "0px" else "8px"; + theme.bar.buttons.spacing = "0.3em"; + theme.bar.buttons.radius = + (if transparent then toString rounding else toString (rounding - 8)) + "px"; + theme.bar.floating = floating; + theme.bar.buttons.padding_x = "0.8rem"; + theme.bar.buttons.padding_y = "0.4rem"; + + theme.bar.margin_top = (if position == "top" then toString (gaps-in * 2) else "0") + "px"; + theme.bar.margin_bottom = (if position == "top" then "0" else toString (gaps-in * 2)) + "px"; + theme.bar.margin_sides = toString gaps-out + "px"; + theme.bar.border_radius = toString rounding + "px"; + theme.bar.transparent = transparent; + theme.bar.location = position; + theme.bar.dropdownGap = "4.5em"; + theme.bar.menus.shadow = if transparent then "0 0 0 0" else "0px 0px 3px 1px #16161e"; + theme.bar.buttons.style = "default"; + theme.bar.buttons.monochrome = true; + theme.bar.menus.monochrome = true; + theme.bar.menus.card_radius = toString rounding + "px"; + theme.bar.menus.border.size = toString border-size + "px"; + theme.bar.menus.border.radius = toString rounding + "px"; + theme.bar.menus.menu.media.card.tint = 90; + + bar.launcher.icon = ""; + bar.workspaces.show_numbered = false; + bar.workspaces.workspaces = 5; + bar.workspaces.numbered_active_indicator = "color"; + bar.workspaces.monitorSpecific = false; + bar.workspaces.applicationIconEmptyWorkspace = ""; + bar.workspaces.showApplicationIcons = true; + bar.workspaces.showWsIcons = true; + + bar.windowtitle.label = true; + bar.volume.label = false; + bar.network.truncation_size = 12; + bar.bluetooth.label = false; + bar.clock.format = "%a %b %d %I:%M %p"; + bar.notifications.show_total = true; + bar.media.show_active_only = true; + + bar.customModules.updates.pollingInterval = 1440000; + bar.customModules.cava.showIcon = false; + bar.customModules.cava.stereo = true; + bar.customModules.cava.showActiveOnly = true; + + notifications.position = "top right"; + notifications.showActionsOnHover = true; + theme.notification.opacity = notificationOpacity; + theme.notification.enableShadow = true; + theme.notification.border_radius = toString rounding + "px"; + + theme.osd.enable = true; + theme.osd.orientation = "vertical"; + theme.osd.location = "left"; + theme.osd.radius = toString rounding + "px"; + theme.osd.margins = "0px 0px 0px 10px"; + theme.osd.muted_zero = true; + + menus.clock.weather.location = location; + menus.clock.weather.unit = "metric"; + menus.dashboard.powermenu.confirmation = false; + menus.dashboard.powermenu.avatar.image = "~/.face.icon"; + + menus.dashboard.shortcuts.left.shortcut1.icon = ""; + menus.dashboard.shortcuts.left.shortcut1.command = "zen"; + menus.dashboard.shortcuts.left.shortcut1.tooltip = "Zen"; + menus.dashboard.shortcuts.left.shortcut2.icon = "󰅶"; + menus.dashboard.shortcuts.left.shortcut2.command = "caffeine"; + menus.dashboard.shortcuts.left.shortcut2.tooltip = "Caffeine"; + menus.dashboard.shortcuts.left.shortcut3.icon = "󰖔"; + menus.dashboard.shortcuts.left.shortcut3.command = "night-shift"; + menus.dashboard.shortcuts.left.shortcut3.tooltip = "Night-shift"; + menus.dashboard.shortcuts.left.shortcut4.icon = ""; + menus.dashboard.shortcuts.left.shortcut4.command = "menu"; + menus.dashboard.shortcuts.left.shortcut4.tooltip = "Search Apps"; + + menus.dashboard.shortcuts.right.shortcut1.icon = ""; + menus.dashboard.shortcuts.right.shortcut1.command = "hyprpicker -a"; + menus.dashboard.shortcuts.right.shortcut1.tooltip = "Color Picker"; + menus.dashboard.shortcuts.right.shortcut3.icon = "󰄀"; + menus.dashboard.shortcuts.right.shortcut3.command = "screenshot region swappy"; + menus.dashboard.shortcuts.right.shortcut3.tooltip = "Screenshot"; + + menus.power.lowBatteryNotification = true; + + wallpaper.enable = false; + + theme.bar.buttons.workspaces.hover = accent-alt; + theme.bar.buttons.workspaces.active = accent; + theme.bar.buttons.workspaces.available = accent-alt; + theme.bar.buttons.workspaces.occupied = accent-alt; + + theme.bar.menus.background = background; + theme.bar.menus.cards = background-alt; + theme.bar.menus.label = foreground; + theme.bar.menus.text = foreground; + theme.bar.menus.border.color = accent; + theme.bar.menus.popover.text = foreground; + theme.bar.menus.popover.background = background-alt; + theme.bar.menus.listitems.active = accent; + theme.bar.menus.icons.active = accent; + theme.bar.menus.switch.enabled = accent; + theme.bar.menus.check_radio_button.active = accent; + theme.bar.menus.buttons.default = accent; + theme.bar.menus.buttons.active = accent; + theme.bar.menus.iconbuttons.active = accent; + theme.bar.menus.progressbar.foreground = accent; + theme.bar.menus.slider.primary = accent; + theme.bar.menus.tooltip.background = background-alt; + theme.bar.menus.tooltip.text = foreground; + theme.bar.menus.dropdownmenu.background = background-alt; + theme.bar.menus.dropdownmenu.text = foreground; + + theme.bar.background = background + (if transparentButtons && transparent then "00" else ""); + theme.bar.buttons.text = + if transparent && transparentButtons then foregroundOnWallpaper else foreground; + theme.bar.buttons.background = + (if transparent then background else background-alt) + (if transparentButtons then "00" else ""); + theme.bar.buttons.icon = accent; + + theme.bar.buttons.notifications.background = background-alt; + theme.bar.buttons.hover = background; + theme.bar.buttons.notifications.hover = background; + theme.bar.buttons.notifications.total = accent; + theme.bar.buttons.notifications.icon = accent; + + theme.osd.bar_color = accent; + theme.osd.bar_overflow_color = accent-alt; + theme.osd.icon = background; + theme.osd.icon_container = accent; + theme.osd.label = accent; + theme.osd.bar_container = background-alt; + + theme.bar.menus.menu.media.background.color = background-alt; + theme.bar.menus.menu.media.card.color = background-alt; + + theme.notification.background = background-alt; + theme.notification.actions.background = accent; + theme.notification.actions.text = foreground; + theme.notification.label = accent; + theme.notification.border = background-alt; + theme.notification.text = foreground; + theme.notification.labelicon = accent; + theme.notification.close_button.background = background-alt; + theme.notification.close_button.label = "#f38ba8"; }; }; } diff --git a/home-manager/modules/hyprlock.nix b/home-manager/modules/hyprlock.nix deleted file mode 100644 index 26d4117..0000000 --- a/home-manager/modules/hyprlock.nix +++ /dev/null @@ -1,89 +0,0 @@ -{ config, lib, ... }: -let - foreground = "rgba(216, 222, 233, 0.70)"; - imageStr = toString config.stylix.image; - font = config.stylix.fonts.serif.name; -in -{ - programs.hyprlock = { - enable = true; - settings = { - general = { - grace = 5; - no_fade_in = false; - disable_loading_bar = false; - }; - - # BACKGROUND - background = { - monitor = ""; - # path = imageStr; - blur_passes = 0; - contrast = 0.8916; - brightness = 0.7172; - vibrancy = 0.1696; - vibrancy_darkness = 0.0; - }; - - label = [ - { - # Day-Month-Date - monitor = ""; - text = ''cmd[update:1000] echo -e "$(date +"%A, %B %d")"''; - color = foreground; - font_size = 28; - font_family = font + " Bold"; - position = "0, 490"; - halign = "center"; - valign = "center"; - } - # Time - { - monitor = ""; - text = ''cmd[update:1000] echo "$(date +"%I:%M")"''; - color = foreground; - font_size = 160; - font_family = "steelfish outline regular"; - position = "0, 370"; - halign = "center"; - valign = "center"; - } - # USER - { - monitor = ""; - text = " $USER"; - color = foreground; - outline_thickness = 2; - dots_size = 0.2; # Scale of input-field height, 0.2 - 0.8 - dots_spacing = 0.2; # Scale of dots' absolute size, 0.0 - 1.0 - dots_center = true; - font_size = 18; - font_family = font + " Bold"; - position = "0, -180"; - halign = "center"; - valign = "center"; - } - ]; - - # INPUT FIELD - input-field = lib.mkForce { - monitor = ""; - size = "300, 60"; - outline_thickness = 2; - dots_size = 0.2; # Scale of input-field height, 0.2 - 0.8 - dots_spacing = 0.2; # Scale of dots' absolute size, 0.0 - 1.0 - dots_center = true; - outer_color = "rgba(255, 255, 255, 0)"; - inner_color = "rgba(255, 255, 255, 0.1)"; - font_color = foreground; - fade_on_empty = false; - font_family = font + " Bold"; - placeholder_text = "🔒 Enter Password"; - hide_input = false; - position = "0, -250"; - halign = "center"; - valign = "center"; - }; - }; - }; -} diff --git a/home-manager/modules/hyprpanel.nix b/home-manager/modules/hyprpanel.nix deleted file mode 100644 index f5a8996..0000000 --- a/home-manager/modules/hyprpanel.nix +++ /dev/null @@ -1,186 +0,0 @@ -# Hyprpanel is the bar on top of the screen -# Display informations like workspaces, battery, wifi, ... -{ inputs, config, ... }: -let - transparentButtons = config.var.theme.bar.transparentButtons; - - accent = "#${config.lib.stylix.colors.base0D}"; - accent-alt = "#${config.lib.stylix.colors.base03}"; - background = "#${config.lib.stylix.colors.base00}"; - background-alt = "#${config.lib.stylix.colors.base01}"; - foreground = "#${config.lib.stylix.colors.base05}"; - font = "${config.stylix.fonts.serif.name}"; - fontSize = "${toString config.stylix.fonts.sizes.desktop}"; - - rounding = config.var.theme.rounding; - border-size = config.var.theme.border-size; - - gaps-out = config.var.theme.gaps-out; - gaps-in = config.var.theme.gaps-in; - - floating = config.var.theme.bar.floating; - transparent = config.var.theme.bar.transparent; - position = config.var.theme.bar.position; - - location = config.var.location; -in -{ - - imports = [ inputs.hyprpanel.homeManagerModules.hyprpanel ]; - - programs.hyprpanel = { - enable = true; - systemd.enable = true; - hyprland.enable = true; - overwrite.enable = true; - overlay.enable = true; - settings = { - layout = { - "bar.layouts" = { - "0" = { - "left" = [ - "dashboard" - "workspaces" - "windowtitle" - ]; - "middle" = [ "media" ]; - "right" = [ - "systray" - "volume" - "bluetooth" - "battery" - "network" - "clock" - "notifications" - ]; - }; - }; - }; - }; - override = { - "theme.font.name" = "${font}"; - "theme.font.size" = "${fontSize}px"; - "theme.bar.outer_spacing" = "${if floating && transparent then "0" else "8"}px"; - "theme.bar.buttons.y_margins" = "${if floating && transparent then "0" else "8"}px"; - "theme.bar.buttons.spacing" = "0.3em"; - "theme.bar.buttons.radius" = "${ - if transparent then toString rounding else toString (rounding - 8) - }px"; - "theme.bar.floating" = "${if floating then "true" else "false"}"; - "theme.bar.buttons.padding_x" = "0.8rem"; - "theme.bar.buttons.padding_y" = "0.4rem"; - "theme.bar.buttons.workspaces.hover" = "${accent-alt}"; - "theme.bar.buttons.workspaces.active" = "${accent}"; - "theme.bar.buttons.workspaces.available" = "${accent-alt}"; - "theme.bar.buttons.workspaces.occupied" = "${accent-alt}"; - "theme.bar.margin_top" = "${if position == "top" then toString (gaps-in * 2) else "0"}px"; - "theme.bar.margin_bottom" = "${if position == "top" then "0" else toString (gaps-in * 2)}px"; - "theme.bar.margin_sides" = "${toString gaps-out}px"; - "theme.bar.border_radius" = "${toString rounding}px"; - "bar.launcher.icon" = ""; - "theme.bar.transparent" = "${if transparent then "true" else "false"}"; - "bar.workspaces.show_numbered" = false; - "bar.workspaces.workspaces" = 5; - "bar.workspaces.hideUnoccupied" = false; - "bar.windowtitle.label" = true; - "bar.volume.label" = false; - "bar.network.truncation_size" = 12; - "bar.bluetooth.label" = false; - "bar.clock.format" = "%a %b %d %I:%M %p"; - "bar.notifications.show_total" = true; - "theme.notification.border_radius" = "${toString rounding}px"; - "theme.osd.enable" = true; - "theme.osd.orientation" = "vertical"; - "theme.osd.location" = "left"; - "theme.osd.radius" = "${toString rounding}px"; - "theme.osd.margins" = "0px 0px 0px 10px"; - "theme.osd.muted_zero" = true; - "menus.clock.weather.location" = "${location}"; - "menus.clock.weather.unit" = "metric"; - "menus.dashboard.powermenu.confirmation" = false; - - "menus.dashboard.shortcuts.left.shortcut1.icon" = ""; - "menus.dashboard.shortcuts.left.shortcut1.command" = "zen"; - "menus.dashboard.shortcuts.left.shortcut1.tooltip" = "Zen"; - "menus.dashboard.shortcuts.left.shortcut2.icon" = "󰅶"; - "menus.dashboard.shortcuts.left.shortcut2.command" = "caffeine"; - "menus.dashboard.shortcuts.left.shortcut2.tooltip" = "Caffeine"; - "menus.dashboard.shortcuts.left.shortcut3.icon" = "󰖔"; - "menus.dashboard.shortcuts.left.shortcut3.command" = "night-shift"; - "menus.dashboard.shortcuts.left.shortcut3.tooltip" = "Night-shift"; - "menus.dashboard.shortcuts.left.shortcut4.icon" = ""; - "menus.dashboard.shortcuts.left.shortcut4.command" = "menu"; - "menus.dashboard.shortcuts.left.shortcut4.tooltip" = "Search Apps"; - "menus.dashboard.shortcuts.right.shortcut1.icon" = ""; - "menus.dashboard.shortcuts.right.shortcut1.command" = "hyprpicker -a"; - "menus.dashboard.shortcuts.right.shortcut1.tooltip" = "Color Picker"; - "menus.dashboard.shortcuts.right.shortcut3.icon" = "󰄀"; - "menus.dashboard.shortcuts.right.shortcut3.command" = "screenshot region swappy"; - "menus.dashboard.shortcuts.right.shortcut3.tooltip" = "Screenshot"; - - "theme.bar.menus.monochrome" = true; - "wallpaper.enable" = false; - "theme.bar.menus.background" = "${background}"; - "theme.bar.menus.cards" = "${background-alt}"; - "theme.bar.menus.card_radius" = "${toString rounding}px"; - "theme.bar.menus.label" = "${foreground}"; - "theme.bar.menus.text" = "${foreground}"; - "theme.bar.menus.border.size" = "${toString border-size}px"; - "theme.bar.menus.border.color" = "${accent}"; - "theme.bar.menus.border.radius" = "${toString rounding}px"; - "theme.bar.menus.popover.text" = "${foreground}"; - "theme.bar.menus.popover.background" = "${background-alt}"; - "theme.bar.menus.listitems.active" = "${accent}"; - "theme.bar.menus.icons.active" = "${accent}"; - "theme.bar.menus.switch.enabled" = "${accent}"; - "theme.bar.menus.check_radio_button.active" = "${accent}"; - "theme.bar.menus.buttons.default" = "${accent}"; - "theme.bar.menus.buttons.active" = "${accent}"; - "theme.bar.menus.iconbuttons.active" = "${accent}"; - "theme.bar.menus.progressbar.foreground" = "${accent}"; - "theme.bar.menus.slider.primary" = "${accent}"; - "theme.bar.menus.tooltip.background" = "${background-alt}"; - "theme.bar.menus.tooltip.text" = "${foreground}"; - "theme.bar.menus.dropdownmenu.background" = "${background-alt}"; - "theme.bar.menus.dropdownmenu.text" = "${foreground}"; - "theme.bar.background" = "${background + (if transparentButtons && transparent then "00" else "")}"; - "theme.bar.buttons.style" = "default"; - "theme.bar.buttons.monochrome" = true; - "theme.bar.buttons.text" = "${foreground}"; - "theme.bar.buttons.background" = "${ - (if transparent then background else background-alt) + (if transparentButtons then "00" else "") - }"; - "theme.bar.buttons.icon" = "${accent}"; - "theme.bar.buttons.notifications.background" = "${background-alt}"; - "theme.bar.buttons.hover" = "${background}"; - "theme.bar.buttons.notifications.hover" = "${background}"; - "theme.bar.buttons.notifications.total" = "${accent}"; - "theme.bar.buttons.notifications.icon" = "${accent}"; - "theme.notification.background" = "${background-alt}"; - "theme.notification.actions.background" = "${accent}"; - "theme.notification.actions.text" = "${foreground}"; - "theme.notification.label" = "${accent}"; - "theme.notification.border" = "${background-alt}"; - "theme.notification.text" = "${foreground}"; - "theme.notification.labelicon" = "${accent}"; - "theme.osd.bar_color" = "${accent}"; - "theme.osd.bar_overflow_color" = "${accent-alt}"; - "theme.osd.icon" = "${background}"; - "theme.osd.icon_container" = "${accent}"; - "theme.osd.label" = "${accent}"; - "theme.osd.bar_container" = "${background-alt}"; - "theme.bar.menus.menu.media.background.color" = "${background-alt}"; - "theme.bar.menus.menu.media.card.color" = "${background-alt}"; - "theme.bar.menus.menu.media.card.tint" = 90; - "bar.customModules.updates.pollingInterval" = 1440000; - "bar.media.show_active_only" = true; - "theme.bar.location" = "${position}"; - "bar.workspaces.numbered_active_indicator" = "color"; - "bar.workspaces.monitorSpecific" = false; - "bar.workspaces.applicationIconEmptyWorkspace" = ""; - "bar.workspaces.showApplicationIcons" = true; - "bar.workspaces.showWsIcons" = true; - "theme.bar.dropdownGap" = "4.5em"; - }; - }; -} diff --git a/home-manager/modules/hyprspace.nix b/home-manager/modules/hyprspace.nix deleted file mode 100644 index 2e0f98a..0000000 --- a/home-manager/modules/hyprspace.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ inputs, pkgs, ... }: -{ - wayland.windowManager.hyprland = { - plugins = [ inputs.hyprspace.packages.${pkgs.system}.Hyprspace ]; - settings = { - plugin = { - overview = { - centerAligned = true; - hideTopLayers = true; - hideOverlayLayers = true; - showNewWorkspace = true; - exitOnClick = true; - exitOnSwitch = true; - drawActiveWorkspace = true; - autoDrag = false; - }; - }; - }; - }; -} diff --git a/home-manager/modules/mime.nix b/home-manager/modules/mime.nix index 6231da4..d650516 100644 --- a/home-manager/modules/mime.nix +++ b/home-manager/modules/mime.nix @@ -1,4 +1,8 @@ -{ pkgs, lib, ... }: +{ + pkgs, + lib, + ... +}: with lib; let defaultApps = { diff --git a/home-manager/modules/xdg.nix b/home-manager/modules/xdg.nix deleted file mode 100644 index 12ca3c7..0000000 --- a/home-manager/modules/xdg.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ pkgs, ... }: -{ - xdg.portal = { - enable = true; - - extraPortals = with pkgs; [ - # xdg-desktop-portal-hyprland - xdg-desktop-portal-gtk - libsForQt5.xdg-desktop-portal-kde - lxqt.xdg-desktop-portal-lxqt - ]; - }; -} diff --git a/hosts/grymforge/configuration.nix b/hosts/grymforge/configuration.nix index 3e8074d..23cd22e 100644 --- a/hosts/grymforge/configuration.nix +++ b/hosts/grymforge/configuration.nix @@ -34,6 +34,8 @@ ./sysctl.nix ./earlyoom.nix + ./sleep.nix + # Or modules from other flakes (such as nixos-hardware): # inputs.hardware.nixosModules.common-cpu-amd # inputs.hardware.nixosModules.common-ssd diff --git a/hosts/grymforge/sleep.nix b/hosts/grymforge/sleep.nix new file mode 100644 index 0000000..ee5267f --- /dev/null +++ b/hosts/grymforge/sleep.nix @@ -0,0 +1,34 @@ +{ pkgs, ... }: +{ + systemd.services.sleep-schedule = { + description = "Suspend PC at 10PM and wake at 6:30AM using rtcwake"; + serviceConfig = { + Type = "oneshot"; + ExecStart = pkgs.writeShellScript "sleep-schedule" '' + WAKE_TIME=$(${pkgs.coreutils}/bin/date +%s -d "tomorrow 06:30") + exec ${pkgs.util-linux}/bin/rtcwake -m mem -t "$WAKE_TIME" + ''; + }; + }; + + systemd.timers.sleep-schedule = { + description = "Timer to suspend PC at 10PM daily"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "daily 22:00"; + Persistent = true; + }; + }; + + security.sudo.extraRules = [ + { + users = [ "root" ]; + commands = [ + { + command = "/run/current-system/sw/bin/rtcwake"; + options = [ "NOPASSWD" ]; + } + ]; + } + ]; +} diff --git a/hosts/panopticon/configuration.nix b/hosts/panopticon/configuration.nix index cfafb5c..e0e25f7 100644 --- a/hosts/panopticon/configuration.nix +++ b/hosts/panopticon/configuration.nix @@ -22,7 +22,9 @@ ./grafana.nix ./promtail.nix ./loki.nix + ./uptime-kuma.nix ./prometheus_node_exporter.nix + ./traefik.nix inputs.sops-nix.nixosModules.sops ]; diff --git a/hosts/panopticon/grafana.nix b/hosts/panopticon/grafana.nix index 578cdda..0febadb 100644 --- a/hosts/panopticon/grafana.nix +++ b/hosts/panopticon/grafana.nix @@ -1,14 +1,27 @@ -_: { +{ config, ... }: +{ + sops.secrets.grafana_user = { + mode = "0440"; + owner = config.users.users.grafana.name; + group = config.users.users.grafana.group; + }; + + sops.secrets.grafana_password = { + mode = "0440"; + owner = config.users.users.grafana.name; + group = config.users.users.grafana.group; + }; + services.grafana = { enable = true; settings = { server = { http_addr = "127.0.0.1"; - http_port = 3000; + http_port = 3001; }; security = { - admin_user = "admin"; - admin_password = "changeme"; + admin_user = "${config.sops.secrets.grafana_user.path}"; + admin_password = "${config.sops.secrets.grafana_password.path}"; }; }; diff --git a/hosts/panopticon/loki-config.yaml b/hosts/panopticon/loki-config.yaml new file mode 100644 index 0000000..0f69ce2 --- /dev/null +++ b/hosts/panopticon/loki-config.yaml @@ -0,0 +1,30 @@ + +# This is a complete configuration to deploy Loki backed by the filesystem. +# The index will be shipped to the storage via tsdb-shipper. + +auth_enabled: false + +server: + http_listen_port: 3100 + +common: + ring: + instance_addr: 127.0.0.1 + kvstore: + store: inmemory + replication_factor: 1 + path_prefix: /tmp/loki + +schema_config: + configs: + - from: 2020-05-15 + store: tsdb + object_store: filesystem + schema: v13 + index: + prefix: index_ + period: 24h + +storage_config: + filesystem: + directory: /tmp/loki/chunks diff --git a/hosts/panopticon/loki.nix b/hosts/panopticon/loki.nix index 2c4ace0..6f24a0b 100644 --- a/hosts/panopticon/loki.nix +++ b/hosts/panopticon/loki.nix @@ -1,53 +1,6 @@ -_: { +{ services.loki = { enable = true; - configuration = { - auth_enabled = false; - server.http_listen_port = 3100; - - ingester = { - lifecycler = { - ring = { - kvstore = { - store = "inmemory"; - }; - }; - final_sleep = "0s"; - }; - chunk_idle_period = "5m"; - max_chunk_age = "1h"; - chunk_target_size = 1048576; - }; - - schema_config = { - configs = [ - { - from = "2024-01-01"; - store = "boltdb-shipper"; - object_store = "filesystem"; - schema = "v11"; - index = { - prefix = "index_"; - period = "24h"; - }; - } - ]; - }; - - storage_config = { - boltdb_shipper = { - active_index_directory = "/var/lib/loki/index"; - cache_location = "/var/lib/loki/cache"; - shared_store = "filesystem"; - }; - filesystem = { - directory = "/var/lib/loki/chunks"; - }; - }; - - limits_config = { - retention_period = "168h"; - }; - }; + configFile = ./loki-config.yaml; }; } diff --git a/hosts/panopticon/promtail.nix b/hosts/panopticon/promtail.nix index 479791b..d916e33 100644 --- a/hosts/panopticon/promtail.nix +++ b/hosts/panopticon/promtail.nix @@ -1,9 +1,13 @@ { config, ... }: { + systemd.tmpfiles.rules = [ + "d /var/lib/promtail 0755 promtail promtail -" + ]; services.promtail = { enable = true; configuration = { server.http_listen_port = 9080; + server.grpc_listen_port = 0; positions = { filename = "/var/lib/promtail/positions.yaml"; }; diff --git a/hosts/panopticon/routes.nix b/hosts/panopticon/routes.nix new file mode 100644 index 0000000..2bd2b39 --- /dev/null +++ b/hosts/panopticon/routes.nix @@ -0,0 +1,36 @@ +{ + imports = [ + ./services.nix + ]; + services.traefik = { + dynamicConfigOptions = { + http = { + routers = { + uptime_kuma_local = { + entryPoints = [ "websecure" ]; + rule = "Host(`uptime.gwg313.xyz`)"; + service = "uptime_kuma_local"; + tls.certResolver = "le"; + middlewares = [ "headers" ]; + }; + + grafana_local = { + entryPoints = [ "websecure" ]; + rule = "Host(`grafana.gwg313.xyz`)"; + service = "grafana_local"; + tls.certResolver = "le"; + middlewares = [ "headers" ]; + }; + + loki_local = { + entryPoints = [ "websecure" ]; + rule = "Host(`loki.gwg313.xyz`)"; + service = "loki_local"; + tls.certResolver = "le"; + middlewares = [ "headers" ]; + }; + }; + }; + }; + }; +} diff --git a/hosts/panopticon/services.nix b/hosts/panopticon/services.nix new file mode 100644 index 0000000..40cd74e --- /dev/null +++ b/hosts/panopticon/services.nix @@ -0,0 +1,27 @@ +{ + services.traefik = { + dynamicConfigOptions = { + http = { + services = { + uptime_kuma_local.loadBalancer.servers = [ + { + url = "http://127.0.0.1:3030"; + } + ]; + + grafana_local.loadBalancer.servers = [ + { + url = "http://127.0.0.1:3001"; + } + ]; + + loki_local.loadBalancer.servers = [ + { + url = "http://127.0.0.1:3100"; + } + ]; + }; + }; + }; + }; +} diff --git a/hosts/panopticon/traefik.nix b/hosts/panopticon/traefik.nix index 7abab33..8e94b6a 100644 --- a/hosts/panopticon/traefik.nix +++ b/hosts/panopticon/traefik.nix @@ -2,6 +2,7 @@ { config, ... }: { imports = [ + ./routes.nix ]; sops.secrets.cf-api-token = { mode = "0440"; @@ -60,22 +61,22 @@ }; }; }; - log = { - level = "DEBUG"; - filePath = "/var/log/traefik/traefik.log"; - }; - - accessLog = { - filePath = "/var/log/traefik/access.log"; - bufferingSize = 0; - filters = { }; - fields = { - defaultMode = "keep"; - names = { - StartUTC = "drop"; - }; - }; - }; + # log = { + # level = "DEBUG"; + # filePath = "/var/log/traefik/traefik.log"; + # }; + # + # accessLog = { + # filePath = "/var/log/traefik/access.log"; + # bufferingSize = 0; + # filters = {}; + # fields = { + # defaultMode = "keep"; + # names = { + # StartUTC = "drop"; + # }; + # }; + # }; }; dynamicConfigOptions = { http = { diff --git a/hosts/panopticon/uptime-kuma.nix b/hosts/panopticon/uptime-kuma.nix new file mode 100644 index 0000000..0fb4d9b --- /dev/null +++ b/hosts/panopticon/uptime-kuma.nix @@ -0,0 +1,9 @@ +_: { + services.uptime-kuma = { + enable = true; + settings = { + HOST = "127.0.0.1"; + PORT = "3030"; + }; + }; +} diff --git a/hosts/seikan/routes.nix b/hosts/seikan/routes.nix index 47036ba..b85909d 100644 --- a/hosts/seikan/routes.nix +++ b/hosts/seikan/routes.nix @@ -74,6 +74,12 @@ url = "https://s3-console.zerotier.gwg313.xyz"; } ]; + + uptime_zt.loadBalancer.servers = [ + { + url = "https://uptime.zerotier.gwg313.xyz"; + } + ]; }; routers = { @@ -171,6 +177,14 @@ tls.certResolver = "le"; middlewares = [ "headers" ]; }; + + uptime_console = { + entryPoints = [ "websecure" ]; + rule = "Host(`uptime.gwg313.xyz`)"; + service = "s3_console_zt"; + tls.certResolver = "le"; + middlewares = [ "headers" ]; + }; }; }; }; diff --git a/hosts/waypoint/routes.nix b/hosts/waypoint/routes.nix index a544f83..5119cd8 100644 --- a/hosts/waypoint/routes.nix +++ b/hosts/waypoint/routes.nix @@ -100,6 +100,14 @@ tls.certResolver = "le"; middlewares = [ "headers" ]; }; + + uptime = { + entryPoints = [ "websecure" ]; + rule = "Host(`uptime.gwg313.xyz`)"; + service = "uptime_local"; + tls.certResolver = "le"; + middlewares = [ "headers" ]; + }; }; }; }; diff --git a/hosts/waypoint/routes_zerotier.nix b/hosts/waypoint/routes_zerotier.nix index ea0ba17..ea52c68 100644 --- a/hosts/waypoint/routes_zerotier.nix +++ b/hosts/waypoint/routes_zerotier.nix @@ -107,6 +107,14 @@ tls.certResolver = "le"; middlewares = [ "headers" ]; }; + + uptime_zt = { + entryPoints = [ "websecure" ]; + rule = "Host(`uptime.zerotier.gwg313.xyz`)"; + service = "uptime_local"; + tls.certResolver = "le"; + middlewares = [ "headers" ]; + }; }; }; }; diff --git a/hosts/waypoint/services.nix b/hosts/waypoint/services.nix index 46ca61f..48975ff 100644 --- a/hosts/waypoint/services.nix +++ b/hosts/waypoint/services.nix @@ -34,7 +34,7 @@ audiobooks_local.loadBalancer.servers = [ { - url = "http://10.1.10.3:30080"; + url = "https://audiobooks.gwg313.xyz"; } ]; @@ -89,6 +89,12 @@ url = "https://s3-console.gwg313.xyz"; } ]; + + uptime_local.loadBalancer.servers = [ + { + url = "https://uptime.gwg313.xyz"; + } + ]; }; }; }; diff --git a/secrets/secrets.yaml b/secrets/secrets.yaml index f537ffd..a3daec3 100644 --- a/secrets/secrets.yaml +++ b/secrets/secrets.yaml @@ -1,12 +1,10 @@ restic_key: ENC[AES256_GCM,data:DzpWvFP5gyhrnLVIYgu9ouotWqkOAHehihSKf/TqJE+sHTD4vnIScfhzoKzdkoDoWfkcmQ==,iv:q83qNYuP/3mngvg+kUfOVToogL8VTvZ6HiGIztpnP/s=,tag:YNWwbma0HmPKqYCS1L5kQQ==,type:str] -wireless.env: ENC[AES256_GCM,data:/5i0Kv+VFTtVpaD7tfO2ahePu20eYkUYAqoh39PA2aoMWywLddQEQy4arj2Nvcw8hsRk760Kiq4wz3c23dPDqy7rU980NF2RaP4ODMIiQISfYeQP9coD84JhlnSTW+7EkhV520naqJgIYY0IsA8OxR/5euyFMHOL75FKnBh1ILY2DPSsJNG2m2ldw+US7E+7r4REl8tDqKfCIL5tznmbVTbPrer7cwrXe+ScFaholmqSntaB06yIIO3yr88TmE6EXF6oLCXU,iv:DPOqx7M7E83+DYjGFPZy44cxrta/3953IDjXL40rLAc=,tag:KmYBpQKgshMSgxnC96T1bQ==,type:str] +wireless.env: ENC[AES256_GCM,data:bknujxgeDzXii2eUPTS609cige01pbqCVPm0EKFJaZfB6aHT1jUXtxN54bB5aKtaiOcuJ1Mcee8JbijH+n5LOM7LsApq9IoBDJsyChuBX0PilzCSmkftzOBrl4hhDzxHCelISvBxCnbrNQnywPkiffOxaQfP7NCSNKu2NsnJH/N26Kwda5CbXmBifQTPSwVn1Xs3aM96vS4KjsBrkCROWHQ2JMgywJ6jnFP2VUickEsr0BBFhnudmxhbooUbhkFH80jrGxJn,iv:aOHIxI2oHDltOUTkGuQqoNa6hU1gaqPMnLyBZpCNqB8=,tag:IdwvOcigWJ2W/gVpGBIWMA==,type:str] cf-api-token: ENC[AES256_GCM,data:7FJtAEOdYnUpGqs5r3pNIkY+lsqn2wtRhyIGXD5G7in3U3Tt8CTn5g==,iv:61kKxSYk54NqvhNn4xZZ2Gec7p/93dAN+VWBqF5OSQQ=,tag:5yzcHjGzhD8KX2FgL+xK/Q==,type:str] basic-auth: ENC[AES256_GCM,data:/YSAcTnyvM4sjj3cc46YwkXGeP3yG2MHctza+kDuRaNXb8ABMFofUHU6KuifTpsmUWwPQ4BPdamv+JC9ee8tsWRMxw==,iv:CUE70AISBOdYDLUXGAnIPT4t4tOugHWLlCLE6YxTkjM=,tag:MnyHoQCHaTbYjp/jrbWEcg==,type:str] +grafana_user: ENC[AES256_GCM,data:EI0aavin,iv:tfkJ2pVyAgH+um+Wb1lgbvngcemdtMa+URXWV30yzBI=,tag:5VoyXtW3U+cuhHr0gPpOsg==,type:str] +grafana_password: ENC[AES256_GCM,data:nock2uRcv29OHFRJ,iv:bXrGrTZrGMXLEVn8jWuhoOyfDY/Suqp2TBSMzYx/psA=,tag:tSxo7aZvVUBZFdTXaPjWVA==,type:str] sops: - kms: [] - gcp_kms: [] - azure_kv: [] - hc_vault: [] age: - recipient: age1k3hs0gyzrmsdyqh9lpret46q3xaayxxntruzc4euy6h3slqn4u6q36h7rg enc: | @@ -17,8 +15,7 @@ sops: US9oa0pORXRVWWlyYlZZTGhXdTdOaWsKClqIK/YNJIIGFqOO0t4oni8dRTTXQniG ioIwAOdEgE/n0vcYhHXxLxWlTeqGZF076g7EFfIqiSNqrDtacRnazg== -----END AGE ENCRYPTED FILE----- - lastmodified: "2025-03-31T17:31:58Z" - mac: ENC[AES256_GCM,data:PGFoJSMR/W3taIMtXbavI/9elQBHrwliZsCdRbAUx++LBow8R86gq2xZN+KmgAhqV7gxa+2vfEAs/WQB7tGD1BAxUNNwb3up7CzzoZjlQG5WaHU9JiAERB5dFSYqS47faAOdkEr+MZWF42nO2DoA4PImtCBAaQLnAgO+AI6eG4I=,iv:b3AWusxwWvZwRFj7F8F00jx7Do/QnnzJpwJtUNmam/8=,tag:drPhuuPdW24AH8bH9y0YNA==,type:str] - pgp: [] + lastmodified: "2025-07-01T20:09:32Z" + mac: ENC[AES256_GCM,data:i+Q+2ottIzAINqlUVXxJ6erLEsItjkrSbjGjRg72hSZdAOusI9Er4A7R/JGnR26/+o8i6Ivf/HzYIGL1AX7mA48UCg5MM1gpUNnFlc4pkwP+9PdbhT/V7nvvzlHHyPc3y7AfjeY9SI0kVuStPwrIPtHkh1JYwqkpVl2DSU9OPCg=,iv:nXF7db9V7ZXtcmXFPPTcjWbld69HHYEQp8BhDEugYak=,tag:Dp5wuoWxB5PuxKiXvZWdIA==,type:str] unencrypted_suffix: _unencrypted - version: 3.9.4 + version: 3.10.2