1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

move retiolum config; add homeros config

This commit is contained in:
Kierán Meinhardt
2019-01-30 13:26:06 +01:00
parent 101e7c99d4
commit 498215fb07
9 changed files with 146 additions and 91 deletions

3
.gitignore vendored
View File

@@ -1 +1,2 @@
secrets.nix /secrets.nix
/result

View File

@@ -1,16 +1,17 @@
{ pkgs, config, lib, ... }: { pkgs, config, lib, ... }:
let let
sshPort = 22022; sshPort = 22022;
secrets = import ../secrets.nix; sshKey = {
homeros = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDn13Y6CznabMvKJPIrr/dj1TX4boe8F98yc3FDElJeprQo2RXlDzjg/po9/lHTHaoC5yQUjlRg/AnI4vizYkn2sqJebAeSPahmpS+l0eFnjZgsqds2cCFqSPB6Qc5YEkGRhN4aq/ABz0jdFJLBYOYGxuuXowYxyNrqrItxDR7tF7upG+kVjYiDoP/qFm8C7zv6Zy8aoehNbzf8HlIJd0ITbMr/vUftNsQ8C84QmbZljReHmchPgE8GUfVLTlCORkhndbvNX3jXo+75y7JOIZZ6193FZHM4seg/VSDWYLJtpnhttD1w6qmiLrlimqbJB9ihoXq2eDmQ+4zo6hxQ6pFH6P0xQClJ0hxVWn6hEM3rkMwoMfbq4v54gKJsYxcGdnwjAX6d9DQv/QVjmVZffKWsGGoC7uz7bdmc0akVKi+GLSPOx8sJwXqvyvFStfqLaweVcuikUqQ72JLK7pZyliA7na6KuQ1PE3LTpfSr0lbBJ73xtS2rU1nF/Oe5zwA4LX5s/QeDVmS86D8acUrSCO62pBB3Yv8go0KR4mEvfxLiUWV6gR2uTeIPXvo4ouYFZqyABAGybjUATlGCXJaeHd/y/VWkpIB8ocqNESlRMCEe4TrYjw91AEmYBL6kWIeop3dyhovm3dTB3fQvC97kbL16wuXBrOcN4lEc+56ShhmvdQ== kieran.meinhardt@gmail.com";
scardanelli = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC19H0FhSNWcfBRPKzbTVSMJikIWZl0CoM8zCm+/3fdMgoaLRpeZWe/AfDK6b4qOjk/sez/J0JUFCGr+JbMwjsduoazsuQowu9L9DLP9Q5UkJje4BD7MHznaeu9/XfVng/MvyaEWArA/VUJeKQesHe76tR511/+n3+bdzlIh8Zw/3wfFxmg1OTNA99/vLkXrQzHDTuV/yj1pxykL4xFtN0OIssW1IKncJeKtkO/OHGT55ypz52Daj6bNKqvxiTuzeEhv5M+5ppyIPcRf1uj/7IaPKttCgZAntEqBTIR9MbyXFeAZVayzaFnLl2okeam5XreeZbj+Y1h2ZjxiIuWoab3MLndSekVfLtfa63gtcWIf8CIvZO2wJoH8v73y0U78JsfWVaTM09ZCfFlHHA/bWqZ6laAjW+mWLO/c77DcYkB3IBzaMVNfc6mfTcGFIC+biWeYpKgA0zC6rByUPbmbIoMueP9zqJwqUaM90Nwd6559inBB107/BK3Ktb3b+37mMCstetIPB9e4EFpGMjhmnL/G81jS53ACWLXJYzt7mKU/fEsiW93MtaB+Le46OEC18y/4G8F7p/nnH7i0kO74ukxbnc4PlpiM7iWT6ra2Cyy+nzEgdXCNXywIxr05TbCQDwX6/NY8k7Hokgdfyz+1Pq3sX0yCcWRPaoB26YF12KYFQ== kieran.meinhardt@gmail.com";
};
in { in {
networking.hosts = lib.mapAttrs (_: value: [ (value + ".local") ]) { networking.hosts = lib.mapAttrs (_: value: [ (value + ".local") ]) {
"192.168.178.1" = "router"; "192.168.178.1" = "router";
"192.168.178.21" = "scardanelli"; "192.168.178.21" = "scardanelli";
"192.168.178.22" = "homeros"; "192.168.178.22" = "homeros";
"192.168.178.24" = "lestrade"; "192.168.178.24" = "catullus";
"192.168.178.27" = "printer"; "192.168.178.27" = "printer";
} // {
"42:0:ca48:f98f:63d7:31ce:922b:245d" = [ "go" ];
}; };
networking.wireless = { networking.wireless = {
@@ -69,24 +70,8 @@ in {
passwordAuthentication = false; passwordAuthentication = false;
}; };
users.users.kfm.openssh.authorizedKeys.keys = let sshKey = secrets.ssh.publicKey; in [ users.users.kfm.openssh.authorizedKeys.keys = [
sshKey.homeros sshKey.homeros
sshKey.scardanelli sshKey.scardanelli
]; ];
networking.retiolum = {
scardanelli = {
ipv4 = "10.243.2.2";
ipv6 = "42:0:3c46:4007:5bce:f1bc:606b:2b18";
};
homeros = {
ipv4 = "10.243.2.1";
ipv6 = "42:0:3c46:53e:e63d:e62a:56ea:c705";
};
}.${config.networking.hostName};
environment.etc."tinc/retiolum/rsa_key.priv" = {
text = secrets.retiolum.privateKey.${config.networking.hostName};
mode = "400";
};
} }

View File

@@ -1,72 +1,24 @@
{ config, pkgs, lib, ... }: { config, pkgs, ... }:
with lib; {
let imports = [ ../modules/retiolum.nix ];
netname = "retiolum";
cfg = config.networking.retiolum;
in {
options = {
networking.retiolum.ipv4 = mkOption {
type = types.str;
description = ''
own ipv4 address
'';
};
networking.retiolum.ipv6 = mkOption {
type = types.str;
description = ''
own ipv6 address
'';
};
networking.retiolum.nodename = mkOption {
type = types.str;
default = config.networking.hostName;
description = ''
tinc network name
'';
};
};
config = {
services.tinc.networks.${netname} = {
name = cfg.nodename;
extraConfig = ''
LocalDiscovery = yes
ConnectTo = gum
ConnectTo = ni
ConnectTo = prism
ConnectTo = eve
AutoConnect = yes
'';
};
networking.extraHosts = builtins.readFile (pkgs.fetchurl { networking.hosts = {
name = "retiolum.hosts"; "42:0:ca48:f98f:63d7:31ce:922b:245d" = [ "go" ];
url = "https://lassul.us/retiolum.hosts";
# FIXME
sha256 = "0q8f5gw12hf9dhwcs4fni8jrvb2a1g6jskz28qcbd10p2xlkja58";
});
environment.systemPackages = [ config.services.tinc.networks.${netname}.package ];
systemd.services."tinc.${netname}" = {
path = with pkgs; [ curl gnutar bzip2 ];
preStart = ''
curl https://lassul.us/retiolum-hosts.tar.bz2 | tar -xjvf - -C /etc/tinc/${netname}/ || true
'';
};
networking.firewall.allowedTCPPorts = [ 655 ];
networking.firewall.allowedUDPPorts = [ 655 ];
systemd.network.enable = true;
systemd.network.networks = {
"${netname}".extraConfig = ''
[Match]
Name = tinc.${netname}
[Network]
Address=${cfg.ipv4}/12
Address=${cfg.ipv6}/16
'';
};
}; };
networking.retiolum = {
scardanelli = {
ipv4 = "10.243.2.2";
ipv6 = "42:0:3c46:4007:5bce:f1bc:606b:2b18";
};
homeros = {
ipv4 = "10.243.2.1";
ipv6 = "42:0:3c46:53e:e63d:e62a:56ea:c705";
};
}.${config.networking.hostName};
environment.etc."tinc/retiolum/rsa_key.priv" = {
text = (import ../secrets.nix).retiolum.privateKey.${config.networking.hostName};
mode = "400";
};
} }

72
modules/retiolum.nix Normal file
View File

@@ -0,0 +1,72 @@
{ config, pkgs, lib, ... }:
with lib;
let
netname = "retiolum";
cfg = config.networking.retiolum;
in {
options = {
networking.retiolum.ipv4 = mkOption {
type = types.str;
description = ''
own ipv4 address
'';
};
networking.retiolum.ipv6 = mkOption {
type = types.str;
description = ''
own ipv6 address
'';
};
networking.retiolum.nodename = mkOption {
type = types.str;
default = config.networking.hostName;
description = ''
tinc network name
'';
};
};
config = {
services.tinc.networks.${netname} = {
name = cfg.nodename;
extraConfig = ''
LocalDiscovery = yes
ConnectTo = gum
ConnectTo = ni
ConnectTo = prism
ConnectTo = eve
AutoConnect = yes
'';
};
networking.extraHosts = builtins.readFile (pkgs.fetchurl {
name = "retiolum.hosts";
url = "https://lassul.us/retiolum.hosts";
# FIXME
sha256 = "0q8f5gw12hf9dhwcs4fni8jrvb2a1g6jskz28qcbd10p2xlkja58";
});
environment.systemPackages = [ config.services.tinc.networks.${netname}.package ];
systemd.services."tinc.${netname}" = {
path = with pkgs; [ curl gnutar bzip2 ];
preStart = ''
curl https://lassul.us/retiolum-hosts.tar.bz2 | tar -xjvf - -C /etc/tinc/${netname}/ || true
'';
};
networking.firewall.allowedTCPPorts = [ 655 ];
networking.firewall.allowedUDPPorts = [ 655 ];
systemd.network.enable = true;
systemd.network.networks = {
"${netname}".extraConfig = ''
[Match]
Name = tinc.${netname}
[Network]
Address=${cfg.ipv4}/12
Address=${cfg.ipv6}/16
'';
};
};
}

2
systems/catullus/config.nix Executable file → Normal file
View File

@@ -1,6 +1,6 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
imports = [ ../slim.nix ]; imports = [];
boot.loader.grub.enable = false; boot.loader.grub.enable = false;
boot.loader.generic-extlinux-compatible.enable = true; boot.loader.generic-extlinux-compatible.enable = true;

0
systems/catullus/physical.nix Executable file → Normal file
View File

View File

@@ -0,0 +1,13 @@
{ config, pkgs, ... }:
{
imports =
[ ../../main.nix
];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "homeros";
system.stateVersion = "19.03";
}

View File

@@ -0,0 +1,32 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
./config.nix
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod" "rtsx_usb_sdmmc" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/83544ad3-1d23-4c2d-82bc-fafef13a996f";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/8F9E-7556";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/5ea3a65e-8fdb-45fb-ad32-3759d991a83a"; }
];
nix.maxJobs = lib.mkDefault 4;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}