From 9cc3eea82d60dc5ed9f4de7c15d63ee162e639fb Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 10 Jun 2023 12:50:53 +0200 Subject: init flake.nix --- kartei/0x4A6F/default.nix | 6 +++--- kartei/dave/default.nix | 7 +++---- kartei/dbalan/default.nix | 8 ++++---- kartei/default.nix | 6 ++++-- kartei/feliks/default.nix | 8 ++++---- kartei/jan/default.nix | 7 +++---- kartei/jeschli/default.nix | 8 ++++---- kartei/kmein/default.nix | 8 ++++---- kartei/krebs/default.nix | 12 ++---------- kartei/lass/default.nix | 14 ++++++++------ kartei/makefu/default.nix | 13 ++++++------- kartei/mic92/default.nix | 3 +-- kartei/others/default.nix | 3 +-- kartei/oxzi/default.nix | 8 +++----- kartei/palo/default.nix | 4 ++-- kartei/rtunreal/default.nix | 4 ++-- kartei/srounce/default.nix | 6 ++---- kartei/template/default.nix | 4 +--- kartei/tv/default.nix | 15 +++++++-------- kartei/xkey/default.nix | 4 ++-- kartei/ynnel/default.nix | 7 ++----- 21 files changed, 68 insertions(+), 87 deletions(-) (limited to 'kartei') diff --git a/kartei/0x4A6F/default.nix b/kartei/0x4A6F/default.nix index 8939f267d..c06bddff1 100644 --- a/kartei/0x4A6F/default.nix +++ b/kartei/0x4A6F/default.nix @@ -1,12 +1,12 @@ -with import ../../lib; -{ config, ... }: let +{ config, lib, stockholm, ... }: +with lib; let hostDefaults = hostName: host: flip recursiveUpdate host ({ ci = false; external = true; monitoring = false; } // optionalAttrs (host.nets?retiolum) { nets.retiolum.ip6.addr = - (krebs.genipv6 "retiolum" "external" { inherit hostName; }).address; + (stockholm.lib.krebs.genipv6 "retiolum" "external" { inherit hostName; }).address; }); in { users = { diff --git a/kartei/dave/default.nix b/kartei/dave/default.nix index 053ec412b..c73582749 100644 --- a/kartei/dave/default.nix +++ b/kartei/dave/default.nix @@ -1,6 +1,5 @@ -{ config, ... }: let - lib = import ../../lib; -in { +{ config, lib, stockholm, ... }: +{ users.dave = { mail = "hsngrmpf@gmail.com"; }; @@ -8,7 +7,7 @@ in { owner = config.krebs.users.dave; nets.retiolum = { aliases = [ "dave.r" ]; - ip6.addr = (lib.krebs.genipv6 "retiolum" "dave" { hostName = "dave"; }).address; + ip6.addr = (stockholm.lib.krebs.genipv6 "retiolum" "dave" { hostName = "dave"; }).address; ip4.addr = "10.243.0.6"; tinc.pubkey = '' -----BEGIN RSA PUBLIC KEY----- diff --git a/kartei/dbalan/default.nix b/kartei/dbalan/default.nix index fadf187db..ba63c5b6a 100644 --- a/kartei/dbalan/default.nix +++ b/kartei/dbalan/default.nix @@ -1,5 +1,5 @@ -with import ../../lib; -{ config, ... }: +{ config, lib, stockholm, ... }: +with lib; let hostDefaults = hostName: host: flip recursiveUpdate host ({ ci = false; @@ -8,11 +8,11 @@ let owner = config.krebs.users.dbalan; } // optionalAttrs (host.nets?retiolum) { nets.retiolum = { - ip6.addr = (krebs.genipv6 "retiolum" "external" { inherit hostName; }).address; + ip6.addr = (stockholm.lib.krebs.genipv6 "retiolum" "external" { inherit hostName; }).address; }; } // optionalAttrs (host.nets?wiregrill) { nets.wiregrill = { - ip6.addr = (krebs.genipv6 "wiregrill" "external" { inherit hostName; }).address; + ip6.addr = (stockholm.lib.krebs.genipv6 "wiregrill" "external" { inherit hostName; }).address; }; }); in diff --git a/kartei/default.nix b/kartei/default.nix index 6024e2351..3686bbb54 100644 --- a/kartei/default.nix +++ b/kartei/default.nix @@ -1,7 +1,9 @@ -{ config, lib, ... }: let +{ config, lib, pkgs, ... }: let removeTemplate = # TODO don't remove during CI lib.flip builtins.removeAttrs ["template"]; + + stockholm.lib = import ../lib/lib.nix { inherit lib; }; in { config = lib.mkMerge @@ -9,7 +11,7 @@ in { (name: _type: let path = ./. + "/${name}"; in { - krebs = import path { inherit config; }; + krebs = import path { inherit config lib stockholm; }; }) (removeTemplate (lib.filterAttrs diff --git a/kartei/feliks/default.nix b/kartei/feliks/default.nix index e98da7bc6..9f7f59164 100644 --- a/kartei/feliks/default.nix +++ b/kartei/feliks/default.nix @@ -1,5 +1,5 @@ -with import ../../lib; -{ config, ... }: let +{ config, lib, stockholm, ... }: +with lib; let hostDefaults = hostName: host: flip recursiveUpdate host ({ owner = config.krebs.users.feliks; ci = false; @@ -7,10 +7,10 @@ with import ../../lib; monitoring = false; } // optionalAttrs (host.nets?retiolum) { nets.retiolum.ip6.addr = - (krebs.genipv6 "retiolum" "external" { inherit hostName; }).address; + (stockholm.lib.krebs.genipv6 "retiolum" "external" { inherit hostName; }).address; } // optionalAttrs (host.nets?wiregrill) { nets.wiregrill.ip6.addr = - (krebs.genipv6 "wiregrill" "external" { inherit hostName; }).address; + (stockholm.lib.krebs.genipv6 "wiregrill" "external" { inherit hostName; }).address; }); in { users.feliks = { diff --git a/kartei/jan/default.nix b/kartei/jan/default.nix index 72b5cb331..aa3676e7f 100644 --- a/kartei/jan/default.nix +++ b/kartei/jan/default.nix @@ -1,6 +1,5 @@ -{ config, ... }: let - lib = import ../../lib; -in { +{ config, lib, stockholm, ... }: +{ users.jan = { mail = "jan.heidbrink@posteo.de"; @@ -67,7 +66,7 @@ in { nets.retiolum = { aliases = [ "grill.r" ]; ip4.addr = "10.243.217.217"; - ip6.addr = (lib.krebs.genipv6 "retiolum" "jan" { hostName = "grill"; }).address; + ip6.addr = (stockholm.lib.krebs.genipv6 "retiolum" "jan" { hostName = "grill"; }).address; tinc.pubkey = '' -----BEGIN RSA PUBLIC KEY----- MIICCgKCAgEAs4P6CfRcwFGCqkfv1tyTbbk2eHh08kEqxPNQ655sMKWxMhgRnRII diff --git a/kartei/jeschli/default.nix b/kartei/jeschli/default.nix index fe12c16a4..618d7f6c1 100644 --- a/kartei/jeschli/default.nix +++ b/kartei/jeschli/default.nix @@ -1,12 +1,12 @@ -with import ../../lib; -{ config, ... }: let - +{ config, lib, stockholm, ... }: +with lib; +let hostDefaults = hostName: host: flip recursiveUpdate host ({ ci = true; owner = config.krebs.users.jeschli; } // optionalAttrs (host.nets?retiolum) { nets.retiolum.ip6.addr = - (krebs.genipv6 "retiolum" "jeschli" { inherit hostName; }).address; + (stockholm.lib.krebs.genipv6 "retiolum" "jeschli" { inherit hostName; }).address; }); in { diff --git a/kartei/kmein/default.nix b/kartei/kmein/default.nix index 1a5a57d1a..d0b85ff71 100644 --- a/kartei/kmein/default.nix +++ b/kartei/kmein/default.nix @@ -1,5 +1,5 @@ -with import ../../lib; -{ config, ... }: +{ config, lib, stockholm, ... }: +with lib; let maybeEmpty = attrset: key: if (attrset?key) then attrset.${key} else []; hostDefaults = hostName: host: flip recursiveUpdate host ({ @@ -9,11 +9,11 @@ let owner = config.krebs.users.kmein; } // optionalAttrs (host.nets?retiolum) { nets.retiolum = { - ip6.addr = (krebs.genipv6 "retiolum" "external" { inherit hostName; }).address; + ip6.addr = (stockholm.lib.krebs.genipv6 "retiolum" "external" { inherit hostName; }).address; }; } // optionalAttrs (host.nets?wiregrill) { nets.wiregrill = { - ip6.addr = (krebs.genipv6 "wiregrill" "external" { inherit hostName; }).address; + ip6.addr = (stockholm.lib.krebs.genipv6 "wiregrill" "external" { inherit hostName; }).address; }; }); ssh-for = name: builtins.readFile (./ssh + "/${name}.pub"); diff --git a/kartei/krebs/default.nix b/kartei/krebs/default.nix index 414b66e9f..d07057dd5 100644 --- a/kartei/krebs/default.nix +++ b/kartei/krebs/default.nix @@ -1,5 +1,5 @@ -with import ../../lib; -{ config, ... }: let +{ config, lib, stockholm, ... }: with stockholm.lib; +let hostDefaults = hostName: host: flip recursiveUpdate host ({ owner = config.krebs.users.krebs; @@ -66,7 +66,6 @@ in { tinc.pubkey_ed25519 = "D5TYSZW9OAkdnvQ/NL98UgheRC2Zg4SMNZ8M4/KwdeL"; }; }; - ssh.privkey.path = ; ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKRpjW68lSlTL8jBQcXKOTdGa+olQw5ghaU5df2yAE64"; }; hotdog = { @@ -100,7 +99,6 @@ in { tinc.pubkey_ed25519 = "ugy/sGReVro3YzjDuroV/5hdeBdqD18no9dMhTy9DYL"; }; }; - ssh.privkey.path = ; ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICxFkBln23wUxt4RhIHE3GvdKeBpJbjn++6maupHqUHp"; }; news = { @@ -133,7 +131,6 @@ in { ''; }; }; - ssh.privkey.path = ; ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHl5cDF9QheXyMlNYIX17ILbgd94K50fZy7w0fDLvZlo "; }; onebutton = { @@ -161,7 +158,6 @@ in { ''; }; }; - ssh.privkey.path = ; ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAcZg+iLaPZ0SpLM+nANxIjZC/RIsansjyutK0+gPhIe "; }; ponte = { @@ -208,7 +204,6 @@ in { }; }; }; - ssh.privkey.path = ; ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJEw9fo8Qtb/DTLacdrJP7Ti7c4UXTm6wUUX+iRFweEo "; }; puyak = { @@ -234,7 +229,6 @@ in { ''; }; }; - ssh.privkey.path = ; ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPpVwKv9mQGfcn5oFwuitq+b6Dz4jBG9sGhVoCYFw5RY"; syncthing.id = "DK5CEE2-PNUXYCE-Q42H2HP-623GART-B7KS4VK-HU2RBGQ-EK6QPUP-HUL3PAR"; }; @@ -259,7 +253,6 @@ in { ''; }; }; - ssh.privkey.path = ; ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOu6EVN3928qWiWszqBUzOjeQJRvFozTBl4xAhBP/Ymc"; }; wolf = { @@ -296,7 +289,6 @@ in { ''; }; }; - ssh.privkey.path = ; ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKYMXMWZIK0jjnZDM9INiYAKcwjXs2241vew54K8veCR"; }; } // testHosts); diff --git a/kartei/lass/default.nix b/kartei/lass/default.nix index de776fca0..99e34083a 100644 --- a/kartei/lass/default.nix +++ b/kartei/lass/default.nix @@ -1,8 +1,7 @@ -with import ../../lib; -{ config, ... }: let +{ config, lib, stockholm, ... }: let - r6 = ip: (krebs.genipv6 "retiolum" "lass" ip).address; - w6 = ip: (krebs.genipv6 "wiregrill" "lass" ip).address; + r6 = ip: (stockholm.lib.krebs.genipv6 "retiolum" "lass" ip).address; + w6 = ip: (stockholm.lib.krebs.genipv6 "wiregrill" "lass" ip).address; hostFiles = builtins.map (lib.removeSuffix ".nix") ( builtins.filter @@ -14,14 +13,17 @@ in { dns.providers = { "lassul.us" = "zones"; }; - hosts = mapAttrs (_: recursiveUpdate { + hosts = lib.mapAttrs (_: lib.recursiveUpdate { owner = config.krebs.users.lass; consul = true; ci = true; monitoring = true; ssh.privkey.path = ; }) ( - lib.genAttrs hostFiles (host: import (./. + "/${host}.nix") { inherit config krebs lib r6 w6; }) + lib.genAttrs hostFiles (host: import (./. + "/${host}.nix") { + inherit config lib r6 w6; + krebs = stockholm.lib.krebs; + }) ); users = rec { lass = lass-yubikey; diff --git a/kartei/makefu/default.nix b/kartei/makefu/default.nix index 5e236d574..ff7017dd5 100644 --- a/kartei/makefu/default.nix +++ b/kartei/makefu/default.nix @@ -2,8 +2,7 @@ # tinc generate-keys # ssh-keygen -f ssh.id_ed25519 -t ed25519 -C host -with import ../../lib; -{ config, ... }: let +{ config, lib, stockholm, ... }: with lib; let hostDefaults = hostName: host: foldl' recursiveUpdate {} [ { @@ -19,7 +18,7 @@ with import ../../lib; "${hostName}.r" ]; ip6.addr = - (krebs.genipv6 "retiolum" "makefu" { inherit hostName; }).address; + (stockholm.lib.krebs.genipv6 "retiolum" "makefu" { inherit hostName; }).address; }; }) # Retiolum ed25519 keys @@ -37,7 +36,7 @@ with import ../../lib; "${hostName}.w" ]; ip6.addr = - (krebs.genipv6 "wiregrill" "makefu" { inherit hostName; }).address; + (stockholm.lib.krebs.genipv6 "wiregrill" "makefu" { inherit hostName; }).address; wireguard.pubkey = readFile pubkey-path; }; }) @@ -54,7 +53,7 @@ with import ../../lib; ]; pub-for = name: builtins.readFile (./ssh + "/${name}.pub"); - w6 = ip: (krebs.genipv6 "wiregrill" "makefu" ip).address; + w6 = ip: (stockholm.lib.krebs.genipv6 "wiregrill" "makefu" ip).address; in { hosts = mapAttrs hostDefaults { cake = rec { @@ -149,7 +148,7 @@ in { # pixel3a telex.nets.wiregrill = { aliases = ["telex.w"]; - ip6.addr = (krebs.genipv6 "wiregrill" "makefu" { hostName = "telex"; }).address; + ip6.addr = (stockholm.lib.krebs.genipv6 "wiregrill" "makefu" { hostName = "telex"; }).address; ip4.addr = "10.244.245.4"; }; @@ -255,7 +254,7 @@ in { ip6.addr = w6 "1"; wireguard.port = 51821; wireguard.subnets = [ - (krebs.genipv6 "wiregrill" "makefu" 0).subnetCIDR + (stockholm.lib.krebs.genipv6 "wiregrill" "makefu" 0).subnetCIDR "10.244.245.0/24" # required for routing directly to gum via rockit ]; }; diff --git a/kartei/mic92/default.nix b/kartei/mic92/default.nix index 003c66c66..9207f21eb 100644 --- a/kartei/mic92/default.nix +++ b/kartei/mic92/default.nix @@ -1,5 +1,4 @@ -with import ../../lib; -{ config, ... }: let +{ config, lib, stockholm, ... }: with stockholm.lib; let hostDefaults = hostName: host: flip recursiveUpdate host ({ ci = false; external = true; diff --git a/kartei/others/default.nix b/kartei/others/default.nix index 68097cdf8..48a34ea1d 100644 --- a/kartei/others/default.nix +++ b/kartei/others/default.nix @@ -1,5 +1,4 @@ -with import ../../lib; -{ config, ... }: let +{ config, lib, stockholm, ... }: with stockholm.lib; let hostDefaults = hostName: host: flip recursiveUpdate host ({ ci = false; diff --git a/kartei/oxzi/default.nix b/kartei/oxzi/default.nix index a4d23b01a..88bd31eba 100644 --- a/kartei/oxzi/default.nix +++ b/kartei/oxzi/default.nix @@ -1,6 +1,4 @@ -{ config, ... }: let - lib = import ../../lib; -in { +{ config, lib, stockholm, ... }: { users.oxzi = { mail = "post@0x21.biz"; }; @@ -13,7 +11,7 @@ in { "gosh.r" ]; ip4.addr = "10.243.32.1"; - ip6.addr = (lib.krebs.genipv6 "retiolum" "oxzi" { hostName = "ancha"; }).address; + ip6.addr = (stockholm.lib.krebs.genipv6 "retiolum" "oxzi" { hostName = "ancha"; }).address; tinc.pubkey = '' -----BEGIN RSA PUBLIC KEY----- MIICCgKCAgEA5RSP7nWZ1c04kvQBxoHqcdRKpJuRDzD3f0Nl2KhS7QsAqHJGdK7T @@ -39,7 +37,7 @@ in { "marohu.oxzi.r" ]; ip4.addr = "10.243.32.2"; - ip6.addr = (lib.krebs.genipv6 "retiolum" "oxzi" { hostName = "marohu"; }).address; + ip6.addr = (stockholm.lib.krebs.genipv6 "retiolum" "oxzi" { hostName = "marohu"; }).address; tinc.pubkey = '' -----BEGIN RSA PUBLIC KEY----- MIICCgKCAgEAxHLkvuH9JMXay/fEmoWTEqLHg9A50EzkxPVBn4nyezgp5vxsUqJz diff --git a/kartei/palo/default.nix b/kartei/palo/default.nix index 6fc9a594f..c9b771f89 100644 --- a/kartei/palo/default.nix +++ b/kartei/palo/default.nix @@ -1,5 +1,5 @@ -with import ../../lib; -{ config, ... }: +{ config, lib, stockholm, ... }: +with stockholm.lib; let hostDefaults = hostName: host: flip recursiveUpdate host ({ diff --git a/kartei/rtunreal/default.nix b/kartei/rtunreal/default.nix index 9d57c0fce..2be5b5996 100644 --- a/kartei/rtunreal/default.nix +++ b/kartei/rtunreal/default.nix @@ -1,5 +1,5 @@ -with import ../../lib; -{ config, ... }: +{ config, lib, stockholm, ... }: +with stockholm.lib; let hostDefaults = hostName: host: flip recursiveUpdate host ({ ci = false; diff --git a/kartei/srounce/default.nix b/kartei/srounce/default.nix index ef37cbcd1..35ff7c543 100644 --- a/kartei/srounce/default.nix +++ b/kartei/srounce/default.nix @@ -1,13 +1,11 @@ -{ config, ... }: let - lib = import ../../lib; - +{ config, lib, stockholm, ... }: let hostDefaults = hostName: host: lib.flip lib.recursiveUpdate host ({ ci = false; external = true; monitoring = false; } // lib.optionalAttrs (host.nets?retiolum) { nets.retiolum.ip6.addr = - (lib.krebs.genipv6 "retiolum" "external" { inherit hostName; }).address; + (stockholm.lib.krebs.genipv6 "retiolum" "external" { inherit hostName; }).address; }); in { diff --git a/kartei/template/default.nix b/kartei/template/default.nix index 2acf78d38..ebe948c8d 100644 --- a/kartei/template/default.nix +++ b/kartei/template/default.nix @@ -1,6 +1,4 @@ -{ config, ... }: let - lib = import ../../lib; -in { +{ config, lib, stockholm, ... }: { users.DUMMYUSER = { mail = "DUMMYUSER@example.ork"; }; diff --git a/kartei/tv/default.nix b/kartei/tv/default.nix index eacb40af3..b203675f4 100644 --- a/kartei/tv/default.nix +++ b/kartei/tv/default.nix @@ -1,5 +1,4 @@ -with import ../../lib; -{ config, ... }: { +{ config, lib, stockholm, ... }: with lib; { dns.providers = { "viljetic.de" = "regfish"; }; @@ -7,11 +6,11 @@ with import ../../lib; mapAttrs (hostName: hostFile: let hostSource = import hostFile; - hostConfig = getAttr (typeOf hostSource) { - lambda = hostSource { inherit config lib; }; + hostConfig = getAttr (builtins.typeOf hostSource) { + lambda = hostSource { inherit config; lib = stockholm.lib; }; set = hostSource; }; - in evalSubmodule types.host [ + in stockholm.lib.evalSubmodule stockholm.lib.types.host [ hostConfig { name = hostName; @@ -20,7 +19,7 @@ with import ../../lib; (optionalAttrs (hasAttrByPath ["nets" "retiolum"] hostConfig) { nets.retiolum = { ip6.addr = - (krebs.genipv6 "retiolum" "tv" { inherit hostName; }).address; + (stockholm.lib.krebs.genipv6 "retiolum" "tv" { inherit hostName; }).address; }; }) (let @@ -31,7 +30,7 @@ with import ../../lib; "${hostName}.w" ]; ip6.addr = - (krebs.genipv6 "wiregrill" "tv" { inherit hostName; }).address; + (stockholm.lib.krebs.genipv6 "wiregrill" "tv" { inherit hostName; }).address; wireguard.pubkey = readFile pubkey-path; }; }) @@ -47,7 +46,7 @@ with import ../../lib; name = removeSuffix ".nix" name; value = ./hosts + "/${name}"; }) - (readDir ./hosts)); + (builtins.readDir ./hosts)); sitemap = { "http://cgit.krebsco.de" = { desc = "Git repositories"; diff --git a/kartei/xkey/default.nix b/kartei/xkey/default.nix index 939e04c7b..465fb5799 100644 --- a/kartei/xkey/default.nix +++ b/kartei/xkey/default.nix @@ -1,5 +1,5 @@ -with import ../../lib; -{ config, ... }: +{ config, lib, stockholm, ... }: +with stockholm.lib; let maybeEmpty = attrset: key: if (attrset?key) then attrset.${key} else []; hostDefaults = hostName: host: flip recursiveUpdate host ({ diff --git a/kartei/ynnel/default.nix b/kartei/ynnel/default.nix index e7d985278..16c6a4530 100644 --- a/kartei/ynnel/default.nix +++ b/kartei/ynnel/default.nix @@ -1,7 +1,4 @@ -{ config, ... }: -let - lib = import ../../lib; -in +{ config, lib, stockholm, ... }: { users.ynnel = { mail = "retiolum@lenny.ninja"; @@ -10,7 +7,7 @@ in owner = config.krebs.users.ynnel; nets.retiolum = { aliases = [ "mokemoke.ynnel.r" ]; - ip6.addr = (lib.krebs.genipv6 "retiolum" "ynnel" { hostName = "mokemoke"; }).address; + ip6.addr = (stockholm.lib.krebs.genipv6 "retiolum" "ynnel" { hostName = "mokemoke"; }).address; tinc.pubkey = '' -----BEGIN RSA PUBLIC KEY----- MIICCgKCAgEA7rS560SZEPcSekW30dRF6ZTHOnb8WvuVgt3BFLRWhTgV5DqLqFa8 -- cgit v1.2.3