2021-12-16 06:38:55 +01:00
|
|
|
{ depot, pkgs, ... }:
|
2021-12-17 00:29:59 +01:00
|
|
|
{ ... }:
|
2021-12-16 06:38:55 +01:00
|
|
|
|
|
|
|
let
|
2021-12-25 00:44:36 +01:00
|
|
|
inherit (depot.users) wpcarro;
|
2021-12-16 06:38:55 +01:00
|
|
|
in {
|
|
|
|
imports = [
|
2021-12-24 18:56:27 +01:00
|
|
|
"${depot.path}/ops/modules/quassel.nix"
|
2021-12-17 00:29:59 +01:00
|
|
|
(pkgs.path + "/nixos/modules/virtualisation/google-compute-image.nix")
|
2021-12-16 06:38:55 +01:00
|
|
|
];
|
|
|
|
|
2021-12-17 01:12:13 +01:00
|
|
|
networking = {
|
|
|
|
hostName = "diogenes";
|
|
|
|
firewall.allowedTCPPorts = [ 80 443 ];
|
|
|
|
};
|
2021-12-17 00:29:59 +01:00
|
|
|
|
2021-12-16 06:38:55 +01:00
|
|
|
# Use the TVL binary cache
|
|
|
|
tvl.cache.enable = true;
|
|
|
|
|
|
|
|
# Use 100G volume for /nix
|
|
|
|
fileSystems."/nix" = {
|
2021-12-17 00:29:59 +01:00
|
|
|
device = "/dev/disk/by-uuid/62396bde-9002-4025-83eb-2a6c731b7adc";
|
2021-12-16 06:38:55 +01:00
|
|
|
fsType = "ext4";
|
|
|
|
};
|
|
|
|
|
|
|
|
users = {
|
|
|
|
mutableUsers = true;
|
|
|
|
users = {
|
|
|
|
wpcarro = {
|
|
|
|
isNormalUser = true;
|
2021-12-24 18:56:27 +01:00
|
|
|
extraGroups = [ "wheel" "quassel" ];
|
2021-12-25 00:44:36 +01:00
|
|
|
openssh.authorizedKeys.keys = wpcarro.keys.all;
|
2021-12-16 06:38:55 +01:00
|
|
|
shell = pkgs.fish;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-12-17 01:12:13 +01:00
|
|
|
security = {
|
2021-12-24 18:56:27 +01:00
|
|
|
acme = {
|
|
|
|
acceptTerms = true;
|
|
|
|
email = "wpcarro@gmail.com";
|
|
|
|
|
|
|
|
certs."quassel.wpcarro.dev" = {
|
|
|
|
email = "wpcarro@gmail.com";
|
|
|
|
webroot = "/var/lib/acme/challenge-quassel";
|
|
|
|
group = "quassel";
|
|
|
|
};
|
|
|
|
};
|
2021-12-22 00:24:27 +01:00
|
|
|
|
|
|
|
sudo.wheelNeedsPassword = false;
|
2021-12-17 01:12:13 +01:00
|
|
|
};
|
|
|
|
|
2021-12-25 01:02:46 +01:00
|
|
|
programs = {
|
|
|
|
fish.enable = true;
|
|
|
|
ssh = {
|
|
|
|
startAgent = true;
|
|
|
|
extraConfig = ''
|
2021-12-25 01:08:47 +01:00
|
|
|
AddKeysToAgent yes
|
|
|
|
'';
|
2021-12-25 01:02:46 +01:00
|
|
|
};
|
2021-12-24 19:14:24 +01:00
|
|
|
};
|
2021-12-16 06:38:55 +01:00
|
|
|
|
2021-12-25 00:44:36 +01:00
|
|
|
environment.systemPackages = wpcarro.common.shell-utils;
|
2021-12-16 06:38:55 +01:00
|
|
|
|
|
|
|
services = {
|
|
|
|
depot.automatic-gc = {
|
|
|
|
enable = true;
|
|
|
|
interval = "1 hour";
|
|
|
|
diskThreshold = 16; # GiB
|
|
|
|
maxFreed = 10; # GiB
|
|
|
|
preserveGenerations = "14d";
|
|
|
|
};
|
2021-12-17 01:12:13 +01:00
|
|
|
|
2021-12-24 18:56:27 +01:00
|
|
|
depot.quassel = {
|
|
|
|
enable = true;
|
|
|
|
acmeHost = "quassel.wpcarro.dev";
|
|
|
|
bindAddresses = [
|
|
|
|
"0.0.0.0"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2021-12-17 01:12:13 +01:00
|
|
|
journaldriver = {
|
|
|
|
enable = true;
|
|
|
|
logStream = "home";
|
|
|
|
googleCloudProject = "wpcarros-infrastructure";
|
|
|
|
applicationCredentials = "/etc/gcp/key.json";
|
|
|
|
};
|
|
|
|
|
|
|
|
nginx = {
|
|
|
|
enable = true;
|
|
|
|
enableReload = true;
|
|
|
|
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
|
|
|
|
# for journaldriver
|
|
|
|
commonHttpConfig = ''
|
|
|
|
log_format json_combined escape=json
|
|
|
|
'{'
|
|
|
|
'"remote_addr":"$remote_addr",'
|
|
|
|
'"method":"$request_method",'
|
|
|
|
'"host":"$host",'
|
|
|
|
'"uri":"$request_uri",'
|
|
|
|
'"status":$status,'
|
|
|
|
'"request_size":$request_length,'
|
|
|
|
'"response_size":$body_bytes_sent,'
|
|
|
|
'"response_time":$request_time,'
|
|
|
|
'"referrer":"$http_referer",'
|
|
|
|
'"user_agent":"$http_user_agent"'
|
|
|
|
'}';
|
|
|
|
|
|
|
|
access_log syslog:server=unix:/dev/log,nohostname json_combined;
|
|
|
|
'';
|
|
|
|
|
|
|
|
virtualHosts = {
|
|
|
|
"wpcarro.dev" = {
|
|
|
|
addSSL = true;
|
|
|
|
enableACME = true;
|
2021-12-25 00:44:36 +01:00
|
|
|
root = wpcarro.website;
|
2021-12-17 01:12:13 +01:00
|
|
|
};
|
|
|
|
"blog.wpcarro.dev" = {
|
|
|
|
addSSL = true;
|
|
|
|
enableACME = true;
|
2021-12-25 00:44:36 +01:00
|
|
|
root = wpcarro.website.blog;
|
2021-12-17 01:12:13 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2021-12-16 06:38:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
system.stateVersion = "21.11";
|
|
|
|
}
|