Modular server configs
This commit is contained in:
parent
c6f92e0504
commit
c34fa1674f
37
nix.nix
Normal file
37
nix.nix
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{
|
||||||
|
system = {
|
||||||
|
autoUpgrade = {
|
||||||
|
enable = true;
|
||||||
|
allowReboot = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nix = {
|
||||||
|
optimise.automatic = true;
|
||||||
|
gc = {
|
||||||
|
automatic = true;
|
||||||
|
dates = "weekly";
|
||||||
|
options = "--delete-older-than 30d";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
firewall = {
|
||||||
|
enable = true;
|
||||||
|
allowedTCPPorts = [
|
||||||
|
22
|
||||||
|
80
|
||||||
|
443
|
||||||
|
2222
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
git
|
||||||
|
vim
|
||||||
|
wget
|
||||||
|
neovim
|
||||||
|
];
|
||||||
|
}
|
23
ssh.nix
Normal file
23
ssh.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{
|
||||||
|
users.users.kamov = {
|
||||||
|
isNormalUser = true;
|
||||||
|
extraGroups = [ "wheel" "www" ];
|
||||||
|
openssh.authorizedKeys.keyFiles = [ /root/.ssh/kamov.pub ];
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
endlessh = {
|
||||||
|
enable = true;
|
||||||
|
port = 22;
|
||||||
|
};
|
||||||
|
openssh = {
|
||||||
|
enable = true;
|
||||||
|
ports = [ 2222 ];
|
||||||
|
settings = {
|
||||||
|
PasswordAuthentication = false;
|
||||||
|
KbdInteractiveAuthentication = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
33
web.nix
Normal file
33
web.nix
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{
|
||||||
|
# Group for people who can edit the website
|
||||||
|
users.groups.www = {};
|
||||||
|
|
||||||
|
# Directory for web content
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d /var/www/kamoshi.org 775 root www"
|
||||||
|
];
|
||||||
|
|
||||||
|
# Automatically renew certs
|
||||||
|
security.acme = {
|
||||||
|
acceptTerms = true;
|
||||||
|
defaults.email = "maciej@kamoshi.org";
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
nginx = {
|
||||||
|
enable = true;
|
||||||
|
recommendedTlsSettings = true;
|
||||||
|
recommendedGzipSettings = true;
|
||||||
|
recommendedOptimisation = true;
|
||||||
|
recommendedProxySettings = true;
|
||||||
|
virtualHosts = {
|
||||||
|
"kamoshi.org" = {
|
||||||
|
root = "/var/www/kamoshi.org";
|
||||||
|
forceSSL = true;
|
||||||
|
enableACME = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue