From 3693f8f2b860b0742c6afe3817a3185ebaf8873b Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 2 Feb 2023 15:24:04 +0100 Subject: tv urlwatch exec: use dict-based filter list Because string-based filter definitions are deprecated since 2.19 Refs https://urlwatch.readthedocs.io/en/latest/deprecated.html --- tv/2configs/urlwatch.nix | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'tv/2configs') diff --git a/tv/2configs/urlwatch.nix b/tv/2configs/urlwatch.nix index 7ba364f..e2cd199 100644 --- a/tv/2configs/urlwatch.nix +++ b/tv/2configs/urlwatch.nix @@ -2,9 +2,10 @@ with import ./lib; { config, pkgs, ... }: let exec = filename: args: url: { inherit url; - filter = "system:${ - concatMapStringsSep " " shell.escape ([filename] ++ toList args) - }"; + filter = singleton { + system = + concatMapStringsSep " " shell.escape ([filename] ++ toList args); + }; }; json = json' ["."]; json' = exec "${pkgs.jq}/bin/jq"; @@ -73,17 +74,23 @@ in { import subprocess import urlwatch - class CaseFilter(urlwatch.filters.FilterBase): + class SystemFilter(urlwatch.filters.FilterBase): """Filter for piping data through an external process""" __kind__ = 'system' + __supported_subfilters__ = { + 'command': 'shell command line to tranform data', + } + + __default_subfilter__ = 'command' + def filter(self, data, subfilter=None): - if subfilter is None: - raise ValueError('The system filter needs a command') + if 'command' not in subfilter: + raise ValueError('{} filter needs a command'.format(self.__kind__)) proc = subprocess.Popen( - subfilter, + subfilter['command'], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, -- cgit v1.2.3 From e5d334ea76fc3d4c680ed900299e5c07247cd498 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 2 Feb 2023 14:28:13 +0100 Subject: tv urlwatch: add samsung consumer-storage tools --- tv/2configs/urlwatch.nix | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tv/2configs') diff --git a/tv/2configs/urlwatch.nix b/tv/2configs/urlwatch.nix index e2cd199..f5260ee 100644 --- a/tv/2configs/urlwatch.nix +++ b/tv/2configs/urlwatch.nix @@ -9,6 +9,9 @@ with import ./lib; }; json = json' ["."]; json' = exec "${pkgs.jq}/bin/jq"; + urigrep' = exec (pkgs.writeDash "urigrep" '' + ${pkgs.urix}/bin/urix | ${pkgs.gnugrep}/bin/grep -E "$1" + ''); xml = xml' ["--format" "-"]; xml' = exec "${pkgs.libxml2}/bin/xmllint"; in { @@ -69,6 +72,8 @@ in { https://raw.githubusercontent.com/NixOS/nixpkgs/master/nixos/modules/services/x11/xserver.nix https://www.rabbitmq.com/changelog.html + + (urigrep' ["software-resources"] https://semiconductor.samsung.com/consumer-storage/support/tools/) ]; hooksFile = toFile "hooks.py" '' import subprocess -- cgit v1.2.3 From 25b5811664f358e0441d5c153028ab1696c3c725 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 2 Feb 2023 16:29:23 +0100 Subject: tv wiregrill: init --- tv/2configs/wiregrill.nix | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tv/2configs/wiregrill.nix (limited to 'tv/2configs') diff --git a/tv/2configs/wiregrill.nix b/tv/2configs/wiregrill.nix new file mode 100644 index 0000000..d28a1ec --- /dev/null +++ b/tv/2configs/wiregrill.nix @@ -0,0 +1,37 @@ +with import ./lib; +{ config, pkgs, ... }: let + cfg = { + enable = cfg.net != null; + net = config.krebs.build.host.nets.wiregrill or null; + }; + toCidrNotation = ip: "${ip.addr}/${toString ip.prefixLength}"; +in + mkIf cfg.enable { + networking.wireguard.interfaces.wiregrill = { + ips = + optional (cfg.net.ip4 != null) cfg.net.ip4.addr ++ + optional (cfg.net.ip6 != null) cfg.net.ip6.addr; + listenPort = 51820; + privateKeyFile = (toString ) + "/wiregrill.key"; + allowedIPsAsRoutes = true; + peers = mapAttrsToList + (_: host: { + allowedIPs = host.nets.wiregrill.wireguard.subnets; + endpoint = + mkIf (host.nets.wiregrill.via != null) (host.nets.wiregrill.via.ip4.addr + ":${toString host.nets.wiregrill.wireguard.port}"); + persistentKeepalive = mkIf (host.nets.wiregrill.via != null) 61; + publicKey = + replaceStrings ["\n"] [""] host.nets.wiregrill.wireguard.pubkey; + }) + (filterAttrs (_: h: hasAttr "wiregrill" h.nets) config.krebs.hosts); + }; + systemd.network.networks.wiregrill = { + matchConfig.Name = "wiregrill"; + address = + optional (!isNull cfg.net.ip4) (toCidrNotation cfg.net.ip4) ++ + optional (!isNull cfg.net.ip6) (toCidrNotation cfg.net.ip6); + }; + tv.iptables.extra.filter.INPUT = [ + "-p udp --dport ${toString cfg.net.wireguard.port} -j ACCEPT" + ]; + } -- cgit v1.2.3 From eee4db26e0a84e0bf0fab7895eb3eaec2946960f Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 2 Feb 2023 16:50:29 +0100 Subject: tv: add default networking.hostId --- tv/2configs/default.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'tv/2configs') diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index d138484..53b11c6 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -6,6 +6,7 @@ with import ./lib; krebs.build.user = config.krebs.users.tv; + networking.hostId = mkDefault (hashToLength 8 config.networking.hostName); networking.hostName = config.krebs.build.host.name; imports = [ -- cgit v1.2.3 From 3d3dfcbb476c5ff214aa1cbdc973481fde5856d0 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 3 Feb 2023 02:40:28 +0100 Subject: tv wiregrill: remove extra ! --- tv/2configs/wiregrill.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tv/2configs') diff --git a/tv/2configs/wiregrill.nix b/tv/2configs/wiregrill.nix index d28a1ec..edf65e9 100644 --- a/tv/2configs/wiregrill.nix +++ b/tv/2configs/wiregrill.nix @@ -28,8 +28,8 @@ in systemd.network.networks.wiregrill = { matchConfig.Name = "wiregrill"; address = - optional (!isNull cfg.net.ip4) (toCidrNotation cfg.net.ip4) ++ - optional (!isNull cfg.net.ip6) (toCidrNotation cfg.net.ip6); + optional (cfg.net.ip4 != null) (toCidrNotation cfg.net.ip4) ++ + optional (cfg.net.ip6 != null) (toCidrNotation cfg.net.ip6); }; tv.iptables.extra.filter.INPUT = [ "-p udp --dport ${toString cfg.net.wireguard.port} -j ACCEPT" -- cgit v1.2.3 From 5cfd880000c9af2bb75f55fa83baae4f006facf7 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 5 Feb 2023 02:28:29 +0100 Subject: tv flameshot-once-tv: init --- tv/2configs/xserver/default.nix | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'tv/2configs') diff --git a/tv/2configs/xserver/default.nix b/tv/2configs/xserver/default.nix index f534b55..f10ccb1 100644 --- a/tv/2configs/xserver/default.nix +++ b/tv/2configs/xserver/default.nix @@ -120,13 +120,7 @@ in { }; path = [ config.tv.slock.package - (pkgs.flameshot-once.override { - config.imgur.enable = true; - config.imgur.createUrl = "http://ni.r/image"; - config.imgur.deleteUrl = "http://ni.r/image/delete/%1"; - config.imgur.xdg-open.browser = "/etc/profiles/per-user/tv/bin/cr"; - config.timeout = 200; - }) + pkgs.flameshot-once-tv pkgs.pulseaudio.out pkgs.rxvt_unicode pkgs.xcalib -- cgit v1.2.3 From e3d95efef02f21b080ad0e7165fd9541b2c1ead1 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 5 Feb 2023 00:55:29 +0100 Subject: tv gitrepos: move flameshot-once to museum --- tv/2configs/gitrepos.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tv/2configs') diff --git a/tv/2configs/gitrepos.nix b/tv/2configs/gitrepos.nix index d8e7755..eb87f26 100644 --- a/tv/2configs/gitrepos.nix +++ b/tv/2configs/gitrepos.nix @@ -74,9 +74,6 @@ with import ./lib; disko = { cgit.desc = "declarative partitioning and formatting tool"; }; - flameshot-once = { - cgit.desc = "flameshot runner that automatically starts/stops the daemon"; - }; fswm = { cgit.desc = "simple full screen window manager"; }; @@ -139,6 +136,9 @@ with import ./lib; cgserver = {}; crude-mail-setup = {}; dot-xmonad = {}; + flameshot-once = { + cgit.desc = "flameshot runner that automatically starts/stops the daemon"; + }; hirc = {}; hstool = { cgit.desc = "Haskell Development Environment ^_^"; -- cgit v1.2.3