From 581245ed35bde63a8691c5f5a059cc647b2e88ec Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 28 Mar 2022 18:04:24 +0200 Subject: ma gum.r: move smartd monitor to hw-specific config --- makefu/1systems/gum/config.nix | 2 - makefu/1systems/gum/hardware-config.nix | 113 ------------------------------- makefu/1systems/gum/hetzner/default.nix | 116 ++++++++++++++++++++++++++++++++ 3 files changed, 116 insertions(+), 115 deletions(-) delete mode 100644 makefu/1systems/gum/hardware-config.nix create mode 100644 makefu/1systems/gum/hetzner/default.nix 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 { # - - { services.smartd.devices = builtins.map (x: { device = x; }) allDisks; } # Security diff --git a/makefu/1systems/gum/hardware-config.nix b/makefu/1systems/gum/hardware-config.nix deleted file mode 100644 index 1881329ce..000000000 --- a/makefu/1systems/gum/hardware-config.nix +++ /dev/null @@ -1,113 +0,0 @@ -{ config, ... }: -let - external-mac = "50:46:5d:9f:63:6b"; - main-disk = "/dev/disk/by-id/ata-TOSHIBA_DT01ACA300_13H8863AS"; - sec-disk = "/dev/disk/by-id/ata-TOSHIBA_DT01ACA300_23OJ2GJAS"; - external-gw = "144.76.26.225"; - # single partition, label "nixos" - # cd /var/src; curl https://github.com/nixos/nixpkgs/tarball/809cf38 -L | tar zx ; mv * nixpkgs && touch .populate - - - # static - external-ip = "144.76.26.247"; - external-ip6 = "2a01:4f8:191:12f6::2"; - external-gw6 = "fe80::1"; - external-netmask = 27; - external-netmask6 = 64; - internal-ip = config.krebs.build.host.nets.retiolum.ip4.addr; - ext-if = "et0"; # gets renamed on the fly -in { - imports = [ - ]; - makefu.server.primary-itf = ext-if; - services.udev.extraRules = '' - SUBSYSTEM=="net", ATTR{address}=="${external-mac}", NAME="${ext-if}" - ''; - networking = { - interfaces."${ext-if}" = { - ipv4.addresses = [{ - address = external-ip; - prefixLength = external-netmask; - }]; - ipv6.addresses = [{ - address = external-ip6; - prefixLength = external-netmask6; - }]; - }; - defaultGateway6 = { address = external-gw6; interface = ext-if; }; - defaultGateway = external-gw; - }; - boot.kernelParams = [ ]; - boot.loader.grub.enable = true; - boot.loader.grub.version = 2; - boot.loader.grub.devices = [ main-disk ]; - boot.initrd.kernelModules = [ "dm-raid" "dm_cache" "dm-thin-pool" ]; - boot.initrd.availableKernelModules = [ - "ata_piix" "vmw_pvscsi" "virtio_pci" "sd_mod" "ahci" - "xhci_pci" "ehci_pci" "ahci" "sd_mod" - ]; - boot.kernelModules = [ "dm-raid" "dm_cache" "dm-thin-pool" "kvm-intel" ]; - hardware.enableRedistributableFirmware = true; - fileSystems."/" = { - device = "/dev/nixos/root"; - fsType = "ext4"; - }; - fileSystems."/var/lib" = { - device = "/dev/nixos/lib"; - fsType = "ext4"; - }; - fileSystems."/var/log" = { - device = "/dev/nixos/log"; - fsType = "ext4"; - }; - fileSystems."/var/download" = { - device = "/dev/nixos/download"; - fsType = "ext4"; - }; - fileSystems."/var/www/binaergewitter" = { - device = "/dev/nixos/binaergewitter"; - fsType = "ext4"; - options = [ "nofail" ]; - }; - fileSystems."/var/lib/nextcloud/data" = { - device = "/dev/nixos/nextcloud"; - fsType = "ext4"; - options = [ "nofail" ]; - }; - fileSystems."/var/lib/borgbackup" = { - device = "/dev/nixos/backup"; - fsType = "ext4"; - }; - fileSystems."/boot" = { - device = "/dev/sda2"; - fsType = "vfat"; - }; - # parted -s -a optimal "$disk" \ - # mklabel gpt \ - # mkpart no-fs 0 1024KiB \ - # set 1 bios_grub on \ - # mkpart ESP fat32 1025KiB 1024MiB set 2 boot on \ - # mkpart primary 1025MiB 100% - # parted -s -a optimal "/dev/sdb" \ - # mklabel gpt \ - # mkpart primary 1M 100% - - #mkfs.vfat /dev/sda2 - #pvcreate /dev/sda3 - #pvcreate /dev/sdb1 - #vgcreate nixos /dev/sda3 /dev/sdb1 - #lvcreate -L 120G -m 1 -n root nixos - #lvcreate -L 50G -m 1 -n lib nixos - #lvcreate -L 100G -n download nixos - #lvcreate -L 100G -n backup nixos - #mkfs.ext4 /dev/mapper/nixos-root - #mkfs.ext4 /dev/mapper/nixos-lib - #mkfs.ext4 /dev/mapper/nixos-download - #mkfs.ext4 /dev/mapper/nixos-borgbackup - #mount /dev/mapper/nixos-root /mnt - #mkdir /mnt/boot - #mount /dev/sda2 /mnt/boot - #mkdir -p /mnt/var/src - #touch /mnt/var/src/.populate - -} diff --git a/makefu/1systems/gum/hetzner/default.nix b/makefu/1systems/gum/hetzner/default.nix new file mode 100644 index 000000000..7d445879a --- /dev/null +++ b/makefu/1systems/gum/hetzner/default.nix @@ -0,0 +1,116 @@ +{ config, ... }: +let + external-mac = "50:46:5d:9f:63:6b"; + main-disk = "/dev/disk/by-id/ata-TOSHIBA_DT01ACA300_13H8863AS"; + sec-disk = "/dev/disk/by-id/ata-TOSHIBA_DT01ACA300_23OJ2GJAS"; + external-gw = "144.76.26.225"; + # single partition, label "nixos" + # cd /var/src; curl https://github.com/nixos/nixpkgs/tarball/809cf38 -L | tar zx ; mv * nixpkgs && touch .populate + + + # static + external-ip = "144.76.26.247"; + external-ip6 = "2a01:4f8:191:12f6::2"; + external-gw6 = "fe80::1"; + external-netmask = 27; + external-netmask6 = 64; + internal-ip = config.krebs.build.host.nets.retiolum.ip4.addr; + ext-if = "et0"; # gets renamed on the fly +in { + imports = [ + + { services.smartd.devices = builtins.map (x: { device = x; }) allDisks; } + + ]; + makefu.server.primary-itf = ext-if; + services.udev.extraRules = '' + SUBSYSTEM=="net", ATTR{address}=="${external-mac}", NAME="${ext-if}" + ''; + networking = { + interfaces."${ext-if}" = { + ipv4.addresses = [{ + address = external-ip; + prefixLength = external-netmask; + }]; + ipv6.addresses = [{ + address = external-ip6; + prefixLength = external-netmask6; + }]; + }; + defaultGateway6 = { address = external-gw6; interface = ext-if; }; + defaultGateway = external-gw; + }; + boot.kernelParams = [ ]; + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + boot.loader.grub.devices = [ main-disk ]; + boot.initrd.kernelModules = [ "dm-raid" "dm_cache" "dm-thin-pool" ]; + boot.initrd.availableKernelModules = [ + "ata_piix" "vmw_pvscsi" "virtio_pci" "sd_mod" "ahci" + "xhci_pci" "ehci_pci" "ahci" "sd_mod" + ]; + boot.kernelModules = [ "dm-raid" "dm_cache" "dm-thin-pool" "kvm-intel" ]; + hardware.enableRedistributableFirmware = true; + fileSystems."/" = { + device = "/dev/nixos/root"; + fsType = "ext4"; + }; + fileSystems."/var/lib" = { + device = "/dev/nixos/lib"; + fsType = "ext4"; + }; + fileSystems."/var/log" = { + device = "/dev/nixos/log"; + fsType = "ext4"; + }; + fileSystems."/var/download" = { + device = "/dev/nixos/download"; + fsType = "ext4"; + }; + fileSystems."/var/www/binaergewitter" = { + device = "/dev/nixos/binaergewitter"; + fsType = "ext4"; + options = [ "nofail" ]; + }; + fileSystems."/var/lib/nextcloud/data" = { + device = "/dev/nixos/nextcloud"; + fsType = "ext4"; + options = [ "nofail" ]; + }; + fileSystems."/var/lib/borgbackup" = { + device = "/dev/nixos/backup"; + fsType = "ext4"; + }; + fileSystems."/boot" = { + device = "/dev/sda2"; + fsType = "vfat"; + }; + # parted -s -a optimal "$disk" \ + # mklabel gpt \ + # mkpart no-fs 0 1024KiB \ + # set 1 bios_grub on \ + # mkpart ESP fat32 1025KiB 1024MiB set 2 boot on \ + # mkpart primary 1025MiB 100% + # parted -s -a optimal "/dev/sdb" \ + # mklabel gpt \ + # mkpart primary 1M 100% + + #mkfs.vfat /dev/sda2 + #pvcreate /dev/sda3 + #pvcreate /dev/sdb1 + #vgcreate nixos /dev/sda3 /dev/sdb1 + #lvcreate -L 120G -m 1 -n root nixos + #lvcreate -L 50G -m 1 -n lib nixos + #lvcreate -L 100G -n download nixos + #lvcreate -L 100G -n backup nixos + #mkfs.ext4 /dev/mapper/nixos-root + #mkfs.ext4 /dev/mapper/nixos-lib + #mkfs.ext4 /dev/mapper/nixos-download + #mkfs.ext4 /dev/mapper/nixos-borgbackup + #mount /dev/mapper/nixos-root /mnt + #mkdir /mnt/boot + #mount /dev/sda2 /mnt/boot + #mkdir -p /mnt/var/src + #touch /mnt/var/src/.populate + +} -- cgit v1.3.1 From 4156d2ed156f1b8304aba7888337173c53998499 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 28 Mar 2022 18:04:33 +0200 Subject: ma pkgs.ns-usbloader: init --- makefu/2configs/tools/consoles.nix | 1 + makefu/5pkgs/ns-usbloader/default.nix | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 makefu/5pkgs/ns-usbloader/default.nix 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..42e12e38e --- /dev/null +++ b/makefu/5pkgs/ns-usbloader/default.nix @@ -0,0 +1,35 @@ +{ lib, stdenv, fetchurl, makeWrapper, 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"; + }; + + + nativeBuildInputs = [ makeWrapper ]; + 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 + ''; + + + 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 ]; + }; + +} -- cgit v1.3.1 From c3adb252afa29f0140f29c935201cfbb100b5697 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 8 Apr 2022 19:49:07 +0200 Subject: ma pkgs.ns-usbloader: use wrapGappsHook --- makefu/1systems/x/config.nix | 3 ++- makefu/5pkgs/ns-usbloader/default.nix | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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 - + # # @@ -26,6 +26,7 @@ + # # base diff --git a/makefu/5pkgs/ns-usbloader/default.nix b/makefu/5pkgs/ns-usbloader/default.nix index 42e12e38e..b3890d11b 100644 --- a/makefu/5pkgs/ns-usbloader/default.nix +++ b/makefu/5pkgs/ns-usbloader/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, makeWrapper, jre }: +{ lib, stdenv, fetchurl, makeWrapper, wrapGAppsHook, glib , jre }: stdenv.mkDerivation rec { name = "ns-usbloader-${version}"; @@ -10,7 +10,6 @@ stdenv.mkDerivation rec { }; - nativeBuildInputs = [ makeWrapper ]; buildInputs = [ jre ]; dontUnpack = true; @@ -22,6 +21,7 @@ stdenv.mkDerivation rec { --add-flags "-jar $out/ns-usbloader/ns-usbloader.jar" runHook postInstall ''; + nativeBuildInputs = [ glib wrapGAppsHook makeWrapper ]; meta = with lib; { -- cgit v1.3.1 From 5187d0ac208deb06eff3bafb7ffd2fc32286b46a Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 2 May 2022 22:25:19 +0200 Subject: ma rss: deploy ratt job --- makefu/2configs/deployment/rss.euer.krebsco.de.nix | 24 --------- makefu/2configs/deployment/rss/ebk.yml | 59 ++++++++++++++++++++++ makefu/2configs/deployment/rss/ratt-hourly.sh | 28 ++++++++++ makefu/2configs/deployment/rss/ratt.nix | 26 ++++++++++ .../deployment/rss/rss.euer.krebsco.de.nix | 30 +++++++++++ makefu/2configs/deployment/rss/urls | 5 ++ 6 files changed, 148 insertions(+), 24 deletions(-) delete mode 100644 makefu/2configs/deployment/rss.euer.krebsco.de.nix create mode 100644 makefu/2configs/deployment/rss/ebk.yml create mode 100755 makefu/2configs/deployment/rss/ratt-hourly.sh create mode 100644 makefu/2configs/deployment/rss/ratt.nix create mode 100644 makefu/2configs/deployment/rss/rss.euer.krebsco.de.nix create mode 100644 makefu/2configs/deployment/rss/urls diff --git a/makefu/2configs/deployment/rss.euer.krebsco.de.nix b/makefu/2configs/deployment/rss.euer.krebsco.de.nix deleted file mode 100644 index 19f20f50f..000000000 --- a/makefu/2configs/deployment/rss.euer.krebsco.de.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ pkgs, lib, config, ... }: -let - fqdn = "rss.euer.krebsco.de"; -in { - services.tt-rss = { - enable = true; - virtualHost = fqdn; - selfUrlPath = "https://${fqdn}"; - }; - - services.postgresql.package = pkgs.postgresql_9_6; - state = [ config.services.postgresqlBackup.location ]; - - services.postgresqlBackup = { - enable = true; - databases = [ config.services.tt-rss.database.name ]; - }; - - services.nginx.virtualHosts."${fqdn}" = { - enableACME = true; - forceSSL = true; - }; -} - 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" < + + + makefu Ebay Kleinanzeigen + https://www.ebay-kleinanzeigen.de/ + Feed for all kleinanzeigen + $(date '+%a, %d %b %Y %H:%M:%S %z') +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 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/rss.euer.krebsco.de.nix b/makefu/2configs/deployment/rss/rss.euer.krebsco.de.nix new file mode 100644 index 000000000..e64a69d9c --- /dev/null +++ b/makefu/2configs/deployment/rss/rss.euer.krebsco.de.nix @@ -0,0 +1,30 @@ +{ 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; + selfUrlPath = "https://${fqdn}"; + }; + + services.postgresql.package = pkgs.postgresql_9_6; + state = [ config.services.postgresqlBackup.location ]; + + services.postgresqlBackup = { + enable = true; + databases = [ config.services.tt-rss.database.name ]; + }; + + 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 -- cgit v1.3.1 From 7e89bf587256e6148b2ed46e4da0ac818a1dd012 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 30 May 2022 12:56:29 +0200 Subject: ma gum.r: bind nextcloud data --- makefu/1systems/gum/config.nix | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/makefu/1systems/gum/config.nix b/makefu/1systems/gum/config.nix index 0cdfcda4b..f47289e06 100644 --- a/makefu/1systems/gum/config.nix +++ b/makefu/1systems/gum/config.nix @@ -133,6 +133,23 @@ in { # # Removed until move: avoid letsencrypt ban ### Web + + # postgres backend + # postgres backend + + + #postgres backend + ### Moving owncloud data dir to /media/cloud/nextcloud-data + { + users.users.nextcloud.extraGroups = [ "download" ]; + # nextcloud-setup fails as it cannot set permissions for nextcloud + systemd.services.nextcloud-setup.serviceConfig.SuccessExitStatus = "0 1"; + fileSystems."/var/lib/nextcloud/data" = { + device = "/media/cloud/nextcloud-data"; + options = [ "bind" ]; + }; + } + # @@ -148,7 +165,7 @@ in { # # - + # # -- cgit v1.3.1 From 12436ad8beefeb818954076432e469f34e831ad2 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 30 May 2022 12:56:43 +0200 Subject: ma omo.r: enable vaapi --- makefu/1systems/omo/config.nix | 3 ++- makefu/1systems/omo/hw/omo.nix | 4 +++- makefu/1systems/omo/hw/vaapi.nix | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 makefu/1systems/omo/hw/vaapi.nix diff --git a/makefu/1systems/omo/config.nix b/makefu/1systems/omo/config.nix index 42f335264..ee29c03d2 100644 --- a/makefu/1systems/omo/config.nix +++ b/makefu/1systems/omo/config.nix @@ -28,7 +28,7 @@ in { - + # @@ -98,6 +98,7 @@ in { + diff --git a/makefu/1systems/omo/hw/omo.nix b/makefu/1systems/omo/hw/omo.nix index ae5b778bf..eaedbb779 100644 --- a/makefu/1systems/omo/hw/omo.nix +++ b/makefu/1systems/omo/hw/omo.nix @@ -39,7 +39,9 @@ let in { imports = [ # TODO: unlock home partition via ssh - ]; + ./vaapi.nix + ]; + makefu.server.primary-itf = primaryInterface; system.activationScripts.createCryptFolders = '' ${lib.concatMapStringsSep "\n" diff --git a/makefu/1systems/omo/hw/vaapi.nix b/makefu/1systems/omo/hw/vaapi.nix new file mode 100644 index 000000000..8250d4110 --- /dev/null +++ b/makefu/1systems/omo/hw/vaapi.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: +{ + nixpkgs.config.packageOverrides = pkgs: { + vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; + }; + hardware.opengl = { + enable = true; + extraPackages = with pkgs; [ + intel-media-driver # LIBVA_DRIVER_NAME=iHD + vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) + vaapiVdpau + libvdpau-va-gl + ]; + }; + hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ vaapiIntel ]; + environment.systemPackages = [ pkgs.libva-utils ]; +} -- cgit v1.3.1 From cdc73d611ea140a7ba75a0e6ebc51860a8fad9a8 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 30 May 2022 12:57:12 +0200 Subject: ma iso.r: cleanup --- makefu/1systems/iso/config.nix | 18 +++++++++++------- makefu/1systems/iso/justdoit.nix | 18 +++++------------- makefu/1systems/iso/target-config.nix | 14 ++++++++++---- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/makefu/1systems/iso/config.nix b/makefu/1systems/iso/config.nix index 6c4f62310..207121236 100644 --- a/makefu/1systems/iso/config.nix +++ b/makefu/1systems/iso/config.nix @@ -9,17 +9,22 @@ with import ; # ./justdoit.nix { + environment.systemPackages = [ (pkgs.writeScriptBin "network-setup" '' + #!/bin/sh + ip addr add 178.254.30.202/255.255.252.0 dev ens3 + ip route add default via 178.254.28.1 + echo nameserver 1.1.1.1 > /etc/resolv.conf + '')]; kexec.justdoit = { - # bootSize = 512; - rootDevice = "/dev/sdb"; - swapSize = 1024; + bootSize = 512; + rootDevice = "/dev/vda"; bootType = "vfat"; - luksEncrypt = true; - uefi = true; + luksEncrypt = false; + uefi = false; }; } ]; - boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; + # boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; # TODO: NIX_PATH and nix.nixPath are being set by default.nix right now # cd ~/stockholm ; nix-build -A config.system.build.isoImage -I nixos-config=makefu/1systems/iso/config.nix -I secrets=/home/makefu/secrets/iso /var/src/nixpkgs/nixos #krebs.build.host = { cores = 0; }; @@ -33,7 +38,6 @@ with import ; EDITOR=vim ''; # iso-specific - boot.kernelParams = [ "copytoram" ]; services.openssh = { enable = true; hostKeys = [ diff --git a/makefu/1systems/iso/justdoit.nix b/makefu/1systems/iso/justdoit.nix index 7947953f9..0ce90494b 100644 --- a/makefu/1systems/iso/justdoit.nix +++ b/makefu/1systems/iso/justdoit.nix @@ -67,29 +67,22 @@ in { unit: sectors ${lib.optionalString (cfg.bootType != "zfs") "1 : size=${toString (2048 * cfg.bootSize)}, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4"} ${lib.optionalString (! cfg.uefi) "4 : size=4096, type=21686148-6449-6E6F-744E-656564454649"} - 2 : size=${toString (2048 * cfg.swapSize)}, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F - 3 : type=0FC63DAF-8483-4772-8E79-3D69D8477DE4 + 2 : type=0FC63DAF-8483-4772-8E79-3D69D8477DE4 EOF ${if cfg.luksEncrypt then '' cryptsetup luksFormat ${cfg.rootDevice}${x}2 - cryptsetup open --type luks ${cfg.rootDevice}${x}2 swap - cryptsetup luksFormat ${cfg.rootDevice}${x}3 - cryptsetup open --type luks ${cfg.rootDevice}${x}3 root + cryptsetup open --type luks ${cfg.rootDevice}${x}2 root export ROOT_DEVICE=/dev/mapper/root - export SWAP_DEVICE=/dev/mapper/swap '' else '' - export ROOT_DEVICE=${cfg.rootDevice}${x}3 - export SWAP_DEVICE=${cfg.rootDevice}${x}2 + export ROOT_DEVICE=${cfg.rootDevice}${x}2 ''} ${lib.optionalString (cfg.bootType != "zfs") "export NIXOS_BOOT=${cfg.rootDevice}${x}1"} mkdir -p /mnt ${mkBootTable.${cfg.bootType}} - mkswap $SWAP_DEVICE -L NIXOS_SWAP zpool create -o ashift=12 -o altroot=/mnt ${cfg.poolName} $ROOT_DEVICE zfs create -o mountpoint=legacy ${cfg.poolName}/root zfs create -o mountpoint=legacy ${cfg.poolName}/home zfs create -o mountpoint=legacy ${cfg.poolName}/nix - swapon $SWAP_DEVICE mount -t zfs ${cfg.poolName}/root /mnt/ mkdir /mnt/{home,nix,boot} mount -t zfs ${cfg.poolName}/home /mnt/home/ @@ -111,8 +104,7 @@ in { networking.hostId = "$hostId"; # required for zfs use ${lib.optionalString cfg.luksEncrypt '' boot.initrd.luks.devices = [ - { name = "swap"; device = "${cfg.rootDevice}${x}2"; preLVM = true; } - { name = "root"; device = "${cfg.rootDevice}${x}3"; preLVM = true; } + { name = "root"; device = "${cfg.rootDevice}${x}2"; preLVM = true; } ]; ''} } @@ -120,9 +112,9 @@ in { nixos-install umount /mnt/home /mnt/nix ${lib.optionalString (cfg.bootType != "zfs") "/mnt/boot"} /mnt zpool export ${cfg.poolName} - swapoff $SWAP_DEVICE ''; environment.systemPackages = [ config.system.build.justdoit ]; boot.supportedFilesystems = [ "zfs" ]; + users.users.root.openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCl3RTOHd5DLiVeUbUr/GSiKoRWknXQnbkIf+uNiFO+XxiqZVojPlumQUVhasY8UzDzj9tSDruUKXpjut50FhIO5UFAgsBeMJyoZbgY/+R+QKU00Q19+IiUtxeFol/9dCO+F4o937MC0OpAC10LbOXN/9SYIXueYk3pJxIycXwUqhYmyEqtDdVh9Rx32LBVqlBoXRHpNGPLiswV2qNe0b5p919IGcslzf1XoUzfE3a3yjk/XbWh/59xnl4V7Oe7+iQheFxOT6rFA30WYwEygs5As//ZYtxvnn0gA02gOnXJsNjOW9irlxOUeP7IOU6Ye3WRKFRR0+7PS+w8IJLag2xb" ]; }; } diff --git a/makefu/1systems/iso/target-config.nix b/makefu/1systems/iso/target-config.nix index 6915e4137..59d2960bc 100644 --- a/makefu/1systems/iso/target-config.nix +++ b/makefu/1systems/iso/target-config.nix @@ -1,12 +1,12 @@ -{ lib, ... }: +{ pkgs, lib, ... }: { imports = [ ./hardware-configuration.nix ./generated.nix ]; boot.loader.grub.enable = true; boot.loader.grub.version = 2; boot.zfs.devNodes = "/dev"; # fixes some virtualmachine issues - boot.zfs.forceImportRoot = false; - boot.zfs.forceImportAll = false; + #boot.zfs.forceImportRoot = false; + #boot.zfs.forceImportAll = false; boot.kernelParams = [ "boot.shell_on_fail" "panic=30" "boot.panic_on_fail" # reboot the machine upon fatal boot issues @@ -18,8 +18,15 @@ SystemMaxUse=1G RuntimeMaxUse=128M ''; + environment.systemPackages = [ (pkgs.writeScriptBin "network-setup" '' + #!/bin/sh + ip addr add 178.254.30.202/255.255.252.0 dev ens3 + ip route add default via 178.254.28.1 + echo nameserver 1.1.1.1 > /etc/resolv.conf + '')]; # minimal + boot.supportedFilesystems = [ "zfs" ]; programs.command-not-found.enable = false; time.timeZone = "Europe/Berlin"; programs.ssh.startAgent = false; @@ -36,5 +43,4 @@ "net.ipv6.conf.all.use_tempaddr" = lib.mkDefault "2"; "net.ipv6.conf.default.use_tempaddr" = lib.mkDefault "2"; }; - services.nscd.enable = false; } -- cgit v1.3.1 From 4218846220e75b7e3905d151f52e545743e4d7a9 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 30 May 2022 12:57:33 +0200 Subject: ma latte: move owncloud to hetzner --- makefu/1systems/latte/config.nix | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/makefu/1systems/latte/config.nix b/makefu/1systems/latte/config.nix index 2828aea08..69e401d97 100644 --- a/makefu/1systems/latte/config.nix +++ b/makefu/1systems/latte/config.nix @@ -34,20 +34,11 @@ in { # Services: - + + # torrent is managed by gum + # + ## Web - - - ### Moving owncloud data dir to /media/cloud/nextcloud-data - { - users.users.nextcloud.extraGroups = [ "download" ]; - # nextcloud-setup fails as it cannot set permissions for nextcloud - systemd.services.nextcloud-setup.serviceConfig.SuccessExitStatus = "0 1"; - fileSystems."/var/lib/nextcloud/data" = { - device = "/media/cloud/nextcloud-data"; - options = [ "bind" ]; - }; - } # local usage: -- cgit v1.3.1 From 2ec9de5aba1afc57f3ff7600316e9fc1c4b151f3 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 30 May 2022 12:57:52 +0200 Subject: ma x.r: enable zfs crub --- makefu/1systems/x/config.nix | 1 - makefu/1systems/x/source.nix | 1 + makefu/1systems/x/x13/default.nix | 1 + makefu/1systems/x/x13/zfs.nix | 3 ++- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/makefu/1systems/x/config.nix b/makefu/1systems/x/config.nix index 4f5fe44b5..a4aa0cbab 100644 --- a/makefu/1systems/x/config.nix +++ b/makefu/1systems/x/config.nix @@ -26,7 +26,6 @@ - # # base diff --git a/makefu/1systems/x/source.nix b/makefu/1systems/x/source.nix index 050fd39f7..05b74a014 100644 --- a/makefu/1systems/x/source.nix +++ b/makefu/1systems/x/source.nix @@ -7,5 +7,6 @@ mic92 = true; clever_kexec = true; home-manager = true; + nix-ld = true; # torrent = true; } diff --git a/makefu/1systems/x/x13/default.nix b/makefu/1systems/x/x13/default.nix index 9a407a575..7e9f4a6ac 100644 --- a/makefu/1systems/x/x13/default.nix +++ b/makefu/1systems/x/x13/default.nix @@ -28,6 +28,7 @@ environment.variables.VK_ICD_FILENAMES = "/run/opengl-driver/share/vulkan/icd.d/amd_icd64.json"; + services.fwupd.enable = true; programs.light.enable = true; diff --git a/makefu/1systems/x/x13/zfs.nix b/makefu/1systems/x/x13/zfs.nix index d6b99df41..ba341ef50 100644 --- a/makefu/1systems/x/x13/zfs.nix +++ b/makefu/1systems/x/x13/zfs.nix @@ -29,5 +29,6 @@ fsType = "zfs"; }; - swapDevices = [ ]; + swapDevices = [ ]; + services.zfs.autoScrub.enable = true; } -- cgit v1.3.1 From 54869b752d3f5724679f84ed6f0896a03c578ab5 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:06:43 +0200 Subject: ma tools: youtube-dl -> ty-dlp, add more dev --- makefu/2configs/tools/dev.nix | 4 ++++ makefu/2configs/tools/media.nix | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/makefu/2configs/tools/dev.nix b/makefu/2configs/tools/dev.nix index 918d950f2..66bc9a0e6 100644 --- a/makefu/2configs/tools/dev.nix +++ b/makefu/2configs/tools/dev.nix @@ -38,6 +38,10 @@ ovh-zone gen-oath-safe cdrtools + unrar + ffmpeg + dnsutils + # network related sshuttle pciutils diff --git a/makefu/2configs/tools/media.nix b/makefu/2configs/tools/media.nix index 14e782e3f..255d1c51a 100644 --- a/makefu/2configs/tools/media.nix +++ b/makefu/2configs/tools/media.nix @@ -13,7 +13,7 @@ plowshare streamripper - youtube-dl + yt-dlp pulseeffects-legacy # for pulse ]; -- cgit v1.3.1 From 2047429a2e858c438c5b81508910ae9d195e0301 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:07:52 +0200 Subject: ma ham: reenabel giesskanne --- makefu/2configs/home/ham/automation/check-in.nix | 13 ++- makefu/2configs/home/ham/automation/flurlicht.nix | 85 ++++++++-------- makefu/2configs/home/ham/automation/giesskanne.nix | 45 ++++----- makefu/2configs/home/ham/automation/urlaub.nix | 26 +++-- makefu/2configs/home/ham/default.nix | 17 ++-- makefu/2configs/home/ham/light/tint_wohnzimmer.nix | 15 +-- .../home/ham/media/remote_sound_arbeitszimmer.nix | 107 +++++++++++++++++++++ makefu/2configs/home/ham/media/sonos.nix | 1 + makefu/2configs/home/ham/person/default.nix | 20 ++++ 9 files changed, 240 insertions(+), 89 deletions(-) create mode 100644 makefu/2configs/home/ham/media/remote_sound_arbeitszimmer.nix create mode 100644 makefu/2configs/home/ham/person/default.nix diff --git a/makefu/2configs/home/ham/automation/check-in.nix b/makefu/2configs/home/ham/automation/check-in.nix index 21040b409..3a7ebe9ac 100644 --- a/makefu/2configs/home/ham/automation/check-in.nix +++ b/makefu/2configs/home/ham/automation/check-in.nix @@ -3,7 +3,7 @@ let light = "light.arbeitszimmer_onebutton_led"; at_work = "input_boolean.felix_at_work"; lib = import ../lib; - say = lib.say.living_room; + say = lib.say.office; in { services.home-assistant.config.input_boolean.felix_at_work.name = "Felix auf Arbeit"; @@ -37,7 +37,16 @@ in { service = "homeassistant.turn_on"; entity_id = at_work; } - ] ++ (say "Willkommen auf Arbeit"); + ] ++ (say "Willkommen auf Arbeit") ++ + [ + { service = "media_player.play_media"; + data = { + media_content_id = "https://radio.lassul.us/radio.mp3"; + media_content_type = "music"; + }; + target.entity_id = "media_player.office"; + } + ]; } { conditions = { diff --git a/makefu/2configs/home/ham/automation/flurlicht.nix b/makefu/2configs/home/ham/automation/flurlicht.nix index c26f7e3e0..aa62ab9e4 100644 --- a/makefu/2configs/home/ham/automation/flurlicht.nix +++ b/makefu/2configs/home/ham/automation/flurlicht.nix @@ -1,56 +1,57 @@ let - licht = [ "light.flur_statuslight" "light.wohnzimmer_status_led" ]; - kehrwoche_color = [ 204 0 255 ]; # pink - nachtlicht_color = [ 255 190 0 ]; # ein dunkles rot + nachtlicht = [ "light.flur_statuslight" "light.wohnzimmer_status_led" ]; + + # flurlicht an + lightcond = name: conditions: rgb_color: brightness: + { + inherit conditions; + sequence = { + service = "light.turn_on"; + target.entity_id = nachtlicht; + data = { + inherit rgb_color brightness; + }; + }; + }; in { services.home-assistant.config.automation = [ - { alias = "Nachtlicht im Flur an"; - trigger = { - platform = "sun"; - event = "sunset"; - }; - action = - [ - { - service = "light.turn_on"; - target.entity_id = licht; - data = { - brightness = 87; - rgb_color = nachtlicht_color; - #effect = "None"; - }; + { alias = "Nachtlicht trigger"; + trigger = [ + { platform = "sun"; event = "sunset"; } + { platform = "sun"; event = "sunrise"; } + { platform = "state"; entity_id = [ + "calendar.kehrwoche_kehrwoche" + "binary_sensor.badezimmer_fenster_contact" + "binary_sensor.dusche_fenster_contact" + ]; } ]; - } - { alias = "Nachtlicht in Flur aus, Kehrwoche an"; - trigger = { - platform = "sun"; - event = "sunrise"; - }; action = [ { choose = [ - { - conditions = { - condition = "state"; - entity_id = "calendar.kehrwoche_kehrwoche"; - state = "on"; - }; - sequence = { - service = "light.turn_on"; - target.entity_id = licht; - data = { - brightness = 190; - rgb_color = kehrwoche_color; # pink - }; - }; - }]; + (lightcond "Badezimmer Fenster Auf" + { condition = "state"; entity_id = "binary_sensor.badezimmer_fenster_contact"; state = "on"; } + [ 64 207 255 ] 255 # helblau + ) + (lightcond "Duschenster auf" + { condition = "state"; entity_id = "binary_sensor.dusche_fenster_contact"; state = "on"; } + [ 64 207 255 ] 255 # helblau + ) + (lightcond "Nachtlicht" + { condition = "state"; entity_id = "sun.sun"; state = "below_horizon"; } + [ 255 190 0 ] 90 # red + ) + (lightcond "Kehrwoche" + { condition = "state"; entity_id = "calendar.kehrwoche_kehrwoche"; state = "on"; } + [ 204 0 255 ] 128 # pink + ) + ]; default = { - service = "light.turn_off"; - entity_id = licht; - }; + service = "light.turn_off"; + entity_id = nachtlicht; + }; } ]; } diff --git a/makefu/2configs/home/ham/automation/giesskanne.nix b/makefu/2configs/home/ham/automation/giesskanne.nix index b11fd9d52..400e553e8 100644 --- a/makefu/2configs/home/ham/automation/giesskanne.nix +++ b/makefu/2configs/home/ham/automation/giesskanne.nix @@ -7,8 +7,10 @@ let light = "light.espcam_02_light"; seconds = 90; # default shutoff to protect the LED from burning out }; - seconds = 70; # time for giesskanne + seconds = 60*5; # time for giesskanne - 5 minutes pump = "switch.arbeitszimmer_giesskanne_relay"; + light = "switch.terrasse_plug_relay"; + # sensor = "sensor.statistics_for_sensor_crafting_brotbox_soil_moisture"; in { @@ -26,56 +28,51 @@ in [ ##### brotbox - { alias = "Water the plant for ${toString seconds} seconds"; + { alias = "Water the plant for ${toString seconds} seconds and turn on the light"; trigger = [ { # trigger at 23:15 no matter what # TODO: retry or run only if switch.wasser is available - platform = "time"; - at = "23:15:00"; + platform = "sun"; + event = "sunrise"; } ]; action = [ - { # take a snapshot before watering - service = "homeassistant.turn_on"; - entity_id = [ cam.light ]; - } - { # TODO: we could also create a recording with camera.record - service = "camera.snapshot"; - data = { - entity_id = cam.camera; - # TODO: create /var/lib/hass/cam/ - now being done manually - filename = "/var/lib/hass/cam/${cam.name}_{{ now().strftime('%Y%m%d-%H%M%S') }}.jpg"; - }; - } { # now turn on the pumping services # i do not start hte pump and light before the snapshot because i do # not know how long it takes (do not want to water the plants for too long) service = "homeassistant.turn_on"; - entity_id = [ pump ]; + entity_id = [ pump light ]; } { delay.seconds = seconds; } { service = "homeassistant.turn_off"; entity_id = [ pump cam.light ]; } + { # TODO: we could also create a recording with camera.record + service = "camera.snapshot"; + data = { + entity_id = cam.camera; + # TODO: create /var/lib/hass/cam/ - now being done manually + filename = "/var/lib/hass/cam/${cam.name}_{{ now().strftime('%Y%m%d-%H%M%S') }}.jpg"; + }; + } ]; } - { alias = "Always turn off the light after ${toString (cam.seconds)}s"; + { alias = "Turn off the light at sunset"; trigger = [ { - platform = "state"; - entity_id = cam.light; - to = "on"; - for.seconds = cam.seconds; + platform = "sun"; + event = "sunset"; + # offset = "+02:00:00"; } ]; action = [ { service = "homeassistant.turn_off"; - entity_id = [ pump cam.light ]; + entity_id = [ light ]; } ]; } @@ -93,7 +90,7 @@ in [ { service = "homeassistant.turn_off"; - entity_id = [ pump cam.light ]; + entity_id = [ pump ]; } ]; } diff --git a/makefu/2configs/home/ham/automation/urlaub.nix b/makefu/2configs/home/ham/automation/urlaub.nix index 50294514c..c11c589cf 100644 --- a/makefu/2configs/home/ham/automation/urlaub.nix +++ b/makefu/2configs/home/ham/automation/urlaub.nix @@ -7,12 +7,26 @@ let schranklicht = "light.wohnzimmer_schrank_osram"; weihnachtslicht = "light.wohnzimmer_fenster_lichterkette_licht"; fernsehlicht = "light.wled"; + + all_lights = [ + schranklicht weihnachtslicht fernsehlicht + # extra lights to also turn off + # wohnzimmer + "light.wohnzimmer_komode_osram" + "light.wohnzimmer_stehlampe_osram" + # arbeitszimmer + "light.wled_4" + "light.arbeitszimmer_schrank_dimmer" + "light.arbeitszimmer_pflanzenlicht" + ]; + final_off = "00:37"; - turn_on = entity_id: at: - { alias = "Turn on ${entity_id} at ${at}"; + turn_on = entity_id: offset: + # negative offset => before sunset + { alias = "Turn on ${entity_id} at sunset ${offset}"; trigger = [ - { platform = "time"; inherit at; } + { platform = "sun"; event = "sunset"; inherit offset; } ]; action = [ @@ -25,9 +39,9 @@ in { automation = [ - (turn_on schranklicht "17:30") - (turn_on weihnachtslicht "17:30") - (turn_on fernsehlicht "19:00") + (turn_on schranklicht "-00:30:00") + #(turn_on weihnachtslicht "-00:30:00") + (turn_on fernsehlicht "-00:00:00") { alias = "Always turn off the urlaub lights at ${final_off}"; trigger = [ diff --git a/makefu/2configs/home/ham/default.nix b/makefu/2configs/home/ham/default.nix index b9701f129..31e7ba419 100644 --- a/makefu/2configs/home/ham/default.nix +++ b/makefu/2configs/home/ham/default.nix @@ -31,15 +31,16 @@ in { ./media/firetv.nix ./media/sonos.nix ./media/remote_sound_wohnzimmer.nix + ./media/remote_sound_arbeitszimmer.nix ./automation/check-in.nix ./automation/fenster_auf.nix ./automation/firetv_restart.nix ./automation/light_buttons.nix ./automation/wohnzimmer_rf_fernbedienung.nix - ./automation/ladestecker_timer.nix + # ./automation/ladestecker_timer.nix ./automation/flurlicht.nix - #./automation/giesskanne.nix + ./automation/giesskanne.nix ./automation/pflanzen_giessen_erinnerung.nix ./automation/urlaub.nix ./automation/moodlight.nix @@ -59,7 +60,7 @@ in { extraPackages = p: [ (p.callPackage ./deps/dwdwfsapi.nix {}) (p.callPackage ./signal-rest/pkg.nix {}) - #(p.callPackage ./deps/pykodi.nix {}) + (p.callPackage ./deps/pykodi.nix {}) ]; }; @@ -141,11 +142,11 @@ in { retain = true; }; }; - luftdaten = { - show_on_map = true; - sensor_id = 10529; - sensors.monitored_conditions = [ "P1" "P2" ]; - }; + #luftdaten = { + # show_on_map = true; + # sensor_id = 10529; + # sensors.monitored_conditions = [ "P1" "P2" ]; + #}; #binary_sensor = # flurlicht.binary_sensor; diff --git a/makefu/2configs/home/ham/light/tint_wohnzimmer.nix b/makefu/2configs/home/ham/light/tint_wohnzimmer.nix index fd87cf064..474bf5c99 100644 --- a/makefu/2configs/home/ham/light/tint_wohnzimmer.nix +++ b/makefu/2configs/home/ham/light/tint_wohnzimmer.nix @@ -25,19 +25,20 @@ let default_scene_1 = "Solid"; default_color_1 = "Default"; main_color_select_1 = "select.wled_color_palette"; - light_group_1.entity_id = [ - main_light_1 - ]; + light_group_1.entity_id = [ + main_light_1 + ]; # contains only the actually changeable lights - light_group_2.entity_id = [ + light_group_2 = { entity_id = [ "light.wohnzimmer_komode_osram" "light.wohnzimmer_schrank_osram" "light.wohnzimmer_fenster_lichterkette_licht" - ]; - light_group_3.entity_id = [ + ]; + }; + light_group_3 = { entity_id = [ "light.wohnzimmer_stehlampe_osram" - ]; + ]; }; statecond = cond: { # cond must be a list condition = "template"; diff --git a/makefu/2configs/home/ham/media/remote_sound_arbeitszimmer.nix b/makefu/2configs/home/ham/media/remote_sound_arbeitszimmer.nix new file mode 100644 index 000000000..f59f022f4 --- /dev/null +++ b/makefu/2configs/home/ham/media/remote_sound_arbeitszimmer.nix @@ -0,0 +1,107 @@ +{ lib, ...}: +let + statecond = cond: { # cond must be a list + condition = "template"; + value_template = "{{ trigger.to_state.state in ( " + + (lib.concatMapStringsSep "," (x: "'${x}'") cond) + ") }}"; + }; + vol_change = 0.030; + + max_repeat = "30"; # max loops to repeat before bailing out + remote = "sensor.arbeitszimmer_sound1_action"; + player = "media_player.office"; + last_state_sensor_name = "last_rotation_action_arbeitszimmer"; + last_state_sensor = "input_text.${last_state_sensor_name}"; + # - service: media_player.volume_set + # target: + # entity_id: media_player.kitchen + # data: + # volume_level: {{ state_attr('media_player.kitchen', 'volume_level') + 0.02 }} + rotate_stop = "brightness_stop"; + rotate_right = "brightness_move_up"; + rotate_left = "brightness_move_down" ; + + single_click = "toggle"; + double_click = "brightness_step_up"; + triple_click = "brightness_step_down"; +in { + services.home-assistant.config.input_text."${last_state_sensor_name}".name = "Last action of the arbeitszimmer"; + services.home-assistant.config.automation = [ + { + trigger = { + platform = "state"; + entity_id = remote; + to = [ rotate_stop ]; + }; + action = [ + { service = "input_text.set_value"; + target.entity_id = last_state_sensor; + data.value = "stop"; + } + ]; + } + { + alias = "Perform Actions with ${remote}"; + trigger = { + platform = "state"; + entity_id = remote; + to = [ single_click double_click triple_click rotate_left rotate_right ]; + }; + #mode = "queued"; + #max = 5; + mode = "single"; + #max_exceeded = "silent"; + action = [ + { + choose = [ + { + conditions = statecond [ single_click ]; + sequence = [ + { service = "media_player.media_play_pause"; + target.entity_id = player; + } + ]; + } + { + conditions = statecond [ rotate_left rotate_right ]; + sequence = let + vol_up = toString vol_change; + vol_down = toString (-1 * vol_change); + in [ + { + variables.nextvol = ''{% if trigger.to_state.state in ( "${rotate_left}" ) -%} ${vol_down} {% else -%} ${vol_up} {% endif -%}''; + variables.state = ''{% if trigger.to_state.state in ( "${rotate_left}" ) -%} left {% else -%} right {% endif -%}''; + } + { service = "input_text.set_value"; + target.entity_id = last_state_sensor; + data.value = ''{{ state }}''; + } + { + repeat = { + sequence = [ + { service = "media_player.volume_set"; + target.entity_id = player; + data.volume_level = ''{{ state_attr("${player}","volume_level") + (nextvol|float) }}''; + } + { delay.milliseconds = "150"; } + ]; + while = [ + { + condition = "template"; + value_template = ''{{ states("${last_state_sensor}") == state }}''; + } + { + condition = "template"; + value_template = "{{ repeat.index <= ${max_repeat}}}"; + } + ]; + }; + } + ]; + } + ]; + } + ]; + } + ]; +} diff --git a/makefu/2configs/home/ham/media/sonos.nix b/makefu/2configs/home/ham/media/sonos.nix index 5b9694512..40dcfc3ca 100644 --- a/makefu/2configs/home/ham/media/sonos.nix +++ b/makefu/2configs/home/ham/media/sonos.nix @@ -2,6 +2,7 @@ services.home-assistant.config.sonos.media_player.hosts = [ "192.168.111.30" "192.168.111.31" + "192.168.111.32" ]; } diff --git a/makefu/2configs/home/ham/person/default.nix b/makefu/2configs/home/ham/person/default.nix new file mode 100644 index 000000000..a72f610e8 --- /dev/null +++ b/makefu/2configs/home/ham/person/default.nix @@ -0,0 +1,20 @@ +{config, ... }: +{ + services.home-assistant.config.person = [ + { + name = "Felix"; + id = 1; + device_trackers = [ + "device_tracker.felix_phone" + "device_tracker.x" + ]; + } + { + name = "Misa"; + id = 2; + device_trackers = [ + "device_tracker.misa_phone" + ]; + } + ]; +} -- cgit v1.3.1 From 08732ec608af2f6e0c07d1fd33ed70caff488470 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:08:21 +0200 Subject: ma ham/music: move folders --- makefu/2configs/home/music.nix | 2 +- makefu/2configs/home/tonie.nix | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/makefu/2configs/home/music.nix b/makefu/2configs/home/music.nix index 59f6d9170..7f5a425d2 100644 --- a/makefu/2configs/home/music.nix +++ b/makefu/2configs/home/music.nix @@ -6,7 +6,7 @@ in { services.navidrome.enable = true; services.navidrome.settings = { - MusicFolder = "/media/cryptX/music"; + MusicFolder = "/media/cryptX/music/kinder"; Address = "0.0.0.0"; }; diff --git a/makefu/2configs/home/tonie.nix b/makefu/2configs/home/tonie.nix index 959e48e8b..bc3633a88 100644 --- a/makefu/2configs/home/tonie.nix +++ b/makefu/2configs/home/tonie.nix @@ -4,8 +4,8 @@ let #host = config.networking.hostName; ident = 998; user = "${toString ident}:${toString ident}"; - #backend_host = "tonie.lan"; - backend_host = "tonie.omo.r"; + backend_host = "tonie.lan"; + #backend_host = "tonie.omo.r"; frontend_port = 30006; homedir = "/var/lib/tonies"; albumdir = "${homedir}/albumart/"; -- cgit v1.3.1 From b0fcf41a824695a8d91f8355f94cba0523991837 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:08:36 +0200 Subject: ma home: init jellyfin --- makefu/2configs/home/jellyfin.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 makefu/2configs/home/jellyfin.nix diff --git a/makefu/2configs/home/jellyfin.nix b/makefu/2configs/home/jellyfin.nix new file mode 100644 index 000000000..672a483e5 --- /dev/null +++ b/makefu/2configs/home/jellyfin.nix @@ -0,0 +1,10 @@ +{ lib, config, ... }: +{ + services.jellyfin.enable = true; + services.jellyfin.openFirewall = true; + #users.users.${config.services.jellyfin.user}.extraGroups = [ "download" "video" "render" ]; + state = [ "/var/lib/jellyfin" ]; + systemd.services.jellyfin.serviceConfig.PrivateDevices = lib.mkForce false; + systemd.services.jellyfin.serviceConfig.DeviceAllow = lib.mkForce ["char-drm rwm" "char-nvidia-frontend" "char-nvidia-uvm"]; + systemd.services.jellyfin.serviceConfig.SupplementaryGroups = [ "video" "render" "download" ]; +} -- cgit v1.3.1 From 67693d4eb4d492811069c32e6ed4e57854163beb Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:12:52 +0200 Subject: ma bgt: move storedir to hetzner cloud, fix for old ssh client --- makefu/2configs/bgt/download.binaergewitter.de.nix | 15 +++++++++++++++ makefu/2configs/bgt/template.md | 14 ++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/makefu/2configs/bgt/download.binaergewitter.de.nix b/makefu/2configs/bgt/download.binaergewitter.de.nix index 6ce0606a8..1cf21f213 100644 --- a/makefu/2configs/bgt/download.binaergewitter.de.nix +++ b/makefu/2configs/bgt/download.binaergewitter.de.nix @@ -5,22 +5,37 @@ let ident = (builtins.readFile ./auphonic.pub); bgtaccess = "/var/spool/nginx/logs/binaergewitter.access.log"; bgterror = "/var/spool/nginx/logs/binaergewitter.error.log"; + + # TODO: only when the data is stored somewhere else + wwwdir = "/var/www/binaergewitter"; + storedir = "/media/cloud/www/binaergewitter"; in { + fileSystems."${wwwdir}" = { + device = storedir; + options = [ "bind" ]; + }; + services.openssh = { allowSFTP = true; sftpFlags = [ "-l VERBOSE" ]; extraConfig = '' + HostkeyAlgorithms +ssh-rsa + Match User auphonic ForceCommand internal-sftp AllowTcpForwarding no X11Forwarding no PasswordAuthentication no + PubkeyAcceptedAlgorithms +ssh-rsa + ''; }; users.users.auphonic = { uid = genid "auphonic"; group = "nginx"; + # for storedir + extraGroups = [ "download" ]; useDefaultShell = true; isSystemUser = true; openssh.authorizedKeys.keys = [ ident config.krebs.users.makefu.pubkey ]; diff --git a/makefu/2configs/bgt/template.md b/makefu/2configs/bgt/template.md index fdc0e2585..8413e0b8b 100644 --- a/makefu/2configs/bgt/template.md +++ b/makefu/2configs/bgt/template.md @@ -1,31 +1,25 @@ # -0. Sendung twittern und mastodieren (eine Woche + eine Stunde vorher) (wichtig) +0. Sendung twittern und mastodieren (eine Woche + eine Stunde vorher) von Ingo/l33tname (wichtig) 1. `eine` Person anrufen (den Host): - markus 162dcbf89f@studio.link - Felix1 makefu@studio.link - L33tFelix l33tname@studio.link - Ingo ingo@studio.link -2. Jitis an machen! https://meet.jit.cloud/bgt (mittel) -3. studio-link aufnehmen drücken, schauen ob file local.flac größer wird (wichtig) +2. Jitis an machen https://meet.ffmuc.net/bgt (mittel) +3. studio-link aufnehmen drücken (wichtig) 4. audiocity starten, 48000Hz einstellen, Audio-Device checken und aufnehmen drücken (wichtig) 4. alternative parecord: `$ pacmd list-sources | grep -e device.string -e 'name:' # keins der "monitor" devices` `$ parecord --channels=1 -d alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo bgt.wav` 5. darkice starten (wichtig) -5. chapter-marker starten (wichtig) +6. Ingo daran erinnern, dass er die Überschriften richtig aussprechen muss 7. klatschen 8. Hallihallo und Herzlich Willkommen -9. ctrl-u auf "H" von "Halli" Felix auf jeden fall erinnern (wichtig) -10. Ctrl-j drücken für neuen Eintrag - ggf. Felix erinnern (wichtig) ## Vorschläge ### Backlog von Picks und Lesefoo aus der letzten Woche -die Nachfolgenden 3 Striche sind sehr wichtig, bitte nicht löschen. Nachdem -chapter-marker gestartet wurde kann die reihenfolge nicht mer angepasst werden, -das ist der preis, den man zahlt - --- ## Blast from the Past -- cgit v1.3.1 From 37006c21985e64e8835084c7a6792ed39c2e6661 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:15:49 +0200 Subject: ma services: ensure state is backed up --- makefu/2configs/bitlbee.nix | 3 ++- makefu/2configs/bitwarden.nix | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/makefu/2configs/bitlbee.nix b/makefu/2configs/bitlbee.nix index e955384d6..52b5d68a5 100644 --- a/makefu/2configs/bitlbee.nix +++ b/makefu/2configs/bitlbee.nix @@ -1,8 +1,9 @@ {pkgs, ... }: -# state: /var/lib/bitlbee { services.bitlbee = { enable = true; libpurple_plugins = [ pkgs.telegram-purple pkgs.pidgin-skypeweb]; }; + users.users.makefu.packages = with pkgs; [ weechat tmux ]; + state = [ "/var/lib/bitlbee" ]; } diff --git a/makefu/2configs/bitwarden.nix b/makefu/2configs/bitwarden.nix index 92c1c4e0e..cc742511c 100644 --- a/makefu/2configs/bitwarden.nix +++ b/makefu/2configs/bitwarden.nix @@ -23,6 +23,11 @@ in { { name = "vaultwarden"; ensurePermissions."DATABASE bitwarden" = "ALL PRIVILEGES"; } ]; }; + services.postgresqlBackup = { + enable = true; + databases = [ "bitwarden" "vaultwarden" ]; + }; + services.nginx.virtualHosts."bw.euer.krebsco.de" ={ forceSSL = true; -- cgit v1.3.1 From 43486ea6d8f2784a36616313675bd06ce433ccc1 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:16:30 +0200 Subject: ma bureautomation: home-assistant is now user-controlled --- makefu/2configs/bureautomation/comic-updater.nix | 5 +- makefu/2configs/bureautomation/default.nix | 320 ++++++++++++----------- makefu/2configs/gui/wbob-kiosk.nix | 12 +- 3 files changed, 181 insertions(+), 156 deletions(-) diff --git a/makefu/2configs/bureautomation/comic-updater.nix b/makefu/2configs/bureautomation/comic-updater.nix index 1e2440939..5804d66d2 100644 --- a/makefu/2configs/bureautomation/comic-updater.nix +++ b/makefu/2configs/bureautomation/comic-updater.nix @@ -11,8 +11,9 @@ in { path = with pkgs; [ wget xmlstarlet ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { - User = "hass"; - WorkingDirectory = config.services.home-assistant.configDir; + # User = "hass"; + #WorkingDirectory = config.services.home-assistant.configDir; + WorkingDirectory = "/var/lib/homeassistant-docker"; ExecStart = pkgs.writeDash "update-comics" '' set -euf mkdir -p www/ diff --git a/makefu/2configs/bureautomation/default.nix b/makefu/2configs/bureautomation/default.nix index 46bf05963..44690271d 100644 --- a/makefu/2configs/bureautomation/default.nix +++ b/makefu/2configs/bureautomation/default.nix @@ -2,6 +2,7 @@ let kodi-host = "192.168.8.11"; unstable = import {}; + confdir = "/var/lib/homeassistant-docker"; in { imports = [ ./ota.nix @@ -13,169 +14,188 @@ in { # hass config ## complex configs # ./multi/daily-standup.nix - ./multi/aramark.nix - ./multi/matrix.nix - ./multi/frosch.nix - ./multi/mittagessen.nix - ./multi/10h_timers.nix + #./multi/aramark.nix + #./multi/matrix.nix + #./multi/frosch.nix + #./multi/mittagessen.nix + #./multi/10h_timers.nix - ./switch/tasmota_switch.nix - ./switch/rfbridge.nix + #./switch/tasmota_switch.nix + #./switch/rfbridge.nix - ./light/statuslight.nix - ./light/buzzer.nix + #./light/statuslight.nix + #./light/buzzer.nix - ./script/multi_blink.nix + #./script/multi_blink.nix - ./binary_sensor/buttons.nix - ./binary_sensor/motion.nix + #./binary_sensor/buttons.nix + #./binary_sensor/motion.nix - # ./sensor/pollen.nix requires dwd_pollen - ./sensor/espeasy.nix - ./sensor/airquality.nix - ./sensor/outside.nix - ./sensor/tasmota_firmware.nix + ## ./sensor/pollen.nix requires dwd_pollen + #./sensor/espeasy.nix + #./sensor/airquality.nix + #./sensor/outside.nix + #./sensor/tasmota_firmware.nix - ./camera/verkehrskamera.nix - ./camera/comic.nix - ./camera/stuttgart.nix - ./automation/bureau-shutdown.nix - ./automation/nachtlicht.nix - ./automation/schlechteluft.nix - ./automation/philosophische-tuer.nix - ./automation/hass-restart.nix - ./device_tracker/openwrt.nix - ./person/team.nix + #./camera/verkehrskamera.nix + #./camera/comic.nix + #./camera/stuttgart.nix + #./automation/bureau-shutdown.nix + #./automation/nachtlicht.nix + #./automation/schlechteluft.nix + #./automation/philosophische-tuer.nix + #./automation/hass-restart.nix + #./device_tracker/openwrt.nix + #./person/team.nix ]; networking.firewall.allowedTCPPorts = [ 8123 ]; state = [ "/var/lib/hass/known_devices.yaml" ]; - - services.home-assistant = { - enable = true; - package = (unstable.home-assistant.overrideAttrs (old: { - doInstallCheck = false; - })).override { - extraPackages = p: [ - # TODO: put somewhere else - (p.callPackage {}) - # (p.callPackage {}) - p.APScheduler ]; + virtualisation.oci-containers.containers.hass = { + image = "homeassistant/home-assistant:latest"; + #user = "${toString config.users.users.kiosk.uid}:${toString config.users.groups.kiosk.gid}"; + #user = "${toString config.users.users.kiosk.uid}:root"; + environment = { + TZ = "Europe/Berlin"; + PUID = toString config.users.users.kiosk.uid; + PGID = toString config.users.groups.kiosk.gid; + UMASK = "007"; }; - autoExtraComponents = true; - config = { - config = {}; - discovery = {}; - homeassistant = { - name = "Bureautomation"; - time_zone = "Europe/Berlin"; - latitude = "48.8265"; - longitude = "9.0676"; - elevation = 303; - auth_providers = [ - { type = "homeassistant";} - { type = "legacy_api_password"; - api_password = "sistemas"; - } - { type = "trusted_networks"; - trusted_networks = [ - "127.0.0.1/32" - "192.168.8.0/24" - "::1/128" - "fd00::/8" - ]; - # allow_bypass_login = true; - } - ]; - }; - # https://www.home-assistant.io/components/influxdb/ - influxdb = { - database = "hass"; - tags = { - instance = "wbob"; - source = "hass"; - }; - }; - mqtt = { - discovery = true; - discovery_prefix = "homeassistant"; - broker = "localhost"; - port = 1883; - client_id = "home-assistant"; - keepalive = 60; - protocol = 3.1; - birth_message = { - topic = "/bam/hass/tele/LWT"; - payload = "Online"; - qos = 1; - retain = true; - }; - will_message = { - topic = "/bam/hass/tele/LWT"; - payload = "Offline"; - qos = 1; - retain = true; - }; - }; - notify = [ - { - platform = "kodi"; - name = "wbob-kodi"; - host = kodi-host; - } - #{ - # platform = "telegram"; - # name = "telegrambot"; - # chat_id = builtins.elemAt - # (builtins.fromJSON (builtins.readFile - # )).allowed_chat_ids 0; - #} - ]; - media_player = [ - { platform = "kodi"; - host = kodi-host; - } - { platform = "mpd"; - host = "127.0.0.1"; - } - ]; + extraOptions = ["--net=host" ]; + volumes = [ + "${confdir}:/config" + #"${confdir}/docker-run:/etc/services.d/home-assistant/run:" + ]; + }; + systemd.tmpfiles.rules = [ + #"f ${confdir}/docker-run 0770 kiosk kiosk - -" + "d ${confdir} 0770 kiosk kiosk - -" + ]; + #services.home-assistant = { + # enable = true; + # package = (unstable.home-assistant.overrideAttrs (old: { + # doInstallCheck = false; + # })).override { + # extraPackages = p: [ + # # TODO: put somewhere else + # (p.callPackage {}) + # # (p.callPackage {}) + # p.APScheduler ]; + # }; + # autoExtraComponents = true; + # config = { + # config = {}; + # discovery = {}; + # homeassistant = { + # name = "Bureautomation"; + # time_zone = "Europe/Berlin"; + # latitude = "48.8265"; + # longitude = "9.0676"; + # elevation = 303; + # auth_providers = [ + # { type = "homeassistant";} + # { type = "legacy_api_password"; + # api_password = "sistemas"; + # } + # { type = "trusted_networks"; + # trusted_networks = [ + # "127.0.0.1/32" + # "192.168.8.0/24" + # "::1/128" + # "fd00::/8" + # ]; + # # allow_bypass_login = true; + # } + # ]; + # }; + # # https://www.home-assistant.io/components/influxdb/ + # influxdb = { + # database = "hass"; + # tags = { + # instance = "wbob"; + # source = "hass"; + # }; + # }; + # mqtt = { + # discovery = true; + # discovery_prefix = "homeassistant"; + # broker = "localhost"; + # port = 1883; + # client_id = "home-assistant"; + # keepalive = 60; + # protocol = 3.1; + # birth_message = { + # topic = "/bam/hass/tele/LWT"; + # payload = "Online"; + # qos = 1; + # retain = true; + # }; + # will_message = { + # topic = "/bam/hass/tele/LWT"; + # payload = "Offline"; + # qos = 1; + # retain = true; + # }; + # }; + # notify = [ + # { + # platform = "kodi"; + # name = "wbob-kodi"; + # host = kodi-host; + # } + # #{ + # # platform = "telegram"; + # # name = "telegrambot"; + # # chat_id = builtins.elemAt + # # (builtins.fromJSON (builtins.readFile + # # )).allowed_chat_ids 0; + # #} + # ]; + # media_player = [ + # { platform = "kodi"; + # host = kodi-host; + # } + # { platform = "mpd"; + # host = "127.0.0.1"; + # } + # ]; - # sensor = [{ platform = "version"; }]; # pyhaversion + # # sensor = [{ platform = "version"; }]; # pyhaversion - frontend = { }; - http = { - # TODO: https://github.com/home-assistant/home-assistant/issues/16149 - # base_url = "http://192.168.8.11:8123"; - }; - conversation = {}; - history = {}; - logbook = {}; - tts = [ - { platform = "google_translate"; - language = "de"; - time_memory = 57600; - service_name = "google_say"; - } - { platform = "voicerss"; - api_key = builtins.readFile ; - language = "de-de"; - } - #{ platform = "picotts"; - # language = "de-DE"; - #} - ]; - recorder = {}; - sun = {}; - #telegram_bot = [ - # (builtins.fromJSON - # (builtins.readFile )) - #]; - # only for automation - # feedreader.urls = [ "http://www.heise.de/security/rss/news-atom.xml" ]; - # we don't use imports because the expressions do not merge in - # home-assistant - }; - }; + # frontend = { }; + # http = { + # # TODO: https://github.com/home-assistant/home-assistant/issues/16149 + # # base_url = "http://192.168.8.11:8123"; + # }; + # conversation = {}; + # history = {}; + # logbook = {}; + # tts = [ + # { platform = "google_translate"; + # language = "de"; + # time_memory = 57600; + # service_name = "google_say"; + # } + # { platform = "voicerss"; + # api_key = builtins.readFile ; + # language = "de-de"; + # } + # #{ platform = "picotts"; + # # language = "de-DE"; + # #} + # ]; + # recorder = {}; + # sun = {}; + # #telegram_bot = [ + # # (builtins.fromJSON + # # (builtins.readFile )) + # #]; + # # only for automation + # # feedreader.urls = [ "http://www.heise.de/security/rss/news-atom.xml" ]; + # # we don't use imports because the expressions do not merge in + # # home-assistant + # }; + #}; } diff --git a/makefu/2configs/gui/wbob-kiosk.nix b/makefu/2configs/gui/wbob-kiosk.nix index dc28cf4d2..55df23640 100644 --- a/makefu/2configs/gui/wbob-kiosk.nix +++ b/makefu/2configs/gui/wbob-kiosk.nix @@ -4,17 +4,21 @@ imports = [ ./base.nix ]; - users.users.makefu = { - packages = [ pkgs.chromium ]; - extraGroups = [ "audio" "pulse" ]; + users.users.kiosk = { + packages = [ pkgs.chromium pkgs.vscode ]; + group = "kiosk"; + isNormalUser = true; + uid = 1003; + extraGroups = [ "wheel" "audio" "pulse" ]; }; + users.groups.kiosk.gid = 989 ; services.xserver = { windowManager = lib.mkForce { awesome.enable = false; }; displayManager.gdm.enable = true; displayManager.autoLogin = { enable = true; - user = "makefu"; + user = lib.mkForce "kiosk"; }; displayManager.defaultSession = "gnome"; desktopManager.gnome.enable = true; -- cgit v1.3.1 From 32fca3f276a266548a61858bc39ca9bebcc951cc Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:17:10 +0200 Subject: ma: migrate services back to gum --- krebs/3modules/makefu/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/krebs/3modules/makefu/default.nix b/krebs/3modules/makefu/default.nix index d63277132..b0bd83248 100644 --- a/krebs/3modules/makefu/default.nix +++ b/krebs/3modules/makefu/default.nix @@ -129,6 +129,7 @@ in { aliases = [ "omo.r" "dcpp.omo.r" + "backup.makefu.r" "torrent.omo.r" ]; }; @@ -153,9 +154,6 @@ in { extraZones = { "krebsco.de" = '' latte.euer IN A ${nets.internet.ip4.addr} - rss.euer IN A ${nets.internet.ip4.addr} - o.euer IN A ${nets.internet.ip4.addr} - bw.euer IN A ${nets.internet.ip4.addr} ''; }; cores = 4; @@ -194,6 +192,9 @@ in { ci = true; extraZones = { "krebsco.de" = '' + rss.euer IN A ${nets.internet.ip4.addr} + o.euer IN A ${nets.internet.ip4.addr} + bw.euer IN A ${nets.internet.ip4.addr} bookmark.euer IN A ${nets.internet.ip4.addr} boot IN A ${nets.internet.ip4.addr} boot.euer IN A ${nets.internet.ip4.addr} @@ -263,7 +264,6 @@ in { aliases = [ "gum.r" - "backup.makefu.r" "blog.gum.r" "blog.makefu.r" "cache.gum.r" -- cgit v1.3.1 From 9e2b4df8df2a982e1102990ed1f29448e836cc12 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:17:35 +0200 Subject: ma dcpp: fix service startup, update backup strategy ensure backup services is able to write to /media/cloud --- makefu/2configs/bitwarden.nix | 3 ++- makefu/2configs/dcpp/airdcpp.nix | 2 +- makefu/2configs/dcpp/hub.nix | 1 + makefu/2configs/deployment/rss/rss.euer.krebsco.de.nix | 1 + makefu/2configs/deployment/rss/urls | 6 ++++-- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/makefu/2configs/bitwarden.nix b/makefu/2configs/bitwarden.nix index cc742511c..d57badd1c 100644 --- a/makefu/2configs/bitwarden.nix +++ b/makefu/2configs/bitwarden.nix @@ -25,8 +25,9 @@ in { }; services.postgresqlBackup = { enable = true; - databases = [ "bitwarden" "vaultwarden" ]; + databases = [ "bitwarden" ]; }; + systemd.services.postgresqlBackup-bitwarden.serviceConfig.SupplementaryGroups = [ "download" ]; services.nginx.virtualHosts."bw.euer.krebsco.de" ={ diff --git a/makefu/2configs/dcpp/airdcpp.nix b/makefu/2configs/dcpp/airdcpp.nix index ad62babc3..60ed6826d 100644 --- a/makefu/2configs/dcpp/airdcpp.nix +++ b/makefu/2configs/dcpp/airdcpp.nix @@ -8,7 +8,7 @@ hubs."krebshub" = { Nick = "makefu-${config.krebs.build.host.name}"; Password = builtins.readFile ; - Server = "adcs://hub.nsupdate.info:411"; + Server = "adcs://hub.nsupdate.info:1511"; AutoConnect = true; }; dcpp = { diff --git a/makefu/2configs/dcpp/hub.nix b/makefu/2configs/dcpp/hub.nix index 5a88f5ef8..f0aac3f32 100644 --- a/makefu/2configs/dcpp/hub.nix +++ b/makefu/2configs/dcpp/hub.nix @@ -95,6 +95,7 @@ in { enableTLS = true; settings = { server_port = 1511; + server_bind_addr = "any"; hub_name = "krebshub"; tls_certificate = "${uhubDir}/uhub.crt"; tls_private_key = "${uhubDir}/uhub.key"; diff --git a/makefu/2configs/deployment/rss/rss.euer.krebsco.de.nix b/makefu/2configs/deployment/rss/rss.euer.krebsco.de.nix index e64a69d9c..5bebb7c3b 100644 --- a/makefu/2configs/deployment/rss/rss.euer.krebsco.de.nix +++ b/makefu/2configs/deployment/rss/rss.euer.krebsco.de.nix @@ -17,6 +17,7 @@ in { enable = true; databases = [ config.services.tt-rss.database.name ]; }; + systemd.services.postgresqlBackup-tt_rss.serviceConfig.SupplementaryGroups = [ "download" ]; services.nginx.virtualHosts."${fqdn}" = { enableACME = true; diff --git a/makefu/2configs/deployment/rss/urls b/makefu/2configs/deployment/rss/urls index 12d4c092a..3ab2538a1 100644 --- a/makefu/2configs/deployment/rss/urls +++ b/makefu/2configs/deployment/rss/urls @@ -1,5 +1,7 @@ -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 +https://www.ebay-kleinanzeigen.de/s-zu-verschenken/muehlhausen/c192l9313 +https://www.ebay-kleinanzeigen.de/s-spielzeug/muehlhausen/brettspiel/k0c23l9313 +https://www.ebay-kleinanzeigen.de/s-muehlhausen/labeldrucker/k0l9313r5 +https://www.ebay-kleinanzeigen.de/s-muehlhausen/dymo/k0l9313r5 -- cgit v1.3.1 From de582a2d00f9a2b0a17b29e54681be2be6390e71 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:20:28 +0200 Subject: ma nextcloud: allow service to write to cloud --- makefu/2configs/deployment/owncloud.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/makefu/2configs/deployment/owncloud.nix b/makefu/2configs/deployment/owncloud.nix index 610ba75fe..33a6a4ea2 100644 --- a/makefu/2configs/deployment/owncloud.nix +++ b/makefu/2configs/deployment/owncloud.nix @@ -20,6 +20,12 @@ let dbpw = "/run/secret/nextcloud-db-pw"; in { + fileSystems."/var/lib/nextcloud/data" = { + device = "/media/cloud/nextcloud-data"; + options = [ "bind" ]; + }; + + krebs.secret.files.nextcloud-db-pw = { path = dbpw; owner.name = "nextcloud"; @@ -40,13 +46,15 @@ in { enable = true; databases = [ config.services.nextcloud.config.dbname ]; }; - +systemd.services.postgresqlBackup-nextcloud.serviceConfig.SupplementaryGroups = [ "download" ]; + state = [ # services.postgresql.dataDir # "${config.services.nextcloud.home}/config" config.services.postgresqlBackup.location ]; + users.users.nextcloud.extraGroups = [ "download" ]; services.nextcloud = { enable = true; package = pkgs.nextcloud22; @@ -59,10 +67,11 @@ in { autoUpdateApps.startAt = "05:00:00"; caching.redis = true; - # caching.memcached = true; + caching.apcu = true; config = { # Further forces Nextcloud to use HTTPS overwriteProtocol = "https"; + defaultPhoneRegion = "DE"; # Nextcloud PostegreSQL database configuration, recommended over using SQLite dbtype = "pgsql"; @@ -71,7 +80,7 @@ in { dbname = "nextcloud"; dbpassFile = dbpw; adminpassFile = adminpw; - adminuser = "admin"; + adminuser = "root"; }; }; services.redis.enable = true; -- cgit v1.3.1 From 5e4e92b5fa8b293b3e2625c200f261b11d85351e Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:21:00 +0200 Subject: ma vim: use vimPlugins, not vam --- makefu/2configs/editor/vim.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/makefu/2configs/editor/vim.nix b/makefu/2configs/editor/vim.nix index 5751bf489..07f80719d 100644 --- a/makefu/2configs/editor/vim.nix +++ b/makefu/2configs/editor/vim.nix @@ -6,16 +6,15 @@ ((pkgs.vim_configurable.override { python = pkgs.python3; }).customize { name = "vim"; vimrcConfig.customRC = builtins.readFile ./vimrc; - vimrcConfig.vam.knownPlugins = pkgs.vimPlugins; - vimrcConfig.vam.pluginDictionaries = [ - { names = [ "undotree" + vimrcConfig.packages.myVimPackage = with pkgs.vimPlugins; { start = [ + "undotree" "YouCompleteMe" #"UltiSnips" - "vim-better-whitespace" ]; } # vim-nix handles indentation better but does not perform sanity - { names = [ "vim-addon-nix" ]; ft_regex = "^nix\$"; } + "vim-addon-nix" + "vim-better-whitespace" ]; - + }; }) ]; } -- cgit v1.3.1 From 700270d7494c9a085433e54f26ad70ef0575b0ed Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:21:20 +0200 Subject: ma home-manager: rename nix-direnv --- makefu/2configs/home-manager/zsh.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefu/2configs/home-manager/zsh.nix b/makefu/2configs/home-manager/zsh.nix index cf6f1d334..13755de27 100644 --- a/makefu/2configs/home-manager/zsh.nix +++ b/makefu/2configs/home-manager/zsh.nix @@ -35,7 +35,7 @@ home-manager.users.makefu = { programs.direnv.enable = true; - programs.direnv.enableNixDirenvIntegration = true; + programs.direnv.nix-direnv.enable = true; programs.direnv.enableZshIntegration = true; home.packages = [ (pkgs.writeDashBin "nixify" '' test ! -e shell.nix && cat > shell.nix < Date: Mon, 6 Jun 2022 21:22:25 +0200 Subject: ma dl.euer: ensure download is member of nginx group --- makefu/2configs/nginx/dl.euer.krebsco.de.nix | 1 + makefu/2configs/nginx/euer.blog.nix | 1 + 2 files changed, 2 insertions(+) diff --git a/makefu/2configs/nginx/dl.euer.krebsco.de.nix b/makefu/2configs/nginx/dl.euer.krebsco.de.nix index 5380d8437..e31d355a7 100644 --- a/makefu/2configs/nginx/dl.euer.krebsco.de.nix +++ b/makefu/2configs/nginx/dl.euer.krebsco.de.nix @@ -1,6 +1,7 @@ { config, lib, pkgs, ... }: { + users.groups.download.members = [ "nginx" ]; services.nginx = { enable = lib.mkDefault true; recommendedGzipSettings = true; diff --git a/makefu/2configs/nginx/euer.blog.nix b/makefu/2configs/nginx/euer.blog.nix index 14d1285db..24696adf2 100644 --- a/makefu/2configs/nginx/euer.blog.nix +++ b/makefu/2configs/nginx/euer.blog.nix @@ -35,6 +35,7 @@ in { #serverAliases = [ "blog.euer.krebsco.de" "blog.${hostname}" ]; enableACME = true; forceSSL = true; + default = true; root = base-dir; }; }; -- cgit v1.3.1 From 793b57fb6b8bb917d61319f82acc7dcedeff7244 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:22:48 +0200 Subject: ma gum: move /var/backup to cloud --- makefu/1systems/gum/config.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/makefu/1systems/gum/config.nix b/makefu/1systems/gum/config.nix index f47289e06..ff0c18795 100644 --- a/makefu/1systems/gum/config.nix +++ b/makefu/1systems/gum/config.nix @@ -148,6 +148,10 @@ in { device = "/media/cloud/nextcloud-data"; options = [ "bind" ]; }; + fileSystems."/var/backup" = { + device = "/media/cloud/gum-backup"; + options = [ "bind" ]; + }; } -- cgit v1.3.1 From bb17cfb266e84b33457101ba67710eb2136eea08 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:23:04 +0200 Subject: ma printer: enable ptouch --- makefu/2configs/printer.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/makefu/2configs/printer.nix b/makefu/2configs/printer.nix index 72b9dadd6..210a9df33 100644 --- a/makefu/2configs/printer.nix +++ b/makefu/2configs/printer.nix @@ -11,6 +11,7 @@ in { cups-dymo # dymo labelwriter foo2zjs # magicolor 1690mf cups-zj-58 + cups-ptouch ]; }; -- cgit v1.3.1 From 2819c4e1d9c0930653aa1c69fcbd8907e48a4930 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:23:41 +0200 Subject: ma tinc/retiolum: do not pin connectTo --- makefu/2configs/tinc/retiolum.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/makefu/2configs/tinc/retiolum.nix b/makefu/2configs/tinc/retiolum.nix index a2b24d35a..d1cfc2f88 100644 --- a/makefu/2configs/tinc/retiolum.nix +++ b/makefu/2configs/tinc/retiolum.nix @@ -10,7 +10,6 @@ LocalDiscovery = no ''} ''; - #krebs.tinc.retiolum.connectTo = [ "gum" ]; environment.systemPackages = [ pkgs.tinc ]; networking.firewall.allowedTCPPorts = [ config.krebs.build.host.nets.retiolum.tinc.port ]; networking.firewall.allowedUDPPorts = [ config.krebs.build.host.nets.retiolum.tinc.port ]; -- cgit v1.3.1 From 6966e7ee8d53d2674c70e76441a3115952f42d07 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:24:11 +0200 Subject: ma torrent/rtorrent: use upstream rtorrent service --- makefu/2configs/torrent/rtorrent.nix | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/makefu/2configs/torrent/rtorrent.nix b/makefu/2configs/torrent/rtorrent.nix index 79325bfc7..87ecc1e19 100644 --- a/makefu/2configs/torrent/rtorrent.nix +++ b/makefu/2configs/torrent/rtorrent.nix @@ -7,15 +7,17 @@ let daemon-port = 58846; dldir = config.makefu.dl-dir; in { - services.rtorrent.enable = true; - services.rtorrent.user = "rtorrent"; - services.rtorrent.group = "download"; - services.rtorrent.downloadDir = dldir; - services.rtorrent.configText = '' - schedule2 = watch_start, 10, 10, ((load.start, (cat, (cfg.watch), "/media/cloud/watch/*.torrent"))) - ''; - - services.rtorrent.openFirewall = true; + services.rtorrent = { + enable = true; + user = "rtorrent"; + port = peer-port; + openFirewall = true; + group = "download"; + downloadDir = dldir; + configText = '' + schedule2 = watch_start, 10, 10, ((load.start, (cat, (cfg.watch), "/media/cloud/watch/*.torrent"))) + ''; + }; systemd.services.flood = { wantedBy = [ "multi-user.target" ]; -- cgit v1.3.1 From 6630d29d4477c3e45bc57dced6fa97f49eb4886f Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:24:48 +0200 Subject: ma urlwatch: do not follow exfat-nofuse --- makefu/2configs/urlwatch/default.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/makefu/2configs/urlwatch/default.nix b/makefu/2configs/urlwatch/default.nix index 3620bc568..e6952fdbc 100644 --- a/makefu/2configs/urlwatch/default.nix +++ b/makefu/2configs/urlwatch/default.nix @@ -21,7 +21,6 @@ in { ## No rate limit ## rate limited - # https://api.github.com/repos/dorimanx/exfat-nofuse/commits # https://api.github.com/repos/mcepl/gen-oath-safe/commits https://api.github.com/repos/naim94a/udpt/commits https://api.github.com/repos/dirkvdb/ps3netsrv--/commits @@ -58,7 +57,6 @@ in { "embray/d2to1" "vicious-widgets/vicious" "embray/d2to1" - "dorimanx/exfat-nofuse" "rapid7/metasploit-framework" "GothenburgBitFactory/taskserver" "GothenburgBitFactory/taskwarrior" -- cgit v1.3.1 From e8eeaace1a1efc3eaae2b0475de93be210f82558 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:25:30 +0200 Subject: ma wireguard/server: clean up --- makefu/2configs/wireguard/server.nix | 88 ++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 39 deletions(-) diff --git a/makefu/2configs/wireguard/server.nix b/makefu/2configs/wireguard/server.nix index c8fbfe6fb..bda250702 100644 --- a/makefu/2configs/wireguard/server.nix +++ b/makefu/2configs/wireguard/server.nix @@ -1,59 +1,69 @@ -{ config, ... }: +{ config,pkgs, ... }: let ext-if = config.makefu.server.primary-itf; in { # wireguard server # opkg install wireguard luci-proto-wireguard - # TODO: networking.nat - # boot.kernel.sysctl."net.ipv4.ip_forward" = 1; # conf.all.proxy_arp =1 networking.firewall = { allowedUDPPorts = [ 51820 ]; - extraCommands = '' - iptables -t nat -A POSTROUTING -s 10.244.0.0/24 -o ${ext-if} -j MASQUERADE - ''; + }; + networking.nat = { + enable = true; + #externalIP = "144.76.26.247"; + #internalIPs = [ "10.244.0.0/24" ]; + externalInterface = ext-if; + internalInterfaces = [ "wg0" ]; }; networking.wireguard.interfaces.wg0 = { ips = [ "10.244.0.1/24" ]; listenPort = 51820; privateKeyFile = (toString ) + "/wireguard.key"; - allowedIPsAsRoutes = true; + # allowedIPsAsRoutes = true; + postSetup = '' + ${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.244.0.0/24 -o ${ext-if} -j MASQUERADE + ''; + + # This undoes the above command + postShutdown = '' + ${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.244.0.0/24 -o ${ext-if} -j MASQUERADE + ''; peers = [ - { - # x - allowedIPs = [ "10.244.0.2/32" ]; - publicKey = "fe5smvKVy5GAn7EV4w4tav6mqIAKhGWQotm7dRuRt1g="; - } - { - # vbob - allowedIPs = [ "10.244.0.3/32" ]; - publicKey = "Lju7EsCu1OWXhkhdNR7c/uiN60nr0TUPHQ+s8ULPQTw="; - } - { - # x-test - allowedIPs = [ "10.244.0.4/32" ]; - publicKey = "vZ/AJpfDLJyU3DzvYeW70l4FNziVgSTumA89wGHG7XY="; - } - { - # work-router - persistentKeepalive = 25; - allowedIPs = [ "10.244.0.5/32" ]; - publicKey = "QJMwwYu/92koCASbHnR/vqe/rN00EV6/o7BGwLockDw="; - } - { - # workr - persistentKeepalive = 25; - allowedIPs = [ "10.244.0.6/32" ]; - publicKey = "OFhCF56BrV9tjqW1sxqXEKH/GdqamUT1SqZYSADl5GA="; - } - { - # mobile - allowedIPs = [ "10.244.0.7/32" ]; - publicKey = "Y6fOW2QDt0SsHT7hSVzzJYQVB3JI/txO4/FDB54Z52A="; - } + { + # x + allowedIPs = [ "10.244.0.2/32" ]; + publicKey = "fe5smvKVy5GAn7EV4w4tav6mqIAKhGWQotm7dRuRt1g="; + } + { + # vbob + allowedIPs = [ "10.244.0.3/32" ]; + publicKey = "Lju7EsCu1OWXhkhdNR7c/uiN60nr0TUPHQ+s8ULPQTw="; + } + { + # x-test + allowedIPs = [ "10.244.0.4/32" ]; + publicKey = "vZ/AJpfDLJyU3DzvYeW70l4FNziVgSTumA89wGHG7XY="; + } + { + # work-router + persistentKeepalive = 25; + allowedIPs = [ "10.244.0.5/32" ]; + publicKey = "QJMwwYu/92koCASbHnR/vqe/rN00EV6/o7BGwLockDw="; + } + { + # workr + persistentKeepalive = 25; + allowedIPs = [ "10.244.0.6/32" ]; + publicKey = "OFhCF56BrV9tjqW1sxqXEKH/GdqamUT1SqZYSADl5GA="; + } + { + # mobile + allowedIPs = [ "10.244.0.7/32" ]; + publicKey = "Y6fOW2QDt0SsHT7hSVzzJYQVB3JI/txO4/FDB54Z52A="; + } ]; }; # TODO: this issue is related to the router which connects to the host but is -- cgit v1.3.1 From cd1e86e682e06c9845de563ab3e8bbf79ec27742 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:26:07 +0200 Subject: ma pkgs.tw-upload-plugin: bump --- makefu/5pkgs/tw-upload-plugin/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/makefu/5pkgs/tw-upload-plugin/default.nix b/makefu/5pkgs/tw-upload-plugin/default.nix index 8bc675847..076867f35 100644 --- a/makefu/5pkgs/tw-upload-plugin/default.nix +++ b/makefu/5pkgs/tw-upload-plugin/default.nix @@ -3,6 +3,6 @@ pkgs.fetchFromGitHub { owner = "makefu"; repo = "tw-upload-plugin"; - rev = "621e5fbe"; - sha256 = "1wjy76s5mr6z772w6sr0dwqxaxn45c7ys4a5y2v55hxclr096dqg"; + rev = "aa95fc1"; + sha256 = "1nyx5jl4gd5nrrksjl4sz7f4ksg89p29znvd2fahd6dizs1vcw87"; } -- cgit v1.3.1 From aaf2982eb4dd6c439b6b70647ff03d2f195c6c81 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:26:23 +0200 Subject: ma pkgs.cups-ptouch: init --- makefu/5pkgs/cups-ptouch/default.nix | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 makefu/5pkgs/cups-ptouch/default.nix diff --git a/makefu/5pkgs/cups-ptouch/default.nix b/makefu/5pkgs/cups-ptouch/default.nix new file mode 100644 index 000000000..be0dd1663 --- /dev/null +++ b/makefu/5pkgs/cups-ptouch/default.nix @@ -0,0 +1,55 @@ +{ lib, stdenv +, fetchFromGitHub +, autoreconfHook +, gd +, libusb1 +, cups +, libpng +, perl +, perlPackages +, libxml2 +, callPackage +, foomatic-db-engine ? ( callPackage ../foomatic-db-engine {} ) +}: + +stdenv.mkDerivation rec { + pname = "printer-driver-ptouch"; + version = "1.6"; + + src = fetchFromGitHub { + owner = "philpem"; + repo = "printer-driver-ptouch"; + rev = "v${version}"; + sha256 = "1c4hkncnr4qwkbz5dfvksngvq057j6xnbi1jjvchnlr7zgj7cndk"; + }; + + postPatch = '' + patchShebangs foomaticalize + ''; + nativeBuildInputs = [ + autoreconfHook + perl + libxml2 + perlPackages.XMLLibXML + foomatic-db-engine + ]; + + buildInputs = [ + cups + libpng + ]; + postInstall = '' + mkdir -p $out/share/cups/model/ + echo "dummy dummy" > "$out/share/foomatic/db/oldprinterids" + FOOMATICDB="$out/share/foomatic" foomatic-compiledb -t ppd -d "$out/share/cups/model/Brother/" + rm -r $out/share/foomatic + ''; + + meta = with lib; { + description = "Command line tool to print labels on Brother P-Touch printers on Linux"; + license = licenses.gpl3Plus; + homepage = "https://mockmoon-cybernetics.ch/computer/p-touch2430pc/"; + maintainers = with maintainers; [ shamilton ]; + platforms = platforms.linux; + }; +} -- cgit v1.3.1 From 68441cd9bcefc2aa94006abdb272b9803c588aac Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:26:40 +0200 Subject: ma pkgs.foomatic-db-engine: init --- makefu/5pkgs/foomatic-db-engine/default.nix | 86 +++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 makefu/5pkgs/foomatic-db-engine/default.nix diff --git a/makefu/5pkgs/foomatic-db-engine/default.nix b/makefu/5pkgs/foomatic-db-engine/default.nix new file mode 100644 index 000000000..242232c88 --- /dev/null +++ b/makefu/5pkgs/foomatic-db-engine/default.nix @@ -0,0 +1,86 @@ +{ lib, stdenv +, fetchFromGitHub +, autoreconfHook +, gd +, libusb1 +, cups +, libpng +, perl +, perlPackages +, libxml2 +, ghostscript +, a2ps +, wget +, file +, foomatic-filters +, makeWrapper +}: + +stdenv.mkDerivation rec { + pname = "foomatic-db-engine"; + version = "2020-01-31"; + + src = fetchFromGitHub { + owner = "OpenPrinting"; + repo = "foomatic-db-engine-4"; + rev = "bd265b77a9f66f672bf1e3f0803145f2eccabf06"; + sha256 = "1f53kd3b0sxgx7hg2dvw2624bpwdfcx0zh4dn0h89l84mirgw1bs"; + }; + + nativeBuildInputs = [ + autoreconfHook + perl + makeWrapper + ]; + postConfigure = '' + sed -i "s#$ENV{BINDIR}#${placeholder "out"}/bin#" makeDefaults + ''; + configureFlags = [ + #"PERL_INSTALLDIRS=vendor" + "PERL_INSTALLDIRS=site" + "--prefix=/" + "PERLPREFIX=/" + #"DESTDIR=$(out)" + #"sysconfdir=/etc" + "LIBDIR=/lib" + #"PERL_INSTALLDIRS=site" + #"PERL_INSTALLDIRS=perl" + #PERL_INSTALLDIRS=perl" + "PERL=${perl}/bin/perl" + "FILEUTIL=${file}/bin/file" + "SBINDIR=/bin" + ]; + makeFlags = [ + "DESTDIR=${placeholder "out"}" + "PERLLIB=$(out)/${perlPackages.perl.libPrefix}" + ]; + + buildInputs = [ + cups + ghostscript + a2ps + wget + perl + libxml2 + file + foomatic-filters + ]; + postFixup = '' + echo cups > "$out"/etc/foomatic/defaultspooler + + for file in $out/bin/foomatic-*;do + wrapProgram "$file" \ + --set PERL5LIB "$out/${perlPackages.perl.libPrefix}" \ + --prefix PATH : "$out/bin" + done + + ''; + + meta = with lib; { + description = "Command line tool to print labels on Brother P-Touch printers on Linux"; + license = licenses.gpl3Plus; + homepage = "https://mockmoon-cybernetics.ch/computer/p-touch2430pc/"; + maintainers = with maintainers; [ shamilton ]; + platforms = platforms.linux; + }; +} -- cgit v1.3.1 From 1f4f51cbf154fbb0eb688c5eba32d2e182f55c93 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:27:50 +0200 Subject: ma pkgs.ptouch-print: init at 1.5-master --- makefu/5pkgs/ptouch-print/default.nix | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 makefu/5pkgs/ptouch-print/default.nix diff --git a/makefu/5pkgs/ptouch-print/default.nix b/makefu/5pkgs/ptouch-print/default.nix new file mode 100644 index 000000000..9bac9bb35 --- /dev/null +++ b/makefu/5pkgs/ptouch-print/default.nix @@ -0,0 +1,45 @@ +{ lib, stdenv +, fetchgit +, cmake +, gd +, git +, libusb1 +, gettext +, pkg-config +}: + +stdenv.mkDerivation rec { + pname = "ptouch-print"; + version = "1.5-master"; + + src = fetchgit { + url = "https://git.familie-radermacher.ch/cgi/cgit/linux/ptouch-print.git"; + rev = "674e0da5fb6254c4f015c6c910377b6f4f04e0f3"; + sha256 = "04a3kp01mvf538l9d6bw2b54azn64xh605qwaq1ig8imjphrn82s"; + }; + + nativeBuildInputs = [ + cmake + git + ]; + + installPhase = '' + install -D ptouch-print $out/bin/ptouch-print + install -D $src/ptouch-print.1 $out/share/man/man1/ptouch-print.1 + ''; + + buildInputs = [ + gd + pkg-config + gettext + libusb1 + ]; + + meta = with lib; { + description = "Command line tool to print labels on Brother P-Touch printers on Linux"; + license = licenses.gpl3Plus; + homepage = "https://mockmoon-cybernetics.ch/computer/p-touch2430pc/"; + maintainers = with maintainers; [ shamilton ]; + platforms = platforms.linux; + }; +} -- cgit v1.3.1 From 7bc97fcbac0b2978de9ac9f1ecaaadc75c55a5a3 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:30:02 +0200 Subject: ma hw: add support for nswitch --- makefu/2configs/hw/nswitch.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 makefu/2configs/hw/nswitch.nix diff --git a/makefu/2configs/hw/nswitch.nix b/makefu/2configs/hw/nswitch.nix new file mode 100644 index 000000000..56e122cbf --- /dev/null +++ b/makefu/2configs/hw/nswitch.nix @@ -0,0 +1,14 @@ +{ config, lib, pkgs, ... }: + +{ + + users.extraUsers.${config.krebs.build.user.name}.extraGroups = [ "dialout" ]; + + # 1: USB + # 2: RCM + services.udev.extraRules = '' + SUBSYSTEM=="usb", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="3000", MODE="0660" ,GROUP="dialout" + SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7321", MODE="0660", GROUP="dialout" + ''; +} + -- cgit v1.3.1 From 6087a17922c6b0b061b50cd2fa48de5597295f4a Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:30:20 +0200 Subject: ma torrent/deluge: init --- makefu/2configs/torrent/deluge.nix | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 makefu/2configs/torrent/deluge.nix diff --git a/makefu/2configs/torrent/deluge.nix b/makefu/2configs/torrent/deluge.nix new file mode 100644 index 000000000..af965fbe9 --- /dev/null +++ b/makefu/2configs/torrent/deluge.nix @@ -0,0 +1,42 @@ +{ config, pkgs, ... }: +let + base = config.makefu.dl-dir; + daemon-port = 58846; + peer-port = 51412; + web-port = 8112; + secfile = toString + "/deluge-auth"; + authfile = config.services.deluge.dataDir + "/myauth"; +in { + services.deluge = { + enable = true; + package = pkgs.deluge-2_x; + openFilesLimit = 65355; + declarative = true; + config = { + download_location = base + "/finished"; + allow_remote = true; + inherit daemon-port; + listen_ports = [ peer-port ]; + copy_torrent_file = true; + torrentfiles_location = base + "/torrents"; + max_active_seeding = 50; + max_connections_global = 1000; + max_half_open_connections = 200; + enabled_plugins = [ "AutoAdd" ]; + }; + openFirewall = true; + group = "download"; + authFile = authfile; + web = { + enable = true; + port = web-port; + }; + }; + + #systemd.services.deluged.serviceConfig.ExecStartPre = pkgs.writeDash "install-auth" '' + # install -odeluge "$secfile" "$authfile" + #''; + services.nginx.enable = true; + services.nginx.virtualHosts."torrent.${config.krebs.build.host.name}.r".locations."/" = { proxyPass = "http://localhost:${toString web-port}/"; }; + state = [ "/var/lib/deluge/.config/deluge" ]; +} -- cgit v1.3.1 From ffdb73bed516bda154bb1c460a5e91eaaa6093da Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:34:02 +0200 Subject: ma retiolum: temporarily add helper script for retioum --- krebs/3modules/makefu/retiolum/doit.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 krebs/3modules/makefu/retiolum/doit.sh diff --git a/krebs/3modules/makefu/retiolum/doit.sh b/krebs/3modules/makefu/retiolum/doit.sh new file mode 100755 index 000000000..1a2657599 --- /dev/null +++ b/krebs/3modules/makefu/retiolum/doit.sh @@ -0,0 +1,19 @@ +#!/bin/sh + + +for i in *.pub;do + sleep 1 + host=${i%%.pub} + if test -e "${host}_ed25519.pub" ;then + echo "ed25519 key already exits" + else + tmpdir=$(mktemp --tmpdir -d create-retiolum-ed25519-keys.XXXXXXXX) + trap 'rm -vR "$tmpdir"' EXIT + tinc --batch --config "$tmpdir" generate-ed25519-keys + + cp -v "$tmpdir/ed25519_key.pub" "${host}_ed25519.pub" + cat "$tmpdir/ed25519_key.priv" | secrets insert -m "$host/retiolum.ed25519_key.priv" + rm -vR "$tmpdir" + fi + +done -- cgit v1.3.1 From cb31764b6d121605d482244f4e17bc3c36e50634 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:35:21 +0200 Subject: ma retioum: remove wrapper script --- krebs/3modules/makefu/retiolum/doit.sh | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100755 krebs/3modules/makefu/retiolum/doit.sh diff --git a/krebs/3modules/makefu/retiolum/doit.sh b/krebs/3modules/makefu/retiolum/doit.sh deleted file mode 100755 index 1a2657599..000000000 --- a/krebs/3modules/makefu/retiolum/doit.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - - -for i in *.pub;do - sleep 1 - host=${i%%.pub} - if test -e "${host}_ed25519.pub" ;then - echo "ed25519 key already exits" - else - tmpdir=$(mktemp --tmpdir -d create-retiolum-ed25519-keys.XXXXXXXX) - trap 'rm -vR "$tmpdir"' EXIT - tinc --batch --config "$tmpdir" generate-ed25519-keys - - cp -v "$tmpdir/ed25519_key.pub" "${host}_ed25519.pub" - cat "$tmpdir/ed25519_key.priv" | secrets insert -m "$host/retiolum.ed25519_key.priv" - rm -vR "$tmpdir" - fi - -done -- cgit v1.3.1 From 04f428e42f4cddb43ebf7cbec58802828cd1e7b8 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 21:35:47 +0200 Subject: ma krops: add nix-ld --- makefu/krops.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/makefu/krops.nix b/makefu/krops.nix index da6e38e7e..2757519a6 100644 --- a/makefu/krops.nix +++ b/makefu/krops.nix @@ -17,6 +17,7 @@ arm6 = false; clever_kexec = false; home-manager = false; + nix-ld = false; } // import (./. + "/1systems/${name}/source.nix"); source = { test }: lib.evalSource [ { @@ -77,10 +78,17 @@ ref = "a0d8383"; }; }) + + (lib.mkIf ( host-src.nix-ld ) { + nix-ld.git = { + url = https://github.com/Mic92/nix-ld.git; + ref = "eb9cb8d"; + }; + }) (lib.mkIf ( host-src.home-manager ) { home-manager.git = { url = https://github.com/rycee/home-manager; - ref = "6ce1d64073f48b9bc9425218803b1b607454c1e7"; + ref = "426ab2cf111fca61308bd86fe652e14aa12cc2d2"; }; }) ]; -- cgit v1.3.1 From 56cb9de375f66e5c2d8d465d830aaea2040587bc Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 22:26:40 +0200 Subject: ma pkgs.ratt: override default --- makefu/5pkgs/ratt/default.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 makefu/5pkgs/ratt/default.nix diff --git a/makefu/5pkgs/ratt/default.nix b/makefu/5pkgs/ratt/default.nix new file mode 100644 index 000000000..392f1ff9e --- /dev/null +++ b/makefu/5pkgs/ratt/default.nix @@ -0,0 +1,26 @@ +{ buildGoModule, fetchFromSourcehut, lib }: +buildGoModule rec { + pname = "ratt"; + version = "unstable-2022-05-09"; + + src = fetchFromSourcehut { + owner = "~ghost08"; + repo = "ratt"; + rev = "bf539e1cb04017f5e9d248a8e5f7a6f22f77d06e"; + sha256 = "0pfz6wnmpwabklayah3bddxkhvg64f5hfyvzkv3xfqpw8c70jdll"; + }; + + proxyVendor = true; + vendorSha256 = "0wf299i5z86gysrcmgd5x6zq589qn7h69k1sz4xl5yrhn53mdsq0"; + + # tests try to access the internet to scrape websites + doCheck = false; + + meta = with lib; { + description = "A tool for converting websites to rss/atom feeds"; + homepage = "https://git.sr.ht/~ghost08/ratt"; + license = licenses.mit; + maintainers = with maintainers; [ kmein ]; + platforms = platforms.linux ++ platforms.darwin; + }; +} -- cgit v1.3.1 From 1e405be047a79e1abd0c28e52b5009b9675909b8 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 6 Jun 2022 22:31:40 +0200 Subject: ma rss/ratt: use overwritten package --- makefu/2configs/deployment/rss/ratt.nix | 2 +- makefu/5pkgs/ratt/default.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/makefu/2configs/deployment/rss/ratt.nix b/makefu/2configs/deployment/rss/ratt.nix index b794d9201..2e7ecb45d 100644 --- a/makefu/2configs/deployment/rss/ratt.nix +++ b/makefu/2configs/deployment/rss/ratt.nix @@ -7,7 +7,7 @@ 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 ]; + path = with pkgs; [ ratt xmlstarlet ]; script = builtins.readFile ./ratt-hourly.sh; scriptArgs = "${./urls} ${out-path}"; diff --git a/makefu/5pkgs/ratt/default.nix b/makefu/5pkgs/ratt/default.nix index 392f1ff9e..57ea545b9 100644 --- a/makefu/5pkgs/ratt/default.nix +++ b/makefu/5pkgs/ratt/default.nix @@ -11,7 +11,7 @@ buildGoModule rec { }; proxyVendor = true; - vendorSha256 = "0wf299i5z86gysrcmgd5x6zq589qn7h69k1sz4xl5yrhn53mdsq0"; + vendorSha256 = "sha256-901xkzF/p/kUy7tZELwNhgepRDScUeWQM3isy7APuik="; # tests try to access the internet to scrape websites doCheck = false; -- cgit v1.3.1 From e26ca7c3a2489d3afbfae4d3c12f8fdb000aa088 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 7 Jun 2022 00:28:47 +0200 Subject: ma pkgs: msf -> metasploit --- makefu/2configs/tools/android-pentest.nix | 2 +- makefu/2configs/tools/sec.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/makefu/2configs/tools/android-pentest.nix b/makefu/2configs/tools/android-pentest.nix index 1f622a8e0..cb4ca24a8 100644 --- a/makefu/2configs/tools/android-pentest.nix +++ b/makefu/2configs/tools/android-pentest.nix @@ -5,7 +5,7 @@ users.users.makefu.packages = with pkgs; [ # mitmproxy nmap - msf + metasploit #drozer #dex2jar apktool diff --git a/makefu/2configs/tools/sec.nix b/makefu/2configs/tools/sec.nix index acc22d647..6b7aa4fec 100644 --- a/makefu/2configs/tools/sec.nix +++ b/makefu/2configs/tools/sec.nix @@ -9,7 +9,7 @@ iodine mtr nmap - msf + metasploit thc-hydra borgbackup ledger -- cgit v1.3.1 From a73793fa16b69ec82fb62f1b1b516b8ecb9b5b59 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 7 Jun 2022 00:34:33 +0200 Subject: ma nextcloud: 22 -> 23 --- makefu/2configs/deployment/owncloud.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefu/2configs/deployment/owncloud.nix b/makefu/2configs/deployment/owncloud.nix index 33a6a4ea2..e5c7e48de 100644 --- a/makefu/2configs/deployment/owncloud.nix +++ b/makefu/2configs/deployment/owncloud.nix @@ -57,7 +57,7 @@ systemd.services.postgresqlBackup-nextcloud.serviceConfig.SupplementaryGroups = users.users.nextcloud.extraGroups = [ "download" ]; services.nextcloud = { enable = true; - package = pkgs.nextcloud22; + package = pkgs.nextcloud23; hostName = "o.euer.krebsco.de"; # Use HTTPS for links https = true; -- cgit v1.3.1 From 53855cd2d0dadb159215c5ed12e6d0be02dca98b Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 7 Jun 2022 13:53:44 +0200 Subject: ma rss: remove postgresql pinning --- makefu/2configs/deployment/rss/rss.euer.krebsco.de.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/makefu/2configs/deployment/rss/rss.euer.krebsco.de.nix b/makefu/2configs/deployment/rss/rss.euer.krebsco.de.nix index 5bebb7c3b..7e077d7e4 100644 --- a/makefu/2configs/deployment/rss/rss.euer.krebsco.de.nix +++ b/makefu/2configs/deployment/rss/rss.euer.krebsco.de.nix @@ -10,7 +10,6 @@ in { selfUrlPath = "https://${fqdn}"; }; - services.postgresql.package = pkgs.postgresql_9_6; state = [ config.services.postgresqlBackup.location ]; services.postgresqlBackup = { -- cgit v1.3.1