stockholm/lass/1systems/prism/config.nix

322 lines
10 KiB
Nix
Raw Normal View History

2015-10-30 15:05:51 +00:00
{ config, lib, pkgs, ... }:
2016-10-20 18:54:38 +00:00
with import <stockholm/lib>;
2016-07-07 21:07:22 +00:00
2015-10-30 15:05:51 +00:00
let
ip = config.krebs.build.host.nets.internet.ip4.addr;
2016-05-19 22:02:29 +00:00
2015-10-30 15:05:51 +00:00
in {
imports = [
<stockholm/lass>
{
networking.interfaces.et0.ip4 = [
{
address = ip;
2017-09-30 16:03:58 +00:00
prefixLength = 27;
}
];
2017-09-30 16:03:58 +00:00
networking.defaultGateway = "46.4.114.225";
networking.nameservers = [
"8.8.8.8"
];
services.udev.extraRules = ''
2017-09-30 16:03:58 +00:00
SUBSYSTEM=="net", ATTR{address}=="08:60:6e:e7:87:04", NAME="et0"
'';
}
2015-10-30 15:05:51 +00:00
{
2017-09-30 16:03:58 +00:00
imports = [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix> ];
2015-10-30 15:05:51 +00:00
boot.loader.grub = {
devices = [
"/dev/sda"
"/dev/sdb"
];
splashImage = null;
};
boot.initrd.availableKernelModules = [
"ata_piix"
"vmw_pvscsi"
2017-09-30 16:03:58 +00:00
"ahci" "sd_mod"
2015-10-30 15:05:51 +00:00
];
2017-09-30 16:03:58 +00:00
boot.kernelModules = [ "kvm-intel" ];
2015-10-30 15:05:51 +00:00
fileSystems."/" = {
2017-09-30 16:03:58 +00:00
device = "/dev/pool/nix_root";
2015-10-30 15:05:51 +00:00
fsType = "ext4";
};
2017-09-30 16:03:58 +00:00
fileSystems."/tmp" = {
device = "tmpfs";
fsType = "tmpfs";
options = ["nosuid" "nodev" "noatime"];
2015-10-30 15:05:51 +00:00
};
fileSystems."/var/download" = {
device = "/dev/pool/download";
2017-09-30 16:03:58 +00:00
fsType = "ext4";
2015-10-30 15:05:51 +00:00
};
fileSystems."/srv/http" = {
device = "/dev/pool/http";
2017-09-30 16:03:58 +00:00
fsType = "ext4";
};
2017-09-30 16:03:58 +00:00
fileSystems."/home" = {
device = "/dev/pool/home";
fsType = "ext4";
};
2017-11-14 00:03:27 +00:00
fileSystems."/bku" = {
device = "/dev/pool/bku";
fsType = "ext4";
};
2017-09-30 16:03:58 +00:00
swapDevices = [
{ label = "swap1"; }
{ label = "swap2"; }
];
2016-10-11 15:35:53 +00:00
2015-10-30 15:05:51 +00:00
sound.enable = false;
2015-11-01 19:00:43 +00:00
nixpkgs.config.allowUnfree = true;
time.timeZone = "Europe/Berlin";
}
2017-09-30 16:03:58 +00:00
<stockholm/lass/2configs/retiolum.nix>
<stockholm/lass/2configs/libvirt.nix>
2015-12-12 17:22:47 +00:00
{
2017-09-30 16:03:58 +00:00
services.nginx.enable = true;
2015-12-12 17:22:47 +00:00
imports = [
<stockholm/lass/2configs/websites/domsen.nix>
<stockholm/lass/2configs/websites/lassulus.nix>
2015-12-12 17:22:47 +00:00
];
2017-09-30 16:03:58 +00:00
# needed by domsen.nix ^^
lass.usershadow = {
enable = true;
};
2015-12-12 17:22:47 +00:00
krebs.iptables.tables.filter.INPUT.rules = [
2016-04-08 22:36:38 +00:00
{ predicate = "-p tcp --dport http"; target = "ACCEPT"; }
{ predicate = "-p tcp --dport https"; target = "ACCEPT"; }
2015-12-12 17:22:47 +00:00
];
}
2017-09-30 16:03:58 +00:00
{ # TODO make new hfos.nix out of this vv
users.users.riot = {
uid = genid "riot";
isNormalUser = true;
extraGroups = [ "libvirtd" ];
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6o6sdTu/CX1LW2Ff5bNDqGEAGwAsjf0iIe5DCdC7YikCct+7x4LTXxY+nDlPMeGcOF88X9/qFwdyh+9E4g0nUAZaeL14Uc14QDqDt/aiKjIXXTepxE/i4JD9YbTqStAnA/HYAExU15yqgUdj2dnHu7OZcGxk0ZR1OY18yclXq7Rq0Fd3pN3lPP1T4QHM9w66r83yJdFV9szvu5ral3/QuxQnCNohTkR6LoJ4Ny2RbMPTRtb+jPbTQYTWUWwV69mB8ot5nRTP4MRM9pu7vnoPF4I2S5DvSnx4C5zdKzsb7zmIvD4AmptZLrXj4UXUf00Xf7Js5W100Ne2yhYyhq+35 riot@lagrange"
];
2016-03-06 00:45:57 +00:00
};
2017-09-30 16:03:58 +00:00
# TODO write function for proxy_pass (ssl/nonssl)
services.nginx.virtualHosts."hackerfleet.de" = {
serverAliases = [
"*.hackerfleet.de"
];
locations."/".extraConfig = ''
proxy_pass http://192.168.122.92:80;
'';
};
services.nginx.virtualHosts."hackerfleet.de-s" = {
serverName = "hackerfleet.de";
2017-10-02 16:50:19 +00:00
listen = [
{
addr = "0.0.0.0";
port = 443;
}
];
2017-09-30 16:03:58 +00:00
serverAliases = [
"*.hackerfleet.de"
];
locations."/".extraConfig = ''
proxy_pass http://192.168.122.92:443;
'';
2016-05-19 22:02:29 +00:00
};
2016-07-08 11:42:12 +00:00
}
2016-07-10 16:06:50 +00:00
{
users.users.tv = {
uid = genid "tv";
2017-09-30 16:03:58 +00:00
isNormalUser = true;
2016-07-10 16:06:50 +00:00
openssh.authorizedKeys.keys = [
config.krebs.users.tv.pubkey
];
};
users.users.makefu = {
uid = genid "makefu";
isNormalUser = true;
openssh.authorizedKeys.keys = [
config.krebs.users.makefu.pubkey
];
};
users.users.nin = {
uid = genid "nin";
2017-09-30 16:03:58 +00:00
isNormalUser = true;
openssh.authorizedKeys.keys = [
config.krebs.users.nin.pubkey
];
};
2017-04-30 16:48:54 +00:00
users.extraUsers.dritter = {
uid = genid "dritter";
2017-09-30 16:03:58 +00:00
isNormalUser = true;
2017-04-30 16:48:54 +00:00
extraGroups = [
"download"
];
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDnqOWDDk7QkSAvrSLkEoz7dY22+xPyv5JDn2zlfUndfavmTMfZvPx9REMjgULbcCSM4m3Ncf40yUjciDpVleGoEz82+p/ObHAkVWPQyXRS3ZRM2IJJultBHEFc61+61Pi8k3p5pBhPPaig6VncJ4uUuuNqen9jqLesSTVXNtdntU2IvnC8B8k1Kq6fu9q1T2yEOMxkD31D5hVHlqAly0LdRiYvtsRIoCSmRvlpGl70uvPprhQxhtoiEUeDqmIL7BG9x7gU0Swdl7R0/HtFXlFuOwSlNYDmOf/Zrb1jhOpj4AlCliGUkM0iKIJhgH0tnJna6kfkGKHDwuzITGIh6SpZ dritter@Janeway"
];
};
2017-09-30 16:03:58 +00:00
users.extraUsers.juhulian = {
uid = 1339;
isNormalUser = true;
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBQhLGvfv4hyQ/nqJGy1YgHXPSVl6igeWTroJSvAhUFgoh+rG+zvqY0EahKXNb3sq0/OYDCTJVuucc0hgCg7T2KqTqMtTb9EEkRmCFbD7F7DWZojCrh/an6sHneqT5eFvzAPZ8E5hup7oVQnj5P5M3I9keRHBWt1rq6q0IcOEhsFvne4qJc73aLASTJkxzlo5U8ju3JQOl6474ECuSn0lb1fTrQ/SR1NgF7jV11eBldkS8SHEB+2GXjn4Yrn+QUKOnDp+B85vZmVlJSI+7XR1/U/xIbtAjGTEmNwB6cTbBv9NCG9jloDDOZG4ZvzzHYrlBXjaigtQh2/4mrHoKa5eV juhulian@juhulian"
];
};
2017-10-18 17:51:08 +00:00
users.users.hellrazor = {
uid = genid "hellrazor";
isNormalUser = true;
extraGroups = [
"download"
];
openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDQFaYOWRUvHP6I37q9Dd4PJOq8FNQqAeJZ8pLx0G62uC450kbPGcG80rHHvXmk7HqQP6biJmMg48bOsvXAScPot2Qhp1Qc35CuUqVhLiTvUAsi8l/iJjhjZ23yRGDCAmW5+JIOzIvECkcbMnG7YoYAQ9trNGHe9qwGzQGhpt3QVClE23WtE3PVKRLQx1VbiabSnAm6tXVd2zpUoSdpWt8Gpi2taM4XXJ5+l744MNxFHvDapN5xqpYzwrA34Ii13jNLWcGbtgxESpR+VjnamdWByrkBsW4X5/xn2K1I1FrujaM/DBHV1QMaDKst9V8+uL5X7aYNt0OUBu2eyZdg6aujY2BYovB9uRyR1JIuSbA/a54MM96yN9WirMUufJF/YZrV0L631t9EW8ORyWUo1GRzMuBHVHQlfApj7NCU/jEddUuTqKgwyRgTmMFMUI4M0tRULAB/7pBE1Vbcx9tg6RsKIk8VkskfbBJW9Y6Sx6YoFlxPdgMNIrBefqEjIV62piP7YLMlvfIDCJ7TNd9dLN86XGggZ/nD5zt6SL1o61vVnw9If8pHosppxADPJsJvcdN6fOe16/tFAeE0JRo0jTcyFVTBGfhpey+rFfuW8wtUyuO5WPUxkOn7xMHGMWHJAtWX2vwVIDtLxvqn48B4SmEOpPD6ii+vcpwqAex3ycqBUQ==" ];
};
2017-04-30 16:48:54 +00:00
}
2017-07-23 19:42:28 +00:00
{
#hotdog
2018-01-05 19:59:29 +00:00
systemd.services."container@hotdog".reloadIfChanged = mkForce false;
2017-07-23 19:42:28 +00:00
containers.hotdog = {
config = { ... }: {
2018-01-05 19:59:29 +00:00
imports = [ <stockholm/lass/2configs/rebuild-on-boot.nix> ];
2017-12-18 00:04:32 +00:00
environment.systemPackages = [ pkgs.git ];
2017-07-23 19:42:28 +00:00
services.openssh.enable = true;
users.users.root.openssh.authorizedKeys.keys = [
config.krebs.users.lass.pubkey
];
};
2018-01-05 19:59:29 +00:00
autoStart = true;
2017-07-23 19:42:28 +00:00
enableTun = true;
privateNetwork = true;
hostAddress = "10.233.2.1";
localAddress = "10.233.2.2";
};
}
2017-08-16 09:36:34 +00:00
{
#kaepsele
2018-01-05 19:59:29 +00:00
systemd.services."container@kaepsele".reloadIfChanged = mkForce false;
2017-08-16 09:36:34 +00:00
containers.kaepsele = {
config = { ... }: {
2018-01-05 19:59:29 +00:00
imports = [ <stockholm/lass/2configs/rebuild-on-boot.nix> ];
2017-12-18 00:04:32 +00:00
environment.systemPackages = [ pkgs.git ];
2017-08-16 09:36:34 +00:00
services.openssh.enable = true;
users.users.root.openssh.authorizedKeys.keys = with config.krebs.users; [
lass.pubkey
tv.pubkey
];
};
2018-01-05 19:59:29 +00:00
autoStart = true;
2017-08-16 09:36:34 +00:00
enableTun = true;
privateNetwork = true;
hostAddress = "10.233.2.3";
localAddress = "10.233.2.4";
};
}
2017-09-08 22:21:13 +00:00
{
#onondaga
2018-01-05 19:59:29 +00:00
systemd.services."container@onondaga".reloadIfChanged = mkForce false;
2017-09-08 22:21:13 +00:00
containers.onondaga = {
config = { ... }: {
2018-01-05 19:59:29 +00:00
imports = [ <stockholm/lass/2configs/rebuild-on-boot.nix> ];
2017-12-18 00:04:32 +00:00
environment.systemPackages = [ pkgs.git ];
2017-09-08 22:21:13 +00:00
services.openssh.enable = true;
users.users.root.openssh.authorizedKeys.keys = [
config.krebs.users.lass.pubkey
config.krebs.users.nin.pubkey
];
};
2018-01-05 19:59:29 +00:00
autoStart = true;
2017-09-08 22:21:13 +00:00
enableTun = true;
privateNetwork = true;
2017-11-12 12:03:50 +00:00
hostAddress = "10.233.2.5";
localAddress = "10.233.2.6";
2017-09-08 22:21:13 +00:00
};
}
2017-09-30 16:03:58 +00:00
<stockholm/lass/2configs/exim-smarthost.nix>
<stockholm/lass/2configs/ts3.nix>
<stockholm/lass/2configs/IM.nix>
2017-09-30 16:03:58 +00:00
<stockholm/lass/2configs/privoxy-retiolum.nix>
<stockholm/lass/2configs/radio.nix>
<stockholm/lass/2configs/repo-sync.nix>
<stockholm/lass/2configs/binary-cache/server.nix>
<stockholm/lass/2configs/iodined.nix>
<stockholm/lass/2configs/monitoring/server.nix>
<stockholm/lass/2configs/monitoring/monit-alarms.nix>
<stockholm/lass/2configs/paste.nix>
<stockholm/lass/2configs/syncthing.nix>
2017-09-30 17:36:54 +00:00
<stockholm/lass/2configs/reaktor-coders.nix>
2017-09-30 16:03:58 +00:00
<stockholm/lass/2configs/ciko.nix>
<stockholm/lass/2configs/container-networking.nix>
{ # quasi bepasty.nix
imports = [
<stockholm/lass/2configs/bepasty.nix>
];
krebs.bepasty.servers."paste.r".nginx.extraConfig = ''
if ( $server_addr = "${config.krebs.build.host.nets.internet.ip4.addr}" ) {
return 403;
}
'';
}
{
services.tor = {
enable = true;
};
}
{
lass.ejabberd = {
enable = true;
hosts = [ "lassul.us" ];
};
krebs.iptables.tables.filter.INPUT.rules = [
{ predicate = "-p tcp --dport xmpp-client"; target = "ACCEPT"; }
{ predicate = "-p tcp --dport xmpp-server"; target = "ACCEPT"; }
];
}
{
imports = [
<stockholm/lass/2configs/realwallpaper.nix>
];
services.nginx.virtualHosts."lassul.us".locations."/wallpaper.png".extraConfig = ''
alias /var/realwallpaper/realwallpaper.png;
'';
}
2017-11-28 16:57:52 +00:00
<stockholm/krebs/2configs/reaktor-krebs.nix>
2017-12-03 21:56:40 +00:00
<stockholm/lass/2configs/dcso-dev.nix>
{
krebs.git.rules = [
{
2017-12-15 20:30:33 +00:00
user = with config.krebs.users; [
jeschli
jeschli-bln
jeschli-brauerei
];
repo = [ config.krebs.git.repos.stockholm ];
perm = with git; push "refs/heads/staging/jeschli*" [ fast-forward non-fast-forward create delete merge ];
}
];
}
{
krebs.repo-sync.repos.stockholm.timerConfig = {
OnBootSec = "5min";
OnUnitInactiveSec = "2min";
RandomizedDelaySec = "2min";
};
}
2018-01-15 23:04:56 +00:00
<stockholm/lass/2configs/downloading.nix>
2018-01-15 23:02:38 +00:00
<stockholm/lass/2configs/minecraft.nix>
2015-10-30 15:05:51 +00:00
];
krebs.build.host = config.krebs.hosts.prism;
2017-09-30 16:03:58 +00:00
# workaround because grub store paths are broken
boot.copyKernels = true;
2015-10-30 15:05:51 +00:00
}