2019-05-03 21:51:43 +02:00
|
|
|
|
# Edit this configuration file to define what should be installed on
|
|
|
|
|
# your system. Help is available in the configuration.nix(5) man page
|
|
|
|
|
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
|
|
|
|
|
|
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
imports =
|
2019-06-10 14:27:53 +02:00
|
|
|
|
[
|
2019-05-03 21:51:43 +02:00
|
|
|
|
./hardware-configuration.nix
|
2020-04-24 20:20:30 +02:00
|
|
|
|
./acme.nix
|
2019-06-10 14:27:00 +02:00
|
|
|
|
./sshusers.nix
|
2019-05-10 23:21:28 +02:00
|
|
|
|
./mailserver.nix
|
2019-06-15 10:27:05 +02:00
|
|
|
|
./borgbackup.nix
|
2019-08-11 16:57:55 +02:00
|
|
|
|
./nginx.nix
|
2019-08-11 16:25:29 +02:00
|
|
|
|
./hopglass-frontend.nix
|
2019-11-08 22:24:15 +01:00
|
|
|
|
./gitolite.nix
|
2019-05-03 21:51:43 +02:00
|
|
|
|
];
|
|
|
|
|
|
2019-05-10 23:21:28 +02:00
|
|
|
|
# Configuration options for the mailserver
|
2021-08-12 18:39:56 +02:00
|
|
|
|
# MOVED to mailserver.nix
|
|
|
|
|
|
2019-05-03 21:51:43 +02:00
|
|
|
|
# Use the GRUB 2 boot loader.
|
|
|
|
|
boot.loader.grub.enable = true;
|
|
|
|
|
boot.loader.grub.version = 2;
|
|
|
|
|
# boot.loader.grub.efiSupport = true;
|
|
|
|
|
# boot.loader.grub.efiInstallAsRemovable = true;
|
|
|
|
|
# boot.loader.efi.efiSysMountPoint = "/boot/efi";
|
|
|
|
|
# Define on which hard drive you want to install Grub.
|
|
|
|
|
boot.loader.grub.device = "/dev/vda"; # or "nodev" for efi only
|
|
|
|
|
|
|
|
|
|
networking = {
|
2019-05-10 23:17:33 +02:00
|
|
|
|
hostName = "mail2";
|
|
|
|
|
domain = "hamburg.freifunk.net";
|
2019-05-03 21:51:43 +02:00
|
|
|
|
dhcpcd.enable = false;
|
|
|
|
|
interfaces.ens3 = {
|
|
|
|
|
ipv4.addresses = [ { address = "193.96.224.229"; prefixLength = 29; } ];
|
2019-05-10 23:17:33 +02:00
|
|
|
|
ipv4.routes = [
|
|
|
|
|
{ address = "100.64.112.248"; prefixLength = 29; }
|
|
|
|
|
{ address = "10.112.0.0"; prefixLength = 16; via = "100.64.112.251"; }
|
|
|
|
|
];
|
2019-05-03 21:51:43 +02:00
|
|
|
|
ipv6.addresses = [ { address = "2a03:2267:ffff:c00::e"; prefixLength = 64; } ];
|
|
|
|
|
};
|
|
|
|
|
defaultGateway = { address = "193.96.224.225"; };
|
|
|
|
|
defaultGateway6 = { address = "2a03:2267:ffff:c00::1"; };
|
2019-06-28 21:40:49 +02:00
|
|
|
|
nameservers = [
|
|
|
|
|
"46.182.19.48" "2a02:2970:1002::18" # Digitalcourage DNS Server
|
|
|
|
|
"194.150.168.168" # AS250, https://www.ccc.de/de/censorship/dns-howto
|
|
|
|
|
];
|
2019-05-03 21:51:43 +02:00
|
|
|
|
firewall.rejectPackets = true;
|
2019-07-18 23:18:08 +02:00
|
|
|
|
firewall.logRefusedConnections = false;
|
2019-05-03 21:51:43 +02:00
|
|
|
|
};
|
|
|
|
|
|
2019-05-03 21:58:43 +02:00
|
|
|
|
# Automatic update each day at 04:40. Will not restart the system, so a reboot every now and then is a good idea.
|
|
|
|
|
system.autoUpgrade.enable = true;
|
2019-07-03 22:31:48 +02:00
|
|
|
|
system.autoUpgrade.allowReboot = true;
|
2019-06-10 14:27:53 +02:00
|
|
|
|
nix = {
|
|
|
|
|
autoOptimiseStore = true;
|
|
|
|
|
gc.automatic = true;
|
|
|
|
|
gc.options = "--delete-older-than 14d";
|
|
|
|
|
};
|
2019-05-03 21:58:43 +02:00
|
|
|
|
|
2019-05-03 21:51:43 +02:00
|
|
|
|
# Select internationalisation properties.
|
|
|
|
|
i18n = {
|
|
|
|
|
# consoleFont = "Lat2-Terminus16";
|
|
|
|
|
# consoleKeyMap = "us";
|
|
|
|
|
defaultLocale = "de_DE.UTF-8";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Set your time zone.
|
|
|
|
|
time.timeZone = "Europe/Berlin";
|
|
|
|
|
|
|
|
|
|
# List packages installed in system profile. To search, run:
|
|
|
|
|
# $ nix search wget
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
2019-06-16 20:48:13 +02:00
|
|
|
|
git htop lsof nano screen sqlite tcpdump traceroute vim wget
|
2019-05-03 21:51:43 +02:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
# Some programs need SUID wrappers, can be configured further or are
|
|
|
|
|
# started in user sessions.
|
|
|
|
|
programs.mtr.enable = true;
|
|
|
|
|
# programs.gnupg.agent = { enable = true; enableSSHSupport = true; };
|
2019-06-16 20:48:13 +02:00
|
|
|
|
programs.screen.screenrc = ''
|
|
|
|
|
hardstatus alwayslastline
|
|
|
|
|
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W}%c:%s %{g}]'
|
|
|
|
|
defscrollback 1000
|
|
|
|
|
'';
|
2019-05-03 21:51:43 +02:00
|
|
|
|
|
|
|
|
|
# List services that you want to enable:
|
|
|
|
|
|
|
|
|
|
# Enable the OpenSSH daemon.
|
2019-06-10 14:27:00 +02:00
|
|
|
|
services.openssh = {
|
|
|
|
|
enable = true;
|
|
|
|
|
# Only allow login through pubkey
|
|
|
|
|
passwordAuthentication = false;
|
|
|
|
|
};
|
2019-06-16 20:37:47 +02:00
|
|
|
|
# Support mosh connections
|
|
|
|
|
programs.mosh.enable = true;
|
2019-05-03 21:51:43 +02:00
|
|
|
|
|
|
|
|
|
# Open ports in the firewall.
|
|
|
|
|
# networking.firewall.allowedTCPPorts = [ ... ];
|
|
|
|
|
# networking.firewall.allowedUDPPorts = [ ... ];
|
|
|
|
|
# Or disable the firewall altogether.
|
|
|
|
|
# networking.firewall.enable = false;
|
|
|
|
|
|
2019-06-10 14:27:00 +02:00
|
|
|
|
# User configuration for root.
|
|
|
|
|
# Other users are defined in sshusers.nix
|
2019-05-03 21:51:43 +02:00
|
|
|
|
users.extraUsers.root = {
|
|
|
|
|
hashedPassword = "!";
|
2019-05-10 23:18:14 +02:00
|
|
|
|
};
|
2019-06-28 17:37:47 +02:00
|
|
|
|
users.motd = with config; ''
|
|
|
|
|
Welcome to ${networking.hostName}.${networking.domain}
|
|
|
|
|
|
|
|
|
|
- This server is NixOS
|
|
|
|
|
- All changes must be done through the git repository at
|
|
|
|
|
/etc/nixos or https://github.com/freifunkhamburg/mail2-nixos-config/
|
|
|
|
|
- Other changes will be lost
|
|
|
|
|
|
|
|
|
|
OS: NixOS ${system.nixos.release} (${system.nixos.codeName})
|
|
|
|
|
Version: ${system.nixos.version}
|
|
|
|
|
Kernel: ${boot.kernelPackages.kernel.version}
|
|
|
|
|
'';
|
2019-05-03 21:51:43 +02:00
|
|
|
|
|
|
|
|
|
# This value determines the NixOS release with which your system is to be
|
|
|
|
|
# compatible, in order to avoid breaking some software such as database
|
|
|
|
|
# servers. You should change this only after NixOS release notes say you
|
|
|
|
|
# should.
|
|
|
|
|
system.stateVersion = "19.03"; # Did you read the comment?
|
|
|
|
|
|
|
|
|
|
}
|