diff options
Diffstat (limited to 'krebs')
-rw-r--r-- | krebs/2configs/syncthing.nix | 8 | ||||
-rw-r--r-- | krebs/3modules/external/kmein.nix | 1 | ||||
-rw-r--r-- | krebs/3modules/makefu/default.nix | 3 | ||||
-rw-r--r-- | krebs/3modules/tinc.nix | 3 | ||||
-rw-r--r-- | krebs/5pkgs/simple/krebsdance/default.nix | 157 | ||||
-rw-r--r-- | krebs/5pkgs/simple/reaktor2-plugins.nix | 6 |
6 files changed, 166 insertions, 12 deletions
diff --git a/krebs/2configs/syncthing.nix b/krebs/2configs/syncthing.nix index 125e2aea4..dac1863d5 100644 --- a/krebs/2configs/syncthing.nix +++ b/krebs/2configs/syncthing.nix @@ -8,11 +8,9 @@ in { services.syncthing = { enable = true; configDir = "/var/lib/syncthing"; - declarative = { - devices = mk_peers used_peers; - key = toString <secrets/syncthing.key>; - cert = toString <secrets/syncthing.cert>; - }; + devices = mk_peers used_peers; + key = toString <secrets/syncthing.key>; + cert = toString <secrets/syncthing.cert>; }; boot.kernel.sysctl."fs.inotify.max_user_watches" = 524288; diff --git a/krebs/3modules/external/kmein.nix b/krebs/3modules/external/kmein.nix index 9ef079090..1e4a68057 100644 --- a/krebs/3modules/external/kmein.nix +++ b/krebs/3modules/external/kmein.nix @@ -123,6 +123,7 @@ in "zaatar.kmein.r" "grocy.kmein.r" "moodle.kmein.r" + "radio.kmein.r" ]; tinc.pubkey = '' -----BEGIN RSA PUBLIC KEY----- diff --git a/krebs/3modules/makefu/default.nix b/krebs/3modules/makefu/default.nix index 62316bfdb..b3c09db78 100644 --- a/krebs/3modules/makefu/default.nix +++ b/krebs/3modules/makefu/default.nix @@ -102,6 +102,7 @@ in { x = { ci = true; cores = 4; + syncthing.id = "OA36OF6-JEFCUJQ-OEYVTMH-DPCACQI-3AJRE5G-BFVMOUG-RPYJQE3-4ZCUWA5"; nets = { retiolum.ip4.addr = "10.243.0.91"; wiregrill = { @@ -121,7 +122,7 @@ in { omo = rec { ci = true; cores = 2; - + syncthing.id = "Y5OTK3S-JOJLAUU-KTBXKUW-M7S5UEQ-MMQPUK2-7CXO5V6-NOUDLKP-PRGAFAK"; nets = { retiolum = { ip4.addr = "10.243.0.89"; diff --git a/krebs/3modules/tinc.nix b/krebs/3modules/tinc.nix index 21ddde1c6..4a54d2950 100644 --- a/krebs/3modules/tinc.nix +++ b/krebs/3modules/tinc.nix @@ -233,6 +233,7 @@ with import <stockholm/lib>; cfg.iproutePackage cfg.tincPackage ]; + reloadIfChanged = true; serviceConfig = { Restart = "always"; LoadCredential = filter (x: x != "") [ @@ -260,7 +261,7 @@ with import <stockholm/lib>; "-o PrivateKeyFile=\${CREDENTIALS_DIRECTORY}/rsa_key" "--pidfile=/var/run/tinc.${netname}.pid" ]; - ExecReload = "${cfg.tincPackage}/sbin/tinc -n ${netname} reload"; + ExecReload = "${cfg.tincPackage}/sbin/tinc -n ${netname} restart"; SyslogIdentifier = netname; }; }) config.krebs.tinc; diff --git a/krebs/5pkgs/simple/krebsdance/default.nix b/krebs/5pkgs/simple/krebsdance/default.nix new file mode 100644 index 000000000..cdfe23ef2 --- /dev/null +++ b/krebs/5pkgs/simple/krebsdance/default.nix @@ -0,0 +1,157 @@ +{ writers }: +writers.writePython3Bin "krebsdance" { flakeIgnore = [ "E501" ]; } '' + import argparse + import random + import itertools + + claws = [ + dict( + up="(\\/)", + down="(/\\)", + left="(\\\\)", + right="(//)", + ), + dict( + up="(V)", + down="(A)", + left=">)=", + right="=(<", + ), + dict( + up="(U)", + down="(n)", + left=")==", + right="==(", + ), + ] + + eyes = [ + "°", + "*", + "^", + "ö", + "o", + "O", + "X", + "x", + "U", + "u", + ] + + bodies = [ + dict( + left="(", + right=")", + ), + dict( + left="{", + right="}", + ), + dict( + left="[", + right="]", + ), + dict( + left="<", + right=">", + ), + dict( + left="|", + right="|", + ), + ] + + mouths = [ + ",,,,", + ",mm,", + "_mm_", + "-mm-", + ";;;;", + ";mm;", + ":mm:", + "::::", + ":ww:", + ":<>:", + ] + + + def all_krebses(): + for mouth, body, eye, claw in itertools.product(mouths, bodies, eyes, claws): + yield f'{claw["up"]} {body["left"]}{eye}{mouth}{eye}{body["right"]} {claw["up"]}' + + + def escape_graph(text): + return text.replace("\\", "\\\\") + + + def krebs_graph() -> str: + return "\n".join(itertools.chain( + ["digraph {"], + [escape_graph(f'"{krebs}"->"{generate(seed=krebs)}"') for krebs in all_krebses()], + "}", + )) + + + def generate(*, seed: str, dancing: bool = False) -> str: + if seed: + random.seed(seed) + clawstyle = random.choice(claws) + body = random.choice(bodies) + eye = random.choice(eyes) + mouth = random.choice(mouths) + if dancing: + return "\n".join( + [ + f'{clawstyle["down"]} {body["left"]}{eye}{mouth}{eye}{body["right"]}{clawstyle["up"]}', + f'{clawstyle["left"]}{body["left"]}{eye}{mouth}{eye}{body["right"]} {clawstyle["right"]}', + f'{clawstyle["right"]} {body["left"]}{eye}{mouth}{eye}{body["right"]} {clawstyle["left"]}', + f'{clawstyle["down"]}{body["left"]}{eye}{mouth}{eye}{body["right"]}{clawstyle["down"]}', + ] + ) + else: + return f'{clawstyle["up"]} {body["left"]}{eye}{mouth}{eye}{body["right"]} {clawstyle["up"]}' + + + def fixpoints(): + for krebs in all_krebses(): + if generate(seed=krebs) == krebs: + yield krebs + + + def main(): + parser = argparse.ArgumentParser() + + parser.add_argument( + "seed", + nargs="?", + help="random seed to use for generating the krebs variant", + ) + + parser.add_argument( + "--dance", + "-d", + dest="dance", + help="if the krebs should dance", + default=False, + action="store_true", + ) + + parser.add_argument( + "--mode", + "-m", + dest="mode", + choices=["graphviz", "plain"], + default="plain", + ) + + args = parser.parse_args() + + if args.mode == "plain": + print(generate(seed=args.seed, dancing=args.dance)) + elif args.mode == "graphviz": + print(krebs_graph()) + + + if __name__ == "__main__": + main() +'' diff --git a/krebs/5pkgs/simple/reaktor2-plugins.nix b/krebs/5pkgs/simple/reaktor2-plugins.nix index 54aaf246a..052e389a6 100644 --- a/krebs/5pkgs/simple/reaktor2-plugins.nix +++ b/krebs/5pkgs/simple/reaktor2-plugins.nix @@ -23,11 +23,7 @@ rec { dance = { filename = pkgs.writeDash "dance" '' - echo "<(^.^<)" - echo "<(^.^)>" - echo "(>^.^)>" - echo "(7^.^)7" - echo "(>^.^<)" + ${pkgs.krebsdance}/bin/krebsdance --dance "$@"; ''; }; |