diff options
-rw-r--r-- | makefu/1systems/gum/config.nix | 2 | ||||
-rw-r--r-- | makefu/1systems/gum/hetzner/default.nix (renamed from makefu/1systems/gum/hardware-config.nix) | 3 | ||||
-rw-r--r-- | makefu/1systems/x/config.nix | 3 | ||||
-rw-r--r-- | makefu/2configs/deployment/rss/ebk.yml | 59 | ||||
-rwxr-xr-x | makefu/2configs/deployment/rss/ratt-hourly.sh | 28 | ||||
-rw-r--r-- | makefu/2configs/deployment/rss/ratt.nix | 26 | ||||
-rw-r--r-- | makefu/2configs/deployment/rss/rss.euer.krebsco.de.nix (renamed from makefu/2configs/deployment/rss.euer.krebsco.de.nix) | 6 | ||||
-rw-r--r-- | makefu/2configs/deployment/rss/urls | 5 | ||||
-rw-r--r-- | makefu/2configs/tools/consoles.nix | 1 | ||||
-rw-r--r-- | makefu/5pkgs/ns-usbloader/default.nix | 35 |
10 files changed, 165 insertions, 3 deletions
diff --git a/makefu/1systems/gum/config.nix b/makefu/1systems/gum/config.nix index 540106004..0cdfcda4b 100644 --- a/makefu/1systems/gum/config.nix +++ b/makefu/1systems/gum/config.nix @@ -32,8 +32,6 @@ in { # <stockholm/makefu/2configs/stats/netdata-server.nix> <stockholm/makefu/2configs/headless.nix> - <stockholm/makefu/2configs/smart-monitor.nix> - { services.smartd.devices = builtins.map (x: { device = x; }) allDisks; } # Security <stockholm/makefu/2configs/sshd-totp.nix> diff --git a/makefu/1systems/gum/hardware-config.nix b/makefu/1systems/gum/hetzner/default.nix index 1881329ce..7d445879a 100644 --- a/makefu/1systems/gum/hardware-config.nix +++ b/makefu/1systems/gum/hetzner/default.nix @@ -18,6 +18,9 @@ let ext-if = "et0"; # gets renamed on the fly in { imports = [ + <stockholm/makefu/2configs/smart-monitor.nix> + { services.smartd.devices = builtins.map (x: { device = x; }) allDisks; } + ]; makefu.server.primary-itf = ext-if; services.udev.extraRules = '' diff --git a/makefu/1systems/x/config.nix b/makefu/1systems/x/config.nix index 3edfcecc1..4f5fe44b5 100644 --- a/makefu/1systems/x/config.nix +++ b/makefu/1systems/x/config.nix @@ -13,7 +13,7 @@ # ./x230 # Common Hardware Components - + <nix-ld/modules/nix-ld.nix> # <stockholm/makefu/2configs/hw/mceusb.nix> # <stockholm/makefu/2configs/hw/rtl8812au.nix> <stockholm/makefu/2configs/hw/network-manager.nix> @@ -26,6 +26,7 @@ <stockholm/makefu/2configs/hw/droidcam.nix> <stockholm/makefu/2configs/hw/smartcard.nix> <stockholm/makefu/2configs/hw/upower.nix> + <stockholm/makefu/2configs/hw/nswitch.nix> #<stockholm/makefu/2configs/hw/ps4-compat.nix> # base diff --git a/makefu/2configs/deployment/rss/ebk.yml b/makefu/2configs/deployment/rss/ebk.yml new file mode 100644 index 000000000..3248f5c4e --- /dev/null +++ b/makefu/2configs/deployment/rss/ebk.yml @@ -0,0 +1,59 @@ +regex: https://www.ebay\-kleinanzeigen.de/s\-.* +selectors: + httpsettings: + cookie: {} + header: {} + useragent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) + Chrome/90.0.4430.72 Safari/537.36 + insecure: false + feed: + title: title + authorname: "" + authoremail: "" + item: + container: ul[id='srchrslt-adtable'] li[class='ad-listitem lazyload-item '] + title: | + title = sel:find("h2.text-module-begin"):first():text():gsub("^%s*(.-)%s*$", "%1") + print(title) + link: | + link = sel:find("a"):first():attr("href") + print("https://www.ebay-kleinanzeigen.de" .. link) + created: |- + created = "" + sel:find("div.aditem-main--top--right"):each(function(i, s) + created = s:text():gsub("^%s*(.-)%s*$", "%1") + end) + if created:match("Heute") then + time = created:gsub("^.*,", "") + print(os.date("%d.%m.%Y") .. time .. " CET") + return + end + if created:match("Gestern") then + time = created:gsub("^.*,", "") + print(os.date("%d.%m.%Y", os.time()-24*60*60) .. time .. " CET") + return + end + if created:match("\.") then + print(created .. " 00:00 CET") + return + end + createdformat: 02.01.2006 15:04 MST + description: |- + description = sel:find(".aditem-main--middle"):html() + place = sel:find(".aditem-main--top--left"):html() + print(description .. place) + content: "" + image: | + img = sel:find("div.imagebox"):first():attr("data-imgsrc") + if img ~= "" then + -- prepend host if needed + if not(img:match("https*:\/\/.*")) then + img = "https://www.ebay-kleinanzeigen.de" .. img + end + print(img) + end + nextpage: | + nextpage = sel:find("link[rel=next]"):attr("href") + print("https://www.ebay-kleinanzeigen.de" .. nextpage) + nextpagecount: 5 + sort: "" diff --git a/makefu/2configs/deployment/rss/ratt-hourly.sh b/makefu/2configs/deployment/rss/ratt-hourly.sh new file mode 100755 index 000000000..67f2529bd --- /dev/null +++ b/makefu/2configs/deployment/rss/ratt-hourly.sh @@ -0,0 +1,28 @@ +#!/bin/sh +set -eu +URLS=${1?must provide URLS file} +OUTFILE=${2:-all.xml} + +echo "init, writing to $OUTFILE" + +cat > "$OUTFILE" <<EOF +<?xml version="1.0" encoding="UTF-8"?> +<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"> + <channel> + <title>makefu Ebay Kleinanzeigen</title> + <link>https://www.ebay-kleinanzeigen.de/</link> + <description>Feed for all kleinanzeigen</description> + <pubDate>$(date '+%a, %d %b %Y %H:%M:%S %z')</pubDate> +EOF +echo "looping through $URLS" +cat "$URLS" | while read line;do + echo "fetching $line" + ratt auto "$line" | \ + xmlstarlet sel -t -c "//item" >> "$OUTFILE" || : +done + +echo "close" +cat >> "$OUTFILE" <<EOF + </channel> +</rss> +EOF diff --git a/makefu/2configs/deployment/rss/ratt.nix b/makefu/2configs/deployment/rss/ratt.nix new file mode 100644 index 000000000..b794d9201 --- /dev/null +++ b/makefu/2configs/deployment/rss/ratt.nix @@ -0,0 +1,26 @@ +{ pkgs, lib, config, ... }: +let + fqdn = "rss.euer.krebsco.de"; + ratt-path = "/var/lib/ratt/"; + out-path = "${ratt-path}/all.xml"; +in { + systemd.tmpfiles.rules = ["d ${ratt-path} 0750 nginx nginx - -" ]; + systemd.services.run-ratt = { + enable = true; + path = with pkgs; [ "/nix/store/vhmzblnaav2lp4lwqdgm13l55qlm79mk-ratt-unstable-2022-01-11" xmlstarlet ]; + script = builtins.readFile ./ratt-hourly.sh; + scriptArgs = "${./urls} ${out-path}"; + + preStart = "install -v -m750 ${./ebk.yml} ${ratt-path}/ebk.yml"; # ratt requires the config file in the cwd + serviceConfig.User = "nginx"; + serviceConfig.WorkingDirectory= ratt-path; + startAt = "00/3:07"; # every 3 hours, fetch latest + }; + + services.nginx.virtualHosts."${fqdn}" = { + locations."=/ratt/all.xml" = { + alias = out-path; + }; + }; +} + diff --git a/makefu/2configs/deployment/rss.euer.krebsco.de.nix b/makefu/2configs/deployment/rss/rss.euer.krebsco.de.nix index 19f20f50f..e64a69d9c 100644 --- a/makefu/2configs/deployment/rss.euer.krebsco.de.nix +++ b/makefu/2configs/deployment/rss/rss.euer.krebsco.de.nix @@ -1,7 +1,9 @@ { pkgs, lib, config, ... }: let fqdn = "rss.euer.krebsco.de"; + ratt-path = "/var/lib/ratt/"; in { + systemd.tmpfiles.rules = ["d ${ratt-path} 0750 nginx nginx - -" ]; services.tt-rss = { enable = true; virtualHost = fqdn; @@ -19,6 +21,10 @@ in { services.nginx.virtualHosts."${fqdn}" = { enableACME = true; forceSSL = true; + locations."/ratt/" = { + alias = ratt-path; + extraConfig = "autoindex on;"; + }; }; } diff --git a/makefu/2configs/deployment/rss/urls b/makefu/2configs/deployment/rss/urls new file mode 100644 index 000000000..12d4c092a --- /dev/null +++ b/makefu/2configs/deployment/rss/urls @@ -0,0 +1,5 @@ +https://www.ebay-kleinanzeigen.de/s-muehlhausen/preis:0:45/duplo-eisenbahn/k0l9313r5 +https://www.ebay-kleinanzeigen.de/s-heimwerken/nein/muehlhausen/bohrmaschine/k0c84l9313r5+heimwerken.versand_s:nein +https://www.ebay-kleinanzeigen.de/s-stuttgart/zigbee/k0l9280 +https://www.ebay-kleinanzeigen.de/s-stuttgart/ikea-tradfri-fernbedienung/k0l9280 +https://www.ebay-kleinanzeigen.de/s-70378/d%C3%B6rrautomat/k0l9334r5 diff --git a/makefu/2configs/tools/consoles.nix b/makefu/2configs/tools/consoles.nix index 7d58daa3f..f213a9b0e 100644 --- a/makefu/2configs/tools/consoles.nix +++ b/makefu/2configs/tools/consoles.nix @@ -15,6 +15,7 @@ nx_game_info hactool nsrenamer + ns-usbloader sfo exfatprogs exfat-utils exfat ]; diff --git a/makefu/5pkgs/ns-usbloader/default.nix b/makefu/5pkgs/ns-usbloader/default.nix new file mode 100644 index 000000000..b3890d11b --- /dev/null +++ b/makefu/5pkgs/ns-usbloader/default.nix @@ -0,0 +1,35 @@ +{ lib, stdenv, fetchurl, makeWrapper, wrapGAppsHook, glib , jre }: + +stdenv.mkDerivation rec { + name = "ns-usbloader-${version}"; + version = "5.2"; + + src = fetchurl { + url = "https://github.com/developersu/ns-usbloader/releases/download/v${version}/ns-usbloader-${version}.jar"; + sha256 = "06kzshlvqfwcjjddzqqgq13pqa5qjlajpyn6ksqxy5p5hgarj6i6"; + }; + + + buildInputs = [ jre ]; + + dontUnpack = true; + + installPhase = '' + runHook preInstall + install -D $src $out/ns-usbloader/ns-usbloader.jar + makeWrapper ${jre}/bin/java $out/bin/ns-usbloader \ + --add-flags "-jar $out/ns-usbloader/ns-usbloader.jar" + runHook postInstall + ''; + nativeBuildInputs = [ glib wrapGAppsHook makeWrapper ]; + + + meta = with lib; { + description = "Awoo Installer and GoldLeaf uploader of the NSPs (and other files), RCM payload injector, application for split/merge files"; + homepage = https://github.com/developersu/ns-usbloader; + maintainers = [ maintainers.makefu ]; + platforms = platforms.linux; + license = with licenses; [ gpl3 ]; + }; + +} |