diff options
| -rw-r--r-- | configuration.nix | 19 | ||||
| -rw-r--r-- | modules/notifications/default.nix | 50 | ||||
| -rw-r--r-- | packages.nix | 3 |
3 files changed, 60 insertions, 12 deletions
diff --git a/configuration.nix b/configuration.nix index c53af09..6d95cd8 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,24 +1,21 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - { config, pkgs, ... }: { imports = [ <home-manager/nixos> - ./hardware/thinkpad-e14/default.nix + ./hardware/thinkpad-e14 ./packages.nix ./overlays-system.nix ./modules/service-router.module.nix ./modules/login.nix ./modules/torrent.nix ./modules/work.nix - ./modules/keyboard/default.nix - ./modules/thunderbird/default.nix + ./modules/keyboard + ./modules/thunderbird ./modules/clamav.nix ./modules/lockscreen.nix - ./modules/sound/default.nix + ./modules/sound + ./modules/notifications ]; nixpkgs.config = { @@ -26,7 +23,7 @@ allowBroken = false; }; - services.service-router.enable = true; + services.service-router.enable = false; # TODO: Remove when all set services.udisks2.enable = true; @@ -46,7 +43,7 @@ hardware.bluetooth.enable = false; services.blueman.enable = false; - programs.kdeconnect.enable = true; + # programs.kdeconnect.enable = true; # Network networking = { @@ -56,7 +53,7 @@ allowedTCPPorts = [ 3000 3001 8081 ]; allowedUDPPorts = [ 41641 ]; }; - nameservers = [ "100.100.100.100" "8.8.8.8" "1.1.1.1" ]; + nameservers = [ "100.100.100.100" "1.1.1.1" "8.8.8.8" ]; search = [ "resolve.construction" ]; networkmanager.enable = true; hosts = { diff --git a/modules/notifications/default.nix b/modules/notifications/default.nix new file mode 100644 index 0000000..8447a1e --- /dev/null +++ b/modules/notifications/default.nix @@ -0,0 +1,50 @@ +{ pkgs, lib, ... }: +let + ntfyCfg = { + default-host = "http://192.168.0.117:3142"; + subscribe = [ + { + topic = "media_update"; + command = ''${notify} "$title" "$message"''; + } + { + topic = "ping"; + command = ''${notify} "PING: $title" "$message"''; + } + { + topic = "jellyseer"; + command = ''${notify} "$(echo "$m" | ${jq} -r .title)" "$(echo "$m" | ${jq} -r .body)"''; + } + { + topic = "grafana_alert"; + command = ''${notify} "Grafana alert" "$message"''; + } + ]; + }; + sudo = "${pkgs.sudo}/bin/sudo"; + jq = "${pkgs.jq}/bin/jq"; + notify = "${sudo} -u imsohexy ${pkgs.libnotify}/bin/notify-send -a ntfy"; +in +{ + environment.systemPackages = with pkgs; [ ntfy-sh ]; + + systemd.services.ntfy-client = { + unitConfig = { + Description = "ntfy client"; + After = "network.service"; + }; + + serviceConfig = let + ntfyCfgFile = pkgs.writeText "client.yml" (lib.generators.toYAML {} ntfyCfg); + in { + ExecStart = "${pkgs.ntfy-sh}/bin/ntfy subscribe --config ${ntfyCfgFile} --from-config"; + Restart = "on-failure"; + Environment = lib.concatStringsSep " " [ + "PATH=${pkgs.dbus}/bin:${pkgs.libnotify}/bin:/bin:/usr/bin" + "DISPLAY=:0" + ]; + }; + + wantedBy = ["multi-user.target"]; + }; +} diff --git a/packages.nix b/packages.nix index 294a64f..a397e64 100644 --- a/packages.nix +++ b/packages.nix @@ -101,7 +101,7 @@ let wyrd dua - # (builtins.getFlake "github:phenax/chelleport/5262d942c4c2c36529fbe704e7de165044e6dc99").packages.x86_64-linux.default + (builtins.getFlake "github:phenax/chelleport/bf57e4968d059b207c036b57818a58ed8c54d141").packages.x86_64-linux.default # (builtins.getFlake "github:phenax/draw-stuff-on-your-screen/6e0e1f6ee603045cac5bb5d9d75d80c9ddef6c6e").packages.x86_64-linux.default (pkgs.writeShellScriptBin "null-browser" @@ -157,6 +157,7 @@ let arandr xorg.xgamma v4l-utils + hsetroot libva libdrm |
