2021-01-23 17:16:48 +00: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 =
|
|
|
|
|
[ # Include the results of the hardware scan.
|
|
|
|
|
./hardware-configuration.nix
|
2022-12-11 13:07:19 +00:00
|
|
|
|
#./amanuensis.nix
|
|
|
|
|
#./redstring.nix
|
2021-01-23 17:16:48 +00:00
|
|
|
|
./catacomb.nix
|
|
|
|
|
./gitea.nix
|
2022-11-27 01:38:18 +00:00
|
|
|
|
./inquisitor.nix
|
2021-01-23 17:16:48 +00:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
# Use the GRUB 2 boot loader.
|
|
|
|
|
boot.loader.grub = {
|
|
|
|
|
enable = true;
|
|
|
|
|
version = 2;
|
|
|
|
|
device = "/dev/xvda";
|
|
|
|
|
extraConfig = "serial --unit=0 --speed=115200 ; terminal_input serial console ; terminal_output serial console";
|
|
|
|
|
};
|
|
|
|
|
boot.kernelParams = ["console=ttyS0"];
|
|
|
|
|
|
2022-11-27 01:40:04 +00:00
|
|
|
|
nix = {
|
|
|
|
|
package = pkgs.nixFlakes;
|
2022-12-11 00:00:55 +00:00
|
|
|
|
settings.max-jobs = 2;
|
2022-11-27 01:40:04 +00:00
|
|
|
|
extraOptions = ''
|
|
|
|
|
experimental-features = nix-command flakes
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
swapDevices = [ { device = "/swap"; size = 1024; } ];
|
2022-01-08 00:06:07 +00:00
|
|
|
|
|
2021-01-23 17:16:48 +00:00
|
|
|
|
networking.hostName = "empyrean";
|
|
|
|
|
|
|
|
|
|
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
|
|
|
|
|
# Per-interface useDHCP will be mandatory in the future, so this generated config
|
|
|
|
|
# replicates the default behaviour.
|
|
|
|
|
networking.useDHCP = false;
|
|
|
|
|
networking.interfaces.eth0.useDHCP = true;
|
|
|
|
|
|
|
|
|
|
# Configure network proxy if necessary
|
|
|
|
|
# networking.proxy.default = "http://user:password@proxy:port/";
|
|
|
|
|
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
|
|
|
|
|
|
|
|
|
# Select internationalisation properties.
|
|
|
|
|
i18n.defaultLocale = "en_US.UTF-8";
|
|
|
|
|
console = {
|
|
|
|
|
font = "Lat2-Terminus16";
|
|
|
|
|
keyMap = "us";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Set your time zone.
|
|
|
|
|
time.timeZone = "UTC";
|
|
|
|
|
|
|
|
|
|
# List packages installed in system profile. To search, run:
|
|
|
|
|
# $ nix search wget
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
|
vim htop git tinc_pre python3
|
|
|
|
|
gitea
|
|
|
|
|
];
|
2022-01-08 00:14:50 +00:00
|
|
|
|
environment.variables.EDITOR = "vim";
|
2021-01-23 17:16:48 +00:00
|
|
|
|
|
2023-01-10 17:43:25 +00:00
|
|
|
|
services.nginx = let
|
|
|
|
|
static-site = srv-dir: {
|
|
|
|
|
enableACME = true;
|
|
|
|
|
forceSSL = true;
|
|
|
|
|
root = "/srv/${srv-dir}/";
|
|
|
|
|
extraConfig = ''
|
|
|
|
|
access_log /var/log/nginx/access_${srv-dir}.log;
|
|
|
|
|
index index.html;
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
in {
|
2021-01-23 17:16:48 +00:00
|
|
|
|
enable = true;
|
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
|
virtualHosts = {
|
|
|
|
|
# Static pages
|
2023-01-10 17:43:25 +00:00
|
|
|
|
"wedding.ktvb.site" = static-site "wedding.ktvb.site";
|
|
|
|
|
"www.ktvb.site" = static-site "www.ktvb.site";
|
|
|
|
|
"mirror.alogoulogoi.com" = static-site "mirror.alogoulogoi.com";
|
|
|
|
|
"www.alogoulogoi.com" = static-site "www";
|
2023-01-16 05:56:31 +00:00
|
|
|
|
newtab = {
|
|
|
|
|
listen = [ { addr = "10.22.20.1"; port = 80; } ];
|
|
|
|
|
root = "/srv/newtab/";
|
|
|
|
|
extraConfig = ''
|
|
|
|
|
access_log /var/log/nginx/access_newtab.log;
|
|
|
|
|
index index.html;
|
|
|
|
|
'';
|
|
|
|
|
};
|
2021-01-23 17:16:48 +00:00
|
|
|
|
# Deny all other subdomains
|
|
|
|
|
"alogoulogoi.com" = {
|
|
|
|
|
default = true;
|
|
|
|
|
locations."/".return = "444";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
security.acme = {
|
2022-12-11 00:00:55 +00:00
|
|
|
|
defaults.email = "tim.vanbaak+alogoulogoi@gmail.com";
|
2021-01-23 17:16:48 +00:00
|
|
|
|
acceptTerms = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
services.gitolite = {
|
|
|
|
|
enable = true;
|
|
|
|
|
adminPubkey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDkSvOcY0eFuYqewc73MNHGP/Owzfnt+BZDSOCwr4h+gJenOBmXol695sRKdIw8phgshb6LsNyWeEAr3YISwzjdOvWNKpSsdyH/79VFIffC+/RBhPFhIPHn1zpHIwgthXji8FMmnO6B1bhJvbJxD5bUqhdBLnUeMhNgUkDj4Qi42S8yK1VZkgWRuPOTGqlzkODEdzG6OST7ndL58jEQaK8R2KRC2cZfrjingmPL+ORyf1/lGwyF6MEAmbQuE6UdspMs8FWt2e8jQJS+ZQ8dl+NDFrC1QfPRFpBJWnQceBcfAVZTtDaJpRhc4ClZstBy/bVRjiKeQiNv5NasjKRvvIvot4+LXmBKrXJs81enExtMSHMPuqPRlyVZLMMCVmdLDP/HUYOASDzlUhV/v5Wp0jjY4Wy0IWC7nm7P8EKsp1ZofwU6rJ9XPLpQJt7UUURX71h1FMaqi+lylW6xkD3LqD8oT5Bdp+Vs0bUbPQVRw1Fenjc6G1URU94GOAggyNgsWms= root@empyrean";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
services.ntp = {
|
|
|
|
|
enable = true;
|
|
|
|
|
servers = ["time.nist.gov"];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
services.openssh = {
|
|
|
|
|
enable = true;
|
|
|
|
|
passwordAuthentication = false;
|
|
|
|
|
permitRootLogin = "prohibit-password";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
services.tinc.networks.beatific = {
|
|
|
|
|
listenAddress = "0.0.0.0";
|
|
|
|
|
chroot = false;
|
|
|
|
|
};
|
|
|
|
|
|
2022-02-10 15:06:16 +00:00
|
|
|
|
services.nebula.networks.beatific = {
|
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
|
|
# Network certificate and host credentials
|
2022-11-26 02:49:40 +00:00
|
|
|
|
ca = "/etc/nebula/beatific/beatific.crt";
|
2022-02-10 15:06:16 +00:00
|
|
|
|
cert = "/etc/nebula/beatific/empyrean.crt";
|
|
|
|
|
key = "/etc/nebula/beatific/empyrean.key";
|
|
|
|
|
|
2022-11-26 02:49:40 +00:00
|
|
|
|
# This host has a well-known IP at its VPS host, so it can function as a lighthouse/entry node
|
2022-02-10 15:06:16 +00:00
|
|
|
|
isLighthouse = true;
|
|
|
|
|
|
|
|
|
|
# Listen to connection requests from the public Internet
|
|
|
|
|
listen.port = 4242;
|
|
|
|
|
listen.host = "vpn.alogoulogoi.com";
|
|
|
|
|
|
2022-11-26 02:49:40 +00:00
|
|
|
|
# Don't filter anything at the VPN level
|
2022-02-10 15:06:16 +00:00
|
|
|
|
firewall.outbound = [ { port = "any"; proto = "any"; host = "any"; } ];
|
|
|
|
|
firewall.inbound = [ { port = "any"; proto = "any"; host = "any"; } ];
|
|
|
|
|
|
|
|
|
|
settings = {
|
|
|
|
|
# Enable UDP holepunching both ways, which allows nodes to establish more direct connections with each other
|
|
|
|
|
punchy = { punch = true; response = true; };
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-01-23 17:16:48 +00:00
|
|
|
|
networking.firewall = {
|
|
|
|
|
enable = true;
|
|
|
|
|
allowPing = true;
|
|
|
|
|
allowedTCPPorts = [
|
|
|
|
|
22 # ssh
|
|
|
|
|
80 # http
|
|
|
|
|
443 # https
|
|
|
|
|
655 # tinc
|
|
|
|
|
];
|
|
|
|
|
allowedUDPPorts = [
|
|
|
|
|
655 # tinc
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
users.users.tvb = {
|
|
|
|
|
isNormalUser = true;
|
2022-01-08 00:06:07 +00:00
|
|
|
|
group = "tvb";
|
2021-01-23 17:16:48 +00:00
|
|
|
|
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
|
2022-11-27 02:51:05 +00:00
|
|
|
|
openssh.authorizedKeys.keyFiles = [
|
|
|
|
|
../../keys/tvb.palamas.pub
|
|
|
|
|
../../keys/tvb.stagirite.pub
|
|
|
|
|
];
|
2021-01-23 17:16:48 +00:00
|
|
|
|
};
|
2022-01-08 00:06:07 +00:00
|
|
|
|
users.groups.tvb = {};
|
2021-01-23 17:16:48 +00:00
|
|
|
|
|
2023-06-09 20:26:19 +00:00
|
|
|
|
/*
|
|
|
|
|
users.users.guestbook = let
|
|
|
|
|
sign-guestbook = pkgs.writeShellScriptBin "sign-guestbook" ''
|
|
|
|
|
echo "Hello world!"
|
|
|
|
|
''
|
|
|
|
|
# Hack the shell path in since writeShellScriptBin doesn't take passthru
|
|
|
|
|
// { shellPath = "/bin/sign-guestbook"; };
|
|
|
|
|
in {
|
|
|
|
|
group = "guestbook";
|
|
|
|
|
password = "";
|
|
|
|
|
description = "Guestbook login";
|
|
|
|
|
shell = sign-guestbook;
|
|
|
|
|
isNormalUser = true;
|
|
|
|
|
createHome = false;
|
|
|
|
|
home = "/var/empty";
|
|
|
|
|
useDefaultShell = false;
|
|
|
|
|
};
|
|
|
|
|
users.groups.guestbook = {};
|
|
|
|
|
services.openssh.extraConfig = ''
|
|
|
|
|
Match user guestbook
|
|
|
|
|
PasswordAuthentication yes
|
|
|
|
|
PermitEmptyPasswords yes
|
|
|
|
|
Match all
|
|
|
|
|
PasswordAuthentication no
|
|
|
|
|
'';*/
|
|
|
|
|
|
2021-01-23 17:16:48 +00:00
|
|
|
|
# This value determines the NixOS release from which the default
|
|
|
|
|
# settings for stateful data, like file locations and database versions
|
|
|
|
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
|
|
|
|
# this value at the release version of the first install of this system.
|
|
|
|
|
# Before changing this value read the documentation for this option
|
|
|
|
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
|
|
|
|
system.stateVersion = "20.03"; # Did you read the comment?
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|