summaryrefslogtreecommitdiffstats
path: root/krebs/3modules
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/3modules')
-rw-r--r--krebs/3modules/external/default.nix25
-rw-r--r--krebs/3modules/hosts.nix25
-rw-r--r--krebs/3modules/reaktor2.nix63
3 files changed, 99 insertions, 14 deletions
diff --git a/krebs/3modules/external/default.nix b/krebs/3modules/external/default.nix
index df18b4dd3..089113ac6 100644
--- a/krebs/3modules/external/default.nix
+++ b/krebs/3modules/external/default.nix
@@ -141,6 +141,29 @@ in {
};
};
};
+ idontcare = {
+ owner = config.krebs.users.Mic92;
+ nets = rec {
+ retiolum = {
+ addrs = [
+ config.krebs.hosts.idontcare.nets.retiolum.ip4.addr
+ config.krebs.hosts.idontcare.nets.retiolum.ip6.addr
+ ];
+ ip4.addr = "10.243.29.177";
+ aliases = [ "idontcare.r" ];
+ tinc.pubkey = ''
+ -----BEGIN RSA PUBLIC KEY-----
+ MIIBCgKCAQEAxmmbQLVXcnCU9Vg9TCoJxfq/RyNfzaTj8XJsn4Kpo3CvQOwFzL6O
+ qZnbG55WjPjPumuFgtUdHA/G8mgtrTVaIRbVE9ck2l2wWFzMWxORzuvDbMh5xP8A
+ OW2Z2qjlH6O9GTBCzpYyHuyBWCjtiN4x9zEqxkIsBARKOylAoy3zQIiiQF0d72An
+ lqKFi9vYUU90zo9rP8BTzx2ZsEWb28xhHUlwf1+vgaOHI1jI99gnr12dVYl/i/Hb
+ O28gDUogfpP/5pWFAHJ+53ZscHo8/Y7imjiKgGXmOHywoXOsKQ67M6ROEU/0xPnw
+ jKmq2p7zTJk2mDhphjePi5idd5yKNX5Q3wIDAQAB
+ -----END RSA PUBLIC KEY-----
+ '';
+ };
+ };
+ };
justraute = {
owner = config.krebs.users.raute; # laptop
nets = {
@@ -393,7 +416,7 @@ in {
pubkey = ssh-for "kmein";
};
Mic92 = {
- mail = "joerg@higgsboson.tk";
+ mail = "joerg@thalheim.io";
pubkey = ssh-for "Mic92";
};
palo = {
diff --git a/krebs/3modules/hosts.nix b/krebs/3modules/hosts.nix
index a95557b3d..0985bb539 100644
--- a/krebs/3modules/hosts.nix
+++ b/krebs/3modules/hosts.nix
@@ -13,24 +13,23 @@ in {
};
config = {
- networking.extraHosts =
- concatStringsSep
- "\n"
- (flatten
- (mapAttrsToList
- (hostname: host:
- mapAttrsToList
- (netname: net: let
+ networking.hosts =
+ filterAttrs
+ (_name: value: value != [])
+ (zipAttrsWith
+ (_: concatLists)
+ (concatMap
+ (host:
+ concatMap
+ (net: let
aliases = longs ++ shorts;
longs = filter check net.aliases;
shorts = let s = ".${config.krebs.dns.search-domain}"; in
map (removeSuffix s) (filter (hasSuffix s) longs);
in
- optionals
- (aliases != [])
- (map (addr: "${addr} ${toString aliases}") net.addrs))
- (filterAttrs (name: host: host.aliases != []) host.nets))
- config.krebs.hosts));
+ map (addr: { ${addr} = aliases; }) net.addrs)
+ (attrValues host.nets))
+ (attrValues config.krebs.hosts)));
};
}
diff --git a/krebs/3modules/reaktor2.nix b/krebs/3modules/reaktor2.nix
new file mode 100644
index 000000000..b667bcc92
--- /dev/null
+++ b/krebs/3modules/reaktor2.nix
@@ -0,0 +1,63 @@
+with import <stockholm/lib>;
+{ config, pkgs, ... }: {
+
+ options.krebs.reaktor2 = mkOption {
+ default = {};
+ type = types.attrsOf (types.submodule (self: let
+ name = self.config._module.args.name;
+ in {
+ options = {
+ nick = mkOption {
+ default = name;
+ # TODO types.irc.nickname
+ type = types.str;
+ };
+ hostname = mkOption {
+ default = "irc.r";
+ type = types.hostname;
+ };
+ port = mkOption {
+ default = "6667";
+ # TODO type = types.service-name
+ };
+ plugins = mkOption {
+ default = [];
+ type = types.listOf types.attrs;
+ };
+ stateDir = mkOption {
+ default = "/var/lib/${self.config.systemd-service-name}";
+ readOnly = true;
+ type = types.absolute-pathname;
+ };
+ systemd-service-name = mkOption {
+ default = "reaktor2${optionalString (name != "default") "-${name}"}";
+ type = types.filename;
+ };
+ };
+ }));
+ };
+
+ config = {
+ systemd.services = flip mapAttrs' config.krebs.reaktor2 (_: cfg:
+ nameValuePair cfg.systemd-service-name {
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ User = cfg.systemd-service-name;
+ Group = "reaktor2";
+ DynamicUser = true;
+ StateDirectory = cfg.systemd-service-name;
+ ExecStart = let
+ configFile = pkgs.writeJSON configFileName configValue;
+ configFileName = "${cfg.systemd-service-name}.config.json";
+ configValue = recursiveUpdate {
+ logTime = false;
+ } (removeAttrs cfg ["_module"]);
+ in "${pkgs.reaktor2}/bin/reaktor ${configFile}";
+ Restart = "always";
+ RestartSec = "30";
+ };
+ }
+ );
+ };
+}