From 060a8f28fa1fc648bdf66afb31a5d1efac868837 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 28 Jul 2023 22:24:15 +0200 Subject: makefu: move out to own repo, add vacation-note --- makefu/2configs/lanparty/lancache-dns.nix | 70 -------------------------- makefu/2configs/lanparty/lancache.nix | 81 ------------------------------ makefu/2configs/lanparty/mumble-server.nix | 12 ----- makefu/2configs/lanparty/samba.nix | 40 --------------- 4 files changed, 203 deletions(-) delete mode 100644 makefu/2configs/lanparty/lancache-dns.nix delete mode 100644 makefu/2configs/lanparty/lancache.nix delete mode 100644 makefu/2configs/lanparty/mumble-server.nix delete mode 100644 makefu/2configs/lanparty/samba.nix (limited to 'makefu/2configs/lanparty') diff --git a/makefu/2configs/lanparty/lancache-dns.nix b/makefu/2configs/lanparty/lancache-dns.nix deleted file mode 100644 index c9da7c4c4..000000000 --- a/makefu/2configs/lanparty/lancache-dns.nix +++ /dev/null @@ -1,70 +0,0 @@ -{ pkgs, lib, config, ... }: -with import ; -let - upstream-server = "8.8.8.8"; - # make sure the router pins the ip address to the deployed host - # and set it as dns server ( dhcp option 6,192.168.10.10 ) - local_ip = "192.168.10.10"; - - extra-config = pkgs.writeText "local.conf" '' - server: - local-data: "piratebox. A ${local_ip}" - local-data: "store. A ${local_ip}" - local-data: "share. A ${local_ip}" - ''; - - - # see https://github.com/zeropingheroes/lancache for full docs - lancache-dns = pkgs.stdenv.mkDerivation rec { - name = "lancache-dns-2017-06-28"; - src = pkgs.fetchFromGitHub { - # forked: https://github.com/zeropingheroes/lancache-dns - repo = "lancache-dns"; - owner = "zeropingheroes"; - rev = "420aa62"; - sha256 = "0ik7by7ripdv2avyy5kk9jp1i7rz9ksc8xmg7n9iik365q9pv94m"; - }; - - phases = [ "unpackPhase" "installPhase" ]; - # here we have the chance to edit `includes/proxy-cache-paths.conf` - installPhase = '' - mkdir -p $out - cp -r * $out/ - ''; - }; - stateDir = "/var/lib/unbound"; - user = "unbound"; -in { - services.unbound = { - enable = true; - allowedAccess = [ "10.0.0.0/8" "172.16.0.0/12" "192.168.0.0/16" ]; - interfaces = ["0.0.0.0" "::" ]; - forwardAddresses = [ upstream-server ]; - extraConfig = '' - include: "${stateDir}/lancache/*.conf" - include: "${extra-config}" - ''; - }; - services.dnscrypt-proxy.enable = lib.mkForce false; - virtualisation.libvirtd.enable = lib.mkForce false; - systemd.services.dns-lancache-prepare = { - wantedBy = [ "unbound.service" ]; - before = [ "unbound.service" ]; - after = [ "network-online.target" ]; - partOf= [ "unbound.service" ]; - - path = [ pkgs.gawk pkgs.iproute pkgs.gnused ]; - script = '' - set -xeu - # current_ip=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $NF}') - current_ip=${local_ip} - old_ip=10.1.1.250 - mkdir -p ${stateDir} - rm -rvf ${stateDir}/lancache - cp -r ${lancache-dns}/upstreams-available ${stateDir}/lancache - sed -i "s/$old_ip/$current_ip/g" ${stateDir}/lancache/*.conf - chown -R unbound ${stateDir} - ''; - }; - networking.firewall.allowedUDPPorts = [ 53 ]; -} diff --git a/makefu/2configs/lanparty/lancache.nix b/makefu/2configs/lanparty/lancache.nix deleted file mode 100644 index bcacf2e15..000000000 --- a/makefu/2configs/lanparty/lancache.nix +++ /dev/null @@ -1,81 +0,0 @@ -{ pkgs, lib, config, ... }: -with import ; -let - # see https://github.com/zeropingheroes/lancache for full docs - lancache= pkgs.stdenv.mkDerivation rec { - name = "lancache-2017-06-26"; - src = pkgs.fetchFromGitHub { - # origin: https://github.com/multiplay/lancache - # forked: https://github.com/zeropingheroes/lancache - repo = "lancache"; - owner = "zeropingheroes"; - rev = "143f7bb"; - sha256 = "1ra4l7qz3k231j5wabr89s5hh80n1kk8vgd3dsh0xx5mdpjhvdl6"; - }; - phases = [ "unpackPhase" "installPhase" ]; - # here we can chance to edit `includes/proxy-cache-paths.conf` - installPhase = '' - mkdir -p $out - cp -r * $out/ - rm $out/caches-enabled/* - sed -i -e 's/^\(user\).*/\1 ${cfg.user} ${cfg.group};/' \ - -e '1 idaemon off;' \ - -e 's#/var/lancache#${cfg.statedir}#g' \ - $out/nginx.conf - sed -i -e 's#/var/lancache#${cfg.statedir}#g' \ - $out/*/*.conf - ln -s $out/caches-available/* $out/caches-enabled/ - ''; - }; - cfg = { - statedir = "/data/cache"; - - group = "nginx-lancache"; - user = "nginx-lancache"; - package = pkgs.stdenv.lib.overrideDerivation pkgs.nginx (old:{ - configureFlags = old.configureFlags ++ [ - "--with-http_slice_module" - "--with-stream" - "--with-pcre" - ]; - }); - }; -in { - systemd.services.nginx-lancache = { - description = "Nginx lancache Server"; - after = [ "network.target" ]; - wantedBy = [ "multi-user.target" ]; - restartIfChanged = true; - - preStart = '' - mkdir -p ${cfg.statedir} && cd ${cfg.statedir} - chmod 700 ${cfg.statedir} - PATH_CACHE=$PATH_BASE/cache - PATH_LOGS=$PATH_BASE/logs - - mkdir -p cache/{installers,tmp} logs - rm -f conf; ln -s ${lancache} conf - chown -R ${cfg.user}:${cfg.group} . - ''; - serviceConfig = { - ExecStart = "${cfg.package}/bin/nginx -p ${cfg.statedir}"; - ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; - Restart = "always"; - RestartSec = "10s"; - StartLimitInterval = "1min"; - }; - }; - - environment.etc.nginx.source = lancache; - users.extraUsers = (singleton - { name = cfg.user; - group = cfg.group; - uid = genid cfg.group; - }); - - users.extraGroups = (singleton - { name = "${cfg.group}"; - gid = genid cfg.group; - }); - networking.firewall.allowedTCPPorts = [ 80 443 ]; -} diff --git a/makefu/2configs/lanparty/mumble-server.nix b/makefu/2configs/lanparty/mumble-server.nix deleted file mode 100644 index 5b9631cd1..000000000 --- a/makefu/2configs/lanparty/mumble-server.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ config, ... }: -{ - networking.firewall.allowedTCPPorts = [ 64738 ]; - networking.firewall.allowedUDPPorts = [ 64738 ]; - services.murmur = { - enable = true; - welcometext = "Welcome to the LANest Party mumble server"; - bonjour = true; - hostName = "0.0.0.0"; - sendVersion = true; - }; -} diff --git a/makefu/2configs/lanparty/samba.nix b/makefu/2configs/lanparty/samba.nix deleted file mode 100644 index e2fa58c4b..000000000 --- a/makefu/2configs/lanparty/samba.nix +++ /dev/null @@ -1,40 +0,0 @@ -{config, ... }:{ - networking.firewall.allowedUDPPorts = [ 137 138 ]; - networking.firewall.allowedTCPPorts = [ 139 445 ]; - users.users.smbguest = { - name = "smbguest"; - uid = config.ids.uids.smbguest; #effectively systemUser - description = "smb guest user"; - home = "/data/lanparty"; - createHome = true; - group = "share"; - }; - users.groups.share = {}; - services.samba = { - enable = true; - enableNmbd = true; - shares = { - lanparty = { - path = "/data/lanparty/"; - "read only" = "yes"; - browseable = "yes"; - "guest ok" = "yes"; - }; - share = { - path = "/data/incoming"; - "read only" = "no"; - browseable = "yes"; - "guest ok" = "yes"; - }; - }; - extraConfig = '' - guest account = smbguest - map to guest = bad user - # disable printing - load printers = no - printing = bsd - printcap name = /dev/null - disable spoolss = yes - ''; - }; -} -- cgit v1.2.3