From 6991318eb91189882957ad16af7880489b29dda4 Mon Sep 17 00:00:00 2001 From: sid Date: Sun, 10 May 2026 23:24:41 +0200 Subject: [PATCH 1/2] add notification toggle --- .../home/hyprland/applications/default.nix | 6 +++++ .../applications/dunst-toggle/default.nix | 18 +++++++++++++ .../dunst-toggle/dunst-toggle.nix | 11 ++++++++ modules/home/waybar/default.nix | 3 +++ modules/home/waybar/modules/notifications.nix | 27 +++++++++++++++++++ 5 files changed, 65 insertions(+) create mode 100644 modules/home/hyprland/applications/dunst-toggle/default.nix create mode 100644 modules/home/hyprland/applications/dunst-toggle/dunst-toggle.nix create mode 100644 modules/home/waybar/modules/notifications.nix diff --git a/modules/home/hyprland/applications/default.nix b/modules/home/hyprland/applications/default.nix index 193c696..8b434be 100644 --- a/modules/home/hyprland/applications/default.nix +++ b/modules/home/hyprland/applications/default.nix @@ -58,6 +58,7 @@ in imports = [ ./bemenu ./dmenu-bluetooth + ./dunst-toggle ./element-desktop ./feh ./kitty @@ -135,6 +136,11 @@ in bind = [ "$mod SHIFT, m, exec, ${terminal} -T ${musicplayer} -e ${musicplayer}" ]; }; + notifications = mkAppAttrs { + default = "dunst-toggle"; + bind = [ "$mod, Backspace, exec, ${notifications}" ]; + }; + networksettings = mkAppAttrs { default = "networkmanager_dmenu"; bind = [ "$mod SHIFT, n, exec, ${networksettings}" ]; diff --git a/modules/home/hyprland/applications/dunst-toggle/default.nix b/modules/home/hyprland/applications/dunst-toggle/default.nix new file mode 100644 index 0000000..69e4938 --- /dev/null +++ b/modules/home/hyprland/applications/dunst-toggle/default.nix @@ -0,0 +1,18 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + cfg = config.wayland.windowManager.hyprland; + app = cfg.applications.notifications.default; + + inherit (lib) mkIf; +in +{ + config = mkIf (cfg.enable && app == "dunst-toggle") { + home.packages = [ (import ./dunst-toggle.nix { inherit config pkgs; }) ]; + }; +} diff --git a/modules/home/hyprland/applications/dunst-toggle/dunst-toggle.nix b/modules/home/hyprland/applications/dunst-toggle/dunst-toggle.nix new file mode 100644 index 0000000..248faec --- /dev/null +++ b/modules/home/hyprland/applications/dunst-toggle/dunst-toggle.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +let + dunst = "${pkgs.dunst}/bin/dunstctl"; + pkill = "${pkgs.procps}/bin/pkill"; + signal = "${toString config.programs.waybar.settings.mainBar."custom/notifications".signal}"; +in +(pkgs.writeShellScriptBin "dunst-toggle" '' + ${dunst} set-paused toggle + ${pkill} -RTMIN+${signal} waybar +'') diff --git a/modules/home/waybar/default.nix b/modules/home/waybar/default.nix index af54412..6a208a3 100644 --- a/modules/home/waybar/default.nix +++ b/modules/home/waybar/default.nix @@ -56,6 +56,7 @@ let }; # Add your custom modules here + "custom/notifications" = import ./modules/notifications.nix { inherit lib pkgs; }; "custom/newsboat" = import ./modules/newsboat.nix { inherit lib pkgs; }; "pulseaudio#input" = import ./modules/pulseaudio/input.nix { inherit lib pkgs; }; "pulseaudio#output" = import ./modules/pulseaudio/output.nix { inherit lib pkgs; }; @@ -95,11 +96,13 @@ in "disk" "pulseaudio#input" "pulseaudio#output" + "custom/notifications" "tray" ]; inherit "custom/newsboat" + "custom/notifications" "hyprland/language" "hyprland/workspaces" "pulseaudio#input" diff --git a/modules/home/waybar/modules/notifications.nix b/modules/home/waybar/modules/notifications.nix new file mode 100644 index 0000000..1f21931 --- /dev/null +++ b/modules/home/waybar/modules/notifications.nix @@ -0,0 +1,27 @@ +{ pkgs, lib, ... }: + +let + inherit (lib) mkDefault; + dunst = "${pkgs.dunst}/bin/dunstctl"; +in +{ + format = mkDefault "{icon}"; + format-icons = { + unmuted = mkDefault ""; + muted = mkDefault ""; + }; + return-type = mkDefault "json"; + exec = mkDefault ( + pkgs.writeShellScript "notifications" '' + is_paused=$(${dunst} is-paused) + if [ "$is_paused" = "true" ]; then + echo '{"alt": "muted", "class": "muted"}' + else + echo '{"alt": "unmuted", "class": "unmuted"}' + fi + '' + ); + on-click = mkDefault "dunst-toggle"; + interval = mkDefault "once"; + signal = mkDefault 12; +} From f3c63493abf4158f6a56919aeedc4c701d9603cb Mon Sep 17 00:00:00 2001 From: sid Date: Sun, 10 May 2026 23:37:44 +0200 Subject: [PATCH 2/2] add nostr-relay nixos module --- modules/nixos/default.nix | 1 + modules/nixos/nostr-relay/default.nix | 57 +++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 modules/nixos/nostr-relay/default.nix diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 094f15e..60c31b9 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -21,6 +21,7 @@ miniflux = import ./miniflux; nginx = import ./nginx; normalUsers = import ./normalUsers; + nostr-relay = import ./nostr-relay; nvidia = import ./nvidia; ollama = import ./ollama; open-webui-oci = import ./open-webui-oci; diff --git a/modules/nixos/nostr-relay/default.nix b/modules/nixos/nostr-relay/default.nix new file mode 100644 index 0000000..199f702 --- /dev/null +++ b/modules/nixos/nostr-relay/default.nix @@ -0,0 +1,57 @@ +{ config, lib, ... }: + +let + cfg = config.services.nostr-relay; + domain = config.networking.domain; + subdomain = cfg.reverseProxy.subdomain; + fqdn = if (cfg.reverseProxy.enable && subdomain != "") then "${subdomain}.${domain}" else domain; + + inherit (lib) + mkDefault + mkIf + ; + + inherit (lib.utils) + mkReverseProxyOption + ; +in +{ + options.services.nostr-relay = { + reverseProxy = mkReverseProxyOption "Nostr Relay" "nostr"; + }; + + config = mkIf cfg.enable { + services.nostr-rs-relay = { + settings = { + network = { + port = mkDefault 12849; + host = mkDefault (if cfg.reverseProxy.enable then "127.0.0.1" else "0.0.0.0"); + }; + limits = { + max_event_size = mkDefault 65536; + max_subscriptions = mkDefault 20; + max_filters = mkDefault 10; + max_subid_length = mkDefault 128; + max_event_tags = mkDefault 2000; + max_content_length = mkDefault 32768; + }; + federation = { + enabled = mkDefault true; + max_message_size = mkDefault 1048576; + }; + database = { + max_query_time_ms = mkDefault 5000; + }; + }; + }; + + services.nginx.virtualHosts = mkIf cfg.reverseProxy.enable { + "${fqdn}" = { + enableACME = cfg.reverseProxy.forceSSL; + forceSSL = cfg.reverseProxy.forceSSL; + locations."/".proxyPass = + "http://127.0.0.1:${toString config.services.nostr-rs-relay.settings.network.port}"; + }; + }; + }; +}