2016-10-20 20:54:38 +02:00
|
|
|
with import <stockholm/lib>;
|
2017-06-27 22:57:34 +02:00
|
|
|
{ config, lib, pkgs, ... }: let
|
|
|
|
builder = if getEnv "dummy_secrets" == "true"
|
|
|
|
then "buildbot"
|
|
|
|
else "tv";
|
|
|
|
in {
|
2015-07-24 21:27:19 +02:00
|
|
|
krebs.enable = true;
|
|
|
|
|
2017-07-06 21:47:47 +02:00
|
|
|
krebs.build.user = config.krebs.users.tv;
|
2015-11-06 22:36:01 +01:00
|
|
|
|
2015-07-25 01:38:26 +02:00
|
|
|
networking.hostName = config.krebs.build.host.name;
|
|
|
|
|
2015-07-11 16:55:22 +02:00
|
|
|
imports = [
|
2015-11-08 11:53:29 +01:00
|
|
|
<secrets>
|
2016-06-30 21:11:13 +02:00
|
|
|
./audit.nix
|
2015-12-28 19:43:31 +01:00
|
|
|
./backup.nix
|
2017-06-04 15:06:22 +02:00
|
|
|
./bash
|
2017-03-07 22:40:36 +01:00
|
|
|
./htop.nix
|
2016-03-05 12:57:46 +01:00
|
|
|
./nginx
|
2016-07-23 12:18:46 +02:00
|
|
|
./ssh.nix
|
2016-07-23 13:11:50 +02:00
|
|
|
./sshd.nix
|
2015-11-01 13:28:16 +01:00
|
|
|
./vim.nix
|
2016-07-23 13:19:44 +02:00
|
|
|
./xdg.nix
|
2015-10-22 01:25:02 +02:00
|
|
|
{
|
|
|
|
# stockholm dependencies
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
git
|
2017-03-07 23:24:31 +01:00
|
|
|
gnumake
|
|
|
|
hashPassword
|
2016-10-06 19:16:42 +02:00
|
|
|
populate
|
2017-06-19 01:01:29 +02:00
|
|
|
whatsupnix
|
2015-10-22 01:25:02 +02:00
|
|
|
];
|
|
|
|
}
|
2015-07-11 16:55:22 +02:00
|
|
|
{
|
2015-11-08 11:53:29 +01:00
|
|
|
users = {
|
|
|
|
defaultUserShell = "/run/current-system/sw/bin/bash";
|
|
|
|
mutableUsers = false;
|
|
|
|
users = {
|
|
|
|
tv = {
|
2016-02-21 06:56:57 +01:00
|
|
|
inherit (config.krebs.users.tv) home uid;
|
2015-11-08 11:53:29 +01:00
|
|
|
isNormalUser = true;
|
2016-02-13 19:57:45 +01:00
|
|
|
extraGroups = [ "tv" ];
|
2015-11-08 11:53:29 +01:00
|
|
|
};
|
2015-07-11 16:55:22 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
2016-10-13 20:41:17 +02:00
|
|
|
security.hideProcessInformation = true;
|
2015-07-11 16:55:22 +02:00
|
|
|
security.sudo.extraConfig = ''
|
2016-02-25 13:45:23 +01:00
|
|
|
Defaults env_keep+="SSH_CLIENT"
|
2015-07-25 01:06:13 +02:00
|
|
|
Defaults mailto="${config.krebs.users.tv.mail}"
|
2016-02-17 22:28:02 +01:00
|
|
|
Defaults !lecture
|
2015-07-11 16:55:22 +02:00
|
|
|
'';
|
|
|
|
time.timeZone = "Europe/Berlin";
|
|
|
|
}
|
2016-02-27 15:13:44 +01:00
|
|
|
|
2015-07-11 16:55:22 +02:00
|
|
|
{
|
|
|
|
# TODO check if both are required:
|
2016-10-06 19:16:42 +02:00
|
|
|
nix.sandboxPaths = [ "/etc/protocols" pkgs.iana_etc.outPath ];
|
2015-07-11 16:55:22 +02:00
|
|
|
|
2016-02-27 15:13:44 +01:00
|
|
|
nix.requireSignedBinaryCaches = true;
|
|
|
|
|
|
|
|
nix.binaryCaches = ["https://cache.nixos.org"];
|
2015-07-11 16:55:22 +02:00
|
|
|
|
2016-10-06 19:16:42 +02:00
|
|
|
nix.useSandbox = true;
|
2015-07-11 16:55:22 +02:00
|
|
|
}
|
2016-02-02 20:12:06 +01:00
|
|
|
{
|
|
|
|
nixpkgs.config.allowUnfree = false;
|
|
|
|
}
|
2015-07-16 06:35:19 +02:00
|
|
|
{
|
2015-11-06 21:54:53 +01:00
|
|
|
environment.profileRelativeEnvVars.PATH = mkForce [ "/bin" ];
|
|
|
|
|
2015-07-16 06:35:19 +02:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
rxvt_unicode.terminfo
|
|
|
|
];
|
2015-07-16 06:26:41 +02:00
|
|
|
|
2015-07-29 15:31:34 +02:00
|
|
|
environment.shellAliases = mkForce {
|
2015-07-11 16:55:22 +02:00
|
|
|
# alias cal='cal -m3'
|
|
|
|
gp = "${pkgs.pari}/bin/gp -q";
|
|
|
|
df = "df -h";
|
|
|
|
du = "du -h";
|
|
|
|
# alias grep='grep --color=auto'
|
|
|
|
|
|
|
|
# TODO alias cannot contain #\'
|
|
|
|
# "ps?" = "ps ax | head -n 1;ps ax | fgrep -v ' grep --color=auto ' | grep";
|
|
|
|
|
|
|
|
# alias la='ls -lA'
|
|
|
|
lAtr = "ls -lAtr";
|
|
|
|
# alias ll='ls -l'
|
|
|
|
ls = "ls -h --color=auto --group-directories-first";
|
|
|
|
dmesg = "dmesg -L --reltime";
|
2015-11-01 13:28:16 +01:00
|
|
|
view = "vim -R";
|
2015-11-10 12:44:30 +01:00
|
|
|
|
|
|
|
reload = "systemctl reload";
|
|
|
|
restart = "systemctl restart";
|
|
|
|
start = "systemctl start";
|
|
|
|
status = "systemctl status";
|
|
|
|
stop = "systemctl stop";
|
2015-07-11 16:55:22 +02:00
|
|
|
};
|
|
|
|
|
2015-11-08 12:28:53 +01:00
|
|
|
environment.variables = {
|
2016-02-04 05:40:26 +01:00
|
|
|
NIX_PATH = mkForce "secrets=/var/src/stockholm/null:/var/src";
|
2015-11-08 12:28:53 +01:00
|
|
|
};
|
2015-07-11 16:55:22 +02:00
|
|
|
}
|
|
|
|
|
2016-10-24 14:38:54 +02:00
|
|
|
{
|
|
|
|
environment.variables =
|
|
|
|
flip genAttrs (_: "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt") [
|
|
|
|
"CURL_CA_BUNDLE"
|
|
|
|
"GIT_SSL_CAINFO"
|
|
|
|
"SSL_CERT_FILE"
|
|
|
|
];
|
|
|
|
}
|
2016-10-23 18:10:00 +02:00
|
|
|
|
2015-07-11 16:55:22 +02:00
|
|
|
{
|
|
|
|
services.cron.enable = false;
|
|
|
|
services.nscd.enable = false;
|
|
|
|
services.ntp.enable = false;
|
2016-07-03 21:35:34 +02:00
|
|
|
services.timesyncd.enable = true;
|
2015-07-11 16:55:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
boot.kernel.sysctl = {
|
|
|
|
# Enable IPv6 Privacy Extensions
|
|
|
|
"net.ipv6.conf.all.use_tempaddr" = 2;
|
|
|
|
"net.ipv6.conf.default.use_tempaddr" = 2;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-02-01 17:40:25 +01:00
|
|
|
{
|
|
|
|
tv.iptables.enable = true;
|
2016-02-07 03:09:14 +01:00
|
|
|
tv.iptables.accept-echo-request = "internet";
|
2016-02-01 17:40:25 +01:00
|
|
|
}
|
|
|
|
|
2016-07-03 21:30:46 +02:00
|
|
|
{
|
|
|
|
services.journald.extraConfig = ''
|
|
|
|
SystemMaxUse=1G
|
|
|
|
RuntimeMaxUse=128M
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
|
2016-02-13 17:58:02 +01:00
|
|
|
{
|
|
|
|
environment.systemPackages = [
|
|
|
|
pkgs.get
|
2017-06-27 10:01:16 +02:00
|
|
|
pkgs.htop
|
2017-07-12 23:55:42 +02:00
|
|
|
pkgs.kpaste
|
2017-03-14 23:15:23 +01:00
|
|
|
pkgs.krebspaste
|
2016-02-13 17:58:02 +01:00
|
|
|
pkgs.nix-prefetch-scripts
|
2017-06-27 10:01:16 +02:00
|
|
|
pkgs.ovh-zone
|
2016-02-13 17:58:02 +01:00
|
|
|
pkgs.push
|
|
|
|
];
|
|
|
|
}
|
2015-07-11 16:55:22 +02:00
|
|
|
];
|
|
|
|
}
|