~jb55/citadel

cb7000756f32cda930119608f0842cb11413cc29 — William Casarin 1 year, 1 month ago 45e53c7
make notifications work on all desktops
M nix-config/configuration.nix => nix-config/configuration.nix +1 -0
@@ 60,6 60,7 @@ in {
      (import (machinePath "") extra)
    ] ++ (if isDesktop then [
      (import ./hardware/desktop extra)
      (import ./networking/desktop extra)
      # ./wayland
      (import ./fonts extra)
      (import ./environment/desktop { inherit userConfig theme icon-theme extra; })

M nix-config/machines/monad/default.nix => nix-config/machines/monad/default.nix +0 -13
@@ 146,19 146,6 @@ in
  # shitcoin vendor
  services.keybase.enable = false;

  systemd.user.services.udp-notify-daemon = {
    enable = true;
    description = "udp notification daemon";
    wantedBy = [ "default.target" ];
    after    = [ "default.target" ];

    path = with pkgs; [ bash gnupg libnotify ];

    serviceConfig.ExecStart = util.writeBash "notify-daemon" ''
      exec ${pkgs.socat}/bin/socat -d -d udp4-recvfrom:${toString extra.private.notify-port},reuseaddr,fork exec:/home/jb55/bin/recvalert
    '';
  };

  systemd.services.block-distracting-hosts = {
    description = "Block Distracting Hosts";


M nix-config/machines/monad/networking/default.nix => nix-config/machines/monad/networking/default.nix +0 -1
@@ 24,7 24,6 @@ let
  };

  firewallRules = [
    "nixos-fw -s 10.100.0.1/24,45.79.91.128,192.168.86.0/24 -p udp --dport ${toString ports.notify-port} -j nixos-fw-accept"
    "nixos-fw -s 192.168.122.218 -p udp --dport 137 -j nixos-fw-accept"
    "nixos-fw -s 192.168.122.218 -p udp --dport 138 -j nixos-fw-accept"
    "nixos-fw -s 192.168.122.218 -p tcp --dport 139 -j nixos-fw-accept"

A nix-config/networking/desktop/default.nix => nix-config/networking/desktop/default.nix +20 -0
@@ 0,0 1,20 @@
extra:
{ config, lib, pkgs, ... }:
let
  ports = {
    notify = extra.private.notify-port;
  };

  firewallRules = [
    "nixos-fw -s 10.100.0.1/24,45.79.91.128 -p udp --dport ${toString ports.notify} -j nixos-fw-accept"
  ];

  addRule = rule: "iptables -A ${rule}";
  rmRule = rule: "iptables -D ${rule} || true";
  extraCommands = lib.concatStringsSep "\n" (map addRule firewallRules);
  extraStopCommands = lib.concatStringsSep "\n" (map rmRule firewallRules);
in
{
  networking.firewall.extraCommands = extraCommands;
  networking.firewall.extraStopCommands = extraStopCommands;
}

M nix-config/services/desktop/default.nix => nix-config/services/desktop/default.nix +13 -0
@@ 99,6 99,19 @@ in
    };
  };

  systemd.user.services.udp-notify-daemon = {
    enable = true;
    description = "udp notification daemon";
    wantedBy = [ "default.target" ];
    after    = [ "default.target" ];

    path = with pkgs; [ bash gnupg libnotify ];

    serviceConfig.ExecStart = util.writeBash "notify-daemon" ''
      exec ${pkgs.socat}/bin/socat -d -d udp4-recvfrom:${toString extra.private.notify-port},reuseaddr,fork exec:/home/jb55/bin/recvalert
    '';
  };

  systemd.user.services.kindle-sync3 = {
    enable = false;
    description = "sync kindle";