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
2016-04-08 01:53:34 +00:00
ip = config . krebs . build . host . nets . internet . ip4 . addr ;
2016-05-19 22:02:29 +00:00
2016-05-31 21:26:35 +00:00
inherit ( import <stockholm/lass/2configs/websites/util.nix> { inherit lib pkgs ; } )
manageCerts
;
2016-05-19 22:02:29 +00:00
2015-10-30 15:05:51 +00:00
in {
imports = [
2016-02-15 15:27:11 +00:00
../.
2017-01-10 18:40:32 +00:00
{
networking . interfaces . et0 . ip4 = [
{
address = ip ;
prefixLength = 24 ;
}
] ;
networking . defaultGateway = " 2 1 3 . 2 3 9 . 2 0 5 . 2 2 5 " ;
networking . nameservers = [
" 8 . 8 . 8 . 8 "
] ;
services . udev . extraRules = ''
SUBSYSTEM == " n e t " , ATTR { address } == " 5 4 : 0 4 : a 6 : 7 e : f 4 : 0 6 " , NAME = " e t 0 "
'' ;
}
2016-08-23 22:03:38 +00:00
../2configs/retiolum.nix
2016-04-12 13:17:42 +00:00
../2configs/exim-smarthost.nix
2015-10-30 15:05:51 +00:00
../2configs/downloading.nix
2015-11-01 18:58:59 +00:00
../2configs/ts3.nix
2015-11-09 01:27:22 +00:00
../2configs/bitlbee.nix
2015-11-13 13:57:51 +00:00
../2configs/weechat.nix
2016-04-15 14:15:22 +00:00
../2configs/privoxy-retiolum.nix
2016-05-21 11:49:31 +00:00
../2configs/radio.nix
2016-05-31 21:34:06 +00:00
../2configs/buildbot-standalone.nix
2016-06-24 13:35:47 +00:00
../2configs/repo-sync.nix
2016-06-25 16:56:39 +00:00
../2configs/binary-cache/server.nix
2016-09-12 22:04:48 +00:00
../2configs/iodined.nix
2016-12-26 12:50:42 +00:00
../2configs/libvirt.nix
2016-12-26 13:23:52 +00:00
../2configs/hfos.nix
2016-12-29 17:15:41 +00:00
../2configs/makefu-sip.nix
2017-01-30 21:58:39 +00:00
../2configs/monitoring/server.nix
2017-02-13 16:17:55 +00:00
../2configs/monitoring/monit-alarms.nix
2017-01-31 16:14:30 +00:00
{
imports = [
../2configs/bepasty.nix
] ;
krebs . bepasty . servers . " p a s t e . r " . nginx . extraConfig = ''
if ( $ server_addr = " ${ config . krebs . build . host . nets . internet . ip4 . addr } " ) {
return 403 ;
}
'' ;
}
2015-10-30 15:05:51 +00:00
{
users . extraGroups = {
# ● systemd-tmpfiles-setup.service - Create Volatile Files and Directories
# Loaded: loaded (/nix/store/2l33gg7nmncqkpysq9f5fxyhlw6ncm2j-systemd-217/example/systemd/system/systemd-tmpfiles-setup.service)
# Active: failed (Result: exit-code) since Mon 2015-03-16 10:29:18 UTC; 4s ago
# Docs: man:tmpfiles.d(5)
# man:systemd-tmpfiles(8)
# Process: 19272 ExecStart=/nix/store/2l33gg7nmncqkpysq9f5fxyhlw6ncm2j-systemd-217/bin/systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev (code=exited, status=1/FAILURE)
# Main PID: 19272 (code=exited, status=1/FAILURE)
#
# Mar 16 10:29:17 cd systemd-tmpfiles[19272]: [/usr/lib/tmpfiles.d/legacy.conf:26] Unknown group 'lock'.
# Mar 16 10:29:18 cd systemd-tmpfiles[19272]: Two or more conflicting lines for /var/log/journal configured, ignoring.
# Mar 16 10:29:18 cd systemd-tmpfiles[19272]: Two or more conflicting lines for /var/log/journal/7b35116927d74ea58785e00b47ac0f0d configured, ignoring.
# Mar 16 10:29:18 cd systemd[1]: systemd-tmpfiles-setup.service: main process exited, code=exited, status=1/FAILURE
# Mar 16 10:29:18 cd systemd[1]: Failed to start Create Volatile Files and Directories.
# Mar 16 10:29:18 cd systemd[1]: Unit systemd-tmpfiles-setup.service entered failed state.
# Mar 16 10:29:18 cd systemd[1]: systemd-tmpfiles-setup.service failed.
# warning: error(s) occured while switching to the new configuration
lock . gid = 10001 ;
} ;
}
{
boot . loader . grub = {
devices = [
" / d e v / s d a "
" / d e v / s d b "
] ;
splashImage = null ;
} ;
boot . initrd . availableKernelModules = [
" a t a _ p i i x "
" v m w _ p v s c s i "
] ;
fileSystems . " / " = {
device = " / d e v / p o o l / n i x " ;
fsType = " e x t 4 " ;
} ;
fileSystems . " / b o o t " = {
device = " / d e v / d i s k / b y - u u i d / 7 c a 1 2 d 8 c - 6 0 6 d - 4 1 c e - b 1 0 d - 6 2 b 6 5 4 e 5 0 e 3 6 " ;
} ;
fileSystems . " / v a r / d o w n l o a d " = {
device = " / d e v / p o o l / d o w n l o a d " ;
} ;
2016-04-11 14:43:52 +00:00
fileSystems . " / s r v / h t t p " = {
device = " / d e v / p o o l / h t t p " ;
} ;
fileSystems . " / s r v / o . u b i k m e d i a . d e - d a t a " = {
device = " / d e v / p o o l / o w n c l o u d - u b i k - d a t a " ;
} ;
fileSystems . " / b k u " = {
device = " / d e v / p o o l / b k u " ;
2016-04-08 22:18:51 +00:00
} ;
2016-10-11 15:35:53 +00:00
fileSystems . " / t m p " = {
device = " t m p f s " ;
fsType = " t m p f s " ;
options = [ " n o s u i d " " n o d e v " " n o a t i m e " ] ;
} ;
2015-10-30 15:05:51 +00:00
}
{
sound . enable = false ;
}
2015-11-01 19:00:43 +00:00
{
nixpkgs . config . allowUnfree = true ;
}
2015-11-09 01:33:30 +00:00
{
#stuff for juhulian
users . extraUsers . juhulian = {
name = " j u h u l i a n " ;
uid = 1339 ;
home = " / h o m e / j u h u l i a n " ;
group = " u s e r s " ;
createHome = true ;
useDefaultShell = true ;
extraGroups = [
] ;
openssh . authorizedKeys . keys = [
" s s h - r s a A A A A B 3 N z a C 1 y c 2 E A A A A D A Q A B A A A B A Q D B Q h L G v f v 4 h y Q / n q J G y 1 Y g H X P S V l 6 i g e W T r o J S v A h U F g o h + r G + z v q Y 0 E a h K X N b 3 s q 0 / O Y D C T J V u u c c 0 h g C g 7 T 2 K q T q M t T b 9 E E k R m C F b D 7 F 7 D W Z o j C r h / a n 6 s H n e q T 5 e F v z A P Z 8 E 5 h u p 7 o V Q n j 5 P 5 M 3 I 9 k e R H B W t 1 r q 6 q 0 I c O E h s F v n e 4 q J c 7 3 a L A S T J k x z l o 5 U 8 j u 3 J Q O l 6 4 7 4 E C u S n 0 l b 1 f T r Q / S R 1 N g F 7 j V 1 1 e B l d k S 8 S H E B + 2 G X j n 4 Y r n + Q U K O n D p + B 8 5 v Z m V l J S I + 7 X R 1 / U / x I b t A j G T E m N w B 6 c T b B v 9 N C G 9 j l o D D O Z G 4 Z v z z H Y r l B X j a i g t Q h 2 / 4 m r H o K a 5 e V j u h u l i a n @ j u h u l i a n "
] ;
} ;
krebs . iptables . tables . filter . INPUT . rules = [
{ predicate = " - p u d p - - d p o r t 6 0 0 0 0 : 6 1 0 0 0 " ; target = " A C C E P T " ; }
] ;
}
2015-11-13 00:06:16 +00:00
{
environment . systemPackages = [
pkgs . perlPackages . Plack
] ;
krebs . iptables . tables . filter . INPUT . rules = [
{ predicate = " - p t c p - - d p o r t 8 0 8 0 " ; target = " A C C E P T " ; }
] ;
}
2015-12-12 16:58:21 +00:00
{
users . users . chat . openssh . authorizedKeys . keys = [
2017-04-11 17:59:25 +00:00
" s s h - r s a A A A A B 3 N z a C 1 y c 2 E A A A A D A Q A B A A A C A Q C k m I v B 8 B e k I E 2 W 2 4 + I 0 g n z k v k E o e u l z / z Q k D U V J K 4 o S c b I v g T Y m c H z Q u H J y P u e T m 6 7 b J C O c Y a T w E D N h c R / Z v c y i C Q 7 J w a 5 c L D T k C k c R 9 L Q q 8 r y 5 j M N E a n v T g r n B I E c w f S 7 j F p y F b / P R V G 6 h h 2 b P O f P + k s F p l k q 1 B T z K t / U T a C B w V E Z q i 5 X u F I l q / M q J g + F I j h + w y e N R 5 j H t q g A h V j R + Y L V N X L g t V P E + d l S f b y R Q H u A 9 F T k U j 8 B x x n T d w M 5 S x 3 3 S 6 1 d d i k 1 X v R n + + I Y q F l 6 8 f Z h z y T M E 7 t / M v j d z 8 J 7 e w 2 b F 2 I b J r X t 3 7 y Q C A O E E p 9 / R C 5 O l o A 7 d d / 5 Z J j Z x S z T 2 H n Y R O I L s Y r 3 S 0 W V 4 e + H 2 G 6 6 Z N 0 f t d U C Y h 1 o 5 r t Y 7 I r S e s 6 y H s K Y b p o i j 1 I A k R k y t 2 X g E H 5 E Z C k 1 O m x 8 A Y 3 e k W 1 K F I E h z 2 D Z E f n C E j P f 4 A G C Y Z 0 u y 4 X E z t x z T D k h 2 5 T V s / t y m 1 + 9 6 q C J 1 y A x w W Z D b V h S / Z 6 a S B p s y e D R K c a k 8 q o W V C 2 d E P d Y u T U m w v m o 3 p m G n / a 4 U f O L N J T n 0 j S R j y 3 k S v 1 h Y z o s N 4 N S Y Z q E y l F B 0 A B n l q o L p X 3 t m W t r k i K v 1 9 S + d j V G x b a a Y m 3 h j P J f d s 3 q C W T J W P v x P P e C E 8 w G X V L Y q O Q x a 5 Z P Y e o T w R o f 5 Y N S b j 5 R F Y y 9 s D L T l H l + U 4 A S T H Z M 5 S 3 a k Q = = J u i c e S S H "
2015-12-12 16:58:21 +00:00
] ;
}
2015-12-12 16:58:58 +00:00
{
time . timeZone = " E u r o p e / B e r l i n " ;
}
2015-12-12 17:22:47 +00:00
{
imports = [
../2configs/websites/domsen.nix
2016-10-19 12:58:46 +00:00
../2configs/websites/lassulus.nix
2015-12-12 17:22:47 +00:00
] ;
krebs . iptables . tables . filter . INPUT . rules = [
2016-04-08 22:36:38 +00:00
{ predicate = " - p t c p - - d p o r t h t t p " ; target = " A C C E P T " ; }
{ predicate = " - p t c p - - d p o r t h t t p s " ; target = " A C C E P T " ; }
2015-12-12 17:22:47 +00:00
] ;
}
2016-03-06 00:45:57 +00:00
{
services . tor = {
enable = true ;
} ;
}
2016-05-19 22:02:29 +00:00
{
lass . ejabberd = {
enable = true ;
hosts = [ " l a s s u l . u s " ] ;
} ;
krebs . iptables . tables . filter . INPUT . rules = [
{ predicate = " - p t c p - - d p o r t x m p p - c l i e n t " ; target = " A C C E P T " ; }
{ predicate = " - p t c p - - d p o r t x m p p - s e r v e r " ; target = " A C C E P T " ; }
] ;
}
2016-05-24 21:55:11 +00:00
{
imports = [
2016-06-25 16:38:30 +00:00
../2configs/realwallpaper.nix
2016-05-24 21:55:11 +00:00
] ;
2016-12-26 13:18:08 +00:00
services . nginx . virtualHosts . " l a s s u l . u s " . locations . " / w a l l p a p e r . p n g " . extraConfig = ''
alias /tmp/wallpaper.png ;
'' ;
2016-05-24 21:55:11 +00:00
}
2016-07-08 11:42:12 +00:00
{
environment . systemPackages = with pkgs ; [
mk_sql_pair
] ;
}
2016-07-10 16:06:50 +00:00
{
users . users . tv = {
uid = genid " t v " ;
2016-07-18 22:01:17 +00:00
inherit ( config . krebs . users . tv ) home ;
2016-07-10 16:06:50 +00:00
group = " u s e r s " ;
createHome = true ;
useDefaultShell = true ;
openssh . authorizedKeys . keys = [
config . krebs . users . tv . pubkey
] ;
} ;
}
2016-09-08 19:01:55 +00:00
{
krebs . repo-sync . timerConfig = {
2017-03-08 00:06:04 +00:00
OnBootSec = " 1 5 m i n " ;
OnUnitInactiveSec = " 9 0 m i n " ;
RandomizedDelaySec = " 3 0 m i n " ;
} ;
krebs . repo-sync . repos . stockholm . timerConfig = {
2017-03-04 23:21:53 +00:00
OnBootSec = " 5 m i n " ;
2017-03-08 00:06:04 +00:00
OnUnitInactiveSec = " 2 m i n " ;
2017-02-07 16:13:07 +00:00
RandomizedDelaySec = " 2 m i n " ;
2016-09-08 19:01:55 +00:00
} ;
}
2016-10-27 10:49:48 +00:00
{
lass . usershadow = {
enable = true ;
} ;
}
2017-01-16 16:25:21 +00:00
{
2017-01-26 22:44:31 +00:00
# Nin stuff
2017-01-16 16:25:21 +00:00
users . users . nin = {
uid = genid " n i n " ;
inherit ( config . krebs . users . nin ) home ;
group = " u s e r s " ;
createHome = true ;
useDefaultShell = true ;
openssh . authorizedKeys . keys = [
config . krebs . users . nin . pubkey
] ;
extraGroups = [
" l i b v i r t d "
] ;
} ;
2017-01-21 17:37:48 +00:00
krebs . iptables . tables . nat . PREROUTING . rules = [
{ v6 = false ; precedence = 1000 ; predicate = " - d 2 1 3 . 2 3 9 . 2 0 5 . 2 4 0 - p t c p - - d p o r t 1 3 3 7 " ; target = " D N A T - - t o - d e s t i n a t i o n 1 9 2 . 1 6 8 . 1 2 2 . 2 4 : 2 2 " ; }
] ;
krebs . iptables . tables . filter . FORWARD . rules = [
{ v6 = false ; precedence = 1000 ; predicate = " - d 1 9 2 . 1 6 8 . 1 2 2 . 2 4 - p t c p - - d p o r t 2 2 - m s t a t e - - s t a t e N E W , E S T A B L I S H E D , R E L A T E D " ; target = " A C C E P T " ; }
] ;
2017-01-16 16:25:21 +00:00
}
2017-01-21 21:08:12 +00:00
{
2017-02-18 19:31:42 +00:00
krebs . Reaktor . coders = let
lambdabot = ( import ( pkgs . fetchFromGitHub {
owner = " N i x O S " ; repo = " n i x p k g s " ;
rev = " a 4 e c 1 8 4 1 d a 1 4 f c 9 8 c 5 c 3 5 c c 7 2 2 4 2 c 2 3 b b 6 9 8 d 4 a c " ;
sha256 = " 1 4 8 f p w 3 1 s 9 2 2 h x r f 2 8 y h r c i 2 9 6 f 7 c 7 z d 8 1 h f 0 k 6 z s 0 5 r q 0 i 3 s z g y " ;
} ) { } ) . lambdabot ;
in {
2017-01-21 21:08:12 +00:00
nickname = " r e a k t o r - l a s s " ;
channels = [ " # c o d e r s " ] ;
extraEnviron = {
REAKTOR_HOST = " i r c . h a c k i n t . o r g " ;
} ;
2017-01-21 22:50:48 +00:00
plugins = with pkgs . ReaktorPlugins ; let
lambdabotflags = ''
- XStandaloneDeriving - XGADTs - XFlexibleContexts \
- XFlexibleInstances - XMultiParamTypeClasses \
- XOverloadedStrings - XFunctionalDependencies \ '' ;
in [
2017-01-21 21:08:12 +00:00
url-title
( buildSimpleReaktorPlugin " l a m b d a b o t - p l " {
2017-01-23 12:37:52 +00:00
pattern = " ^ @ p l ( ? P < a r g s > . * ) $ $ " ;
2017-01-21 21:08:12 +00:00
script = pkgs . writeDash " l a m b d a - p l " ''
2017-02-18 19:31:42 +00:00
exec $ { lambdabot } /bin/lambdabot \
2017-01-21 22:50:48 +00:00
$ { indent lambdabotflags }
- e " @ p l $ 1 "
2017-01-21 21:08:12 +00:00
'' ;
} )
( buildSimpleReaktorPlugin " l a m b d a b o t - t y p e " {
2017-01-23 12:37:52 +00:00
pattern = " ^ @ t y p e ( ? P < a r g s > . * ) $ $ " ;
2017-01-21 21:08:12 +00:00
script = pkgs . writeDash " l a m b d a - t y p e " ''
2017-02-18 19:31:42 +00:00
exec $ { lambdabot } /bin/lambdabot \
2017-01-21 22:50:48 +00:00
$ { indent lambdabotflags }
- e " @ t y p e $ 1 "
2017-01-21 21:08:12 +00:00
'' ;
} )
( buildSimpleReaktorPlugin " l a m b d a b o t - l e t " {
2017-01-23 12:37:52 +00:00
pattern = " ^ @ l e t ( ? P < a r g s > . * ) $ $ " ;
2017-01-21 21:08:12 +00:00
script = pkgs . writeDash " l a m b d a - l e t " ''
2017-02-18 19:31:42 +00:00
exec $ { lambdabot } /bin/lambdabot \
2017-01-21 22:50:48 +00:00
$ { indent lambdabotflags }
- e " @ l e t $ 1 "
2017-01-21 21:08:12 +00:00
'' ;
} )
( buildSimpleReaktorPlugin " l a m b d a b o t - r u n " {
2017-01-23 12:37:52 +00:00
pattern = " ^ @ r u n ( ? P < a r g s > . * ) $ $ " ;
2017-01-21 21:08:12 +00:00
script = pkgs . writeDash " l a m b d a - r u n " ''
2017-02-18 19:31:42 +00:00
exec $ { lambdabot } /bin/lambdabot \
2017-01-21 22:50:48 +00:00
$ { indent lambdabotflags }
- e " @ r u n $ 1 "
2017-01-21 21:08:12 +00:00
'' ;
} )
( buildSimpleReaktorPlugin " l a m b d a b o t - k i n d " {
2017-01-23 12:37:52 +00:00
pattern = " ^ @ k i n d ( ? P < a r g s > . * ) $ $ " ;
2017-01-21 21:08:12 +00:00
script = pkgs . writeDash " l a m b d a - k i n d " ''
2017-02-18 19:31:42 +00:00
exec $ { lambdabot } /bin/lambdabot \
2017-01-21 22:50:48 +00:00
$ { indent lambdabotflags }
- e " @ k i n d $ 1 "
2017-01-21 21:08:12 +00:00
'' ;
} )
2017-01-23 12:37:52 +00:00
( buildSimpleReaktorPlugin " l a m b d a b o t - k i n d " {
pattern = " ^ @ k i n d ( ? P < a r g s > . * ) $ $ " ;
script = pkgs . writeDash " l a m b d a - k i n d " ''
2017-02-18 19:31:42 +00:00
exec $ { lambdabot } /bin/lambdabot \
2017-01-23 12:37:52 +00:00
$ { indent lambdabotflags }
- e " @ k i n d $ 1 "
'' ;
} )
( buildSimpleReaktorPlugin " r a n d o m - u n i c o r n - p o r n " {
pattern = " ^ ! r u p $ $ " ;
script = pkgs . writePython2 " r u p " ''
#!${pkgs.python2}/bin/python
t1 = " " "
2017-01-26 22:53:46 +00:00
_ .
; = ' , _ ( )
8 == = D ~ ~ S " . - - ` | |
sS \ __ ||
__ . ' ( \ - -> ||
_ = / _./- \ / ||
8 == = D ~ ~ ( ( \ ( /- ' - ' l ||
) | / \ \ ( _ ) )
\ \ \ \
' ~ ' ~
2017-01-23 12:37:52 +00:00
" " "
print ( t1 )
'' ;
} )
( buildSimpleReaktorPlugin " p i n g " {
pattern = " ^ ! p i n g ( ? P < a r g s > . * ) $ $ " ;
script = pkgs . writeDash " p i n g " ''
exec /var/setuid-wrappers/ping - q - c1 " $ 1 " 2 > & 1 | tail -1
'' ;
} )
2017-01-21 21:08:12 +00:00
] ;
} ;
}
2015-10-30 15:05:51 +00:00
] ;
krebs . build . host = config . krebs . hosts . prism ;
}