2022-07-30 06:54:32 +03:00
|
|
|
{
|
|
|
|
inputs,
|
|
|
|
pkgs,
|
2022-07-30 10:13:13 +03:00
|
|
|
config,
|
|
|
|
lib,
|
2022-07-30 06:54:32 +03:00
|
|
|
...
|
2022-07-30 10:13:13 +03:00
|
|
|
}: let
|
|
|
|
personal = import "${inputs.self}/personal.nix";
|
|
|
|
email = personal.emails.short;
|
|
|
|
in {
|
2022-07-30 04:39:01 +03:00
|
|
|
imports = [
|
|
|
|
./hardware-configuration.nix
|
2022-07-30 10:44:10 +03:00
|
|
|
./bernbot.nix
|
2022-07-30 04:39:01 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
boot.cleanTmpDir = true;
|
|
|
|
zramSwap.enable = true;
|
|
|
|
|
2022-07-30 06:54:32 +03:00
|
|
|
# ssh config
|
|
|
|
services.fail2ban.enable = true;
|
2022-07-30 04:39:01 +03:00
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
|
|
|
passwordAuthentication = false;
|
|
|
|
};
|
|
|
|
users.users.root.openssh.authorizedKeys.keys = [
|
|
|
|
(builtins.readFile "${inputs.self}/secrets/ssh-key.pub")
|
|
|
|
];
|
2022-07-30 05:03:10 +03:00
|
|
|
|
2022-07-30 06:54:32 +03:00
|
|
|
# nginx
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
2022-07-30 07:11:21 +03:00
|
|
|
recommendedTlsSettings = true;
|
|
|
|
recommendedOptimisation = true;
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedProxySettings = true;
|
2022-07-30 06:54:32 +03:00
|
|
|
virtualHosts."gaze.systems" = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
root = "${inputs.blog.packages.${pkgs.system}.website}";
|
2022-07-30 10:13:13 +03:00
|
|
|
locations."/".extraConfig = ''
|
|
|
|
add_header cache-control max-age=1800;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
virtualHosts."git.gaze.systems" = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
locations."/".proxyPass = "http://localhost:3001";
|
2022-07-30 06:54:32 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
security.acme = {
|
|
|
|
acceptTerms = true;
|
|
|
|
certs = {
|
2022-07-30 10:13:13 +03:00
|
|
|
"gaze.systems".email = email;
|
|
|
|
"git.gaze.systems".email = email;
|
2022-07-30 06:54:32 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-07-30 10:13:13 +03:00
|
|
|
# gitea
|
|
|
|
services.gitea = {
|
|
|
|
enable = true;
|
|
|
|
cookieSecure = true;
|
|
|
|
disableRegistration = true;
|
|
|
|
domain = "git.gaze.systems";
|
|
|
|
rootUrl = "https://git.gaze.systems/";
|
|
|
|
httpPort = 3001;
|
|
|
|
};
|
2022-07-30 07:11:21 +03:00
|
|
|
|
2022-07-30 06:54:32 +03:00
|
|
|
# firewall stuffs
|
|
|
|
networking.firewall = {
|
|
|
|
enable = true;
|
2022-07-30 10:13:13 +03:00
|
|
|
allowedTCPPorts = lib.flatten [
|
|
|
|
[22 80 443]
|
|
|
|
(
|
|
|
|
lib.optional
|
|
|
|
config.services.gitea.enable
|
|
|
|
config.services.gitea.httpPort
|
|
|
|
)
|
|
|
|
];
|
|
|
|
allowedUDPPortRanges = [];
|
2022-07-30 06:54:32 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
# nixinate for deployment
|
2022-07-30 05:03:10 +03:00
|
|
|
_module.args.nixinate = {
|
2022-07-30 06:57:06 +03:00
|
|
|
host = "gaze.systems";
|
2022-07-30 05:03:10 +03:00
|
|
|
sshUser = "root";
|
|
|
|
buildOn = "local"; # valid args are "local" or "remote"
|
|
|
|
substituteOnTarget = true; # if buildOn is "local" then it will substitute on the target, "-s"
|
|
|
|
hermetic = true;
|
|
|
|
};
|
2022-07-30 05:14:17 +03:00
|
|
|
|
|
|
|
system.stateVersion = "22.05";
|
2022-07-30 05:03:10 +03:00
|
|
|
}
|