Compare commits
10 commits
18c8f35265
...
c2112ea153
Author | SHA1 | Date | |
---|---|---|---|
Maciej Jur | c2112ea153 | ||
Maciej Jur | 6a3e77e142 | ||
Maciej Jur | f7e2f579d6 | ||
Maciej Jur | c34fa1674f | ||
Maciej Jur | c6f92e0504 | ||
Maciej Jur | beefeed823 | ||
Maciej Jur | 0abaeefc04 | ||
Maciej Jur | 9ee2cab5cb | ||
Maciej Jur | 1a7d636a77 | ||
Maciej Jur | af1ca1b3a0 |
49
git.nix
Normal file
49
git.nix
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
domain = "git.kamoshi.org";
|
||||||
|
user = "forgejo";
|
||||||
|
state = "/var/lib/forgejo";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
users = {
|
||||||
|
users.${user} = {
|
||||||
|
description = "Forgejo Service";
|
||||||
|
home = state;
|
||||||
|
group = user;
|
||||||
|
useDefaultShell = true;
|
||||||
|
isSystemUser = true;
|
||||||
|
};
|
||||||
|
groups.${user} = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
forgejo = {
|
||||||
|
enable = true;
|
||||||
|
user = user;
|
||||||
|
group = user;
|
||||||
|
stateDir = state;
|
||||||
|
# https://forgejo.org/docs/latest/admin/config-cheat-sheet/
|
||||||
|
settings = {
|
||||||
|
server = {
|
||||||
|
HTTP_PORT = 3200;
|
||||||
|
HTTP_ADDR = "127.0.0.1";
|
||||||
|
DOMAIN = domain;
|
||||||
|
ROOT_URL = "https://${domain}/";
|
||||||
|
LANDING_PAGE = "explore";
|
||||||
|
};
|
||||||
|
|
||||||
|
service = {
|
||||||
|
DISABLE_REGISTRATION = lib.mkForce true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nginx.virtualHosts.${domain} = {
|
||||||
|
enableACME = true;
|
||||||
|
forceSSL = true;
|
||||||
|
locations."/" = {
|
||||||
|
proxyPass = "http://localhost:3200/";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -3,8 +3,9 @@
|
||||||
imports =
|
imports =
|
||||||
[
|
[
|
||||||
/etc/nixos/hardware-configuration.nix
|
/etc/nixos/hardware-configuration.nix
|
||||||
./profiles/freshrss.nix
|
# /profiles/freshrss.nix
|
||||||
./profiles/cgit.nix
|
# ./profiles/cgit.nix
|
||||||
|
# ./profiles/kotori.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# Use the GRUB 2 boot loader.
|
# Use the GRUB 2 boot loader.
|
||||||
|
@ -33,58 +34,58 @@
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "kamoshi";
|
hostName = "kamoshi";
|
||||||
nat = {
|
# nat = {
|
||||||
enable = true;
|
# enable = true;
|
||||||
externalInterface = "eth0";
|
# externalInterface = "eth0";
|
||||||
internalInterfaces = [ "wg0" ];
|
# internalInterfaces = [ "wg0" ];
|
||||||
};
|
# };
|
||||||
firewall = {
|
firewall = {
|
||||||
enable = true;
|
enable = true;
|
||||||
allowedTCPPorts = [
|
allowedTCPPorts = [
|
||||||
22 # endlessh
|
22 # endlessh
|
||||||
80 # nginx
|
80 # nginx
|
||||||
443 # nginx TLS
|
443 # nginx TLS
|
||||||
2222 # ssh
|
2222 # ssh
|
||||||
22070 22067 # syncthing relay
|
# 22070 22067 # syncthing relay
|
||||||
];
|
];
|
||||||
allowedUDPPorts = [
|
# allowedUDPPorts = [
|
||||||
42069 # wireguard
|
# 42069 # wireguard
|
||||||
];
|
# ];
|
||||||
interfaces = {
|
# interfaces = {
|
||||||
"wg0" = {
|
# "wg0" = {
|
||||||
allowedTCPPorts = [
|
# allowedTCPPorts = [
|
||||||
8384 22000 # syncthing
|
# 8384 22000 # syncthing
|
||||||
];
|
# ];
|
||||||
allowedUDPPorts = [
|
# allowedUDPPorts = [
|
||||||
22000 21027 # syncthing
|
# 22000 21027 # syncthing
|
||||||
];
|
# ];
|
||||||
};
|
# };
|
||||||
};
|
# };
|
||||||
};
|
|
||||||
wireguard.interfaces = {
|
|
||||||
"wg0" = {
|
|
||||||
ips = [ "10.100.0.1/24" ];
|
|
||||||
listenPort = 42069;
|
|
||||||
postSetup = ''
|
|
||||||
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE
|
|
||||||
'';
|
|
||||||
postShutdown = ''
|
|
||||||
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE
|
|
||||||
'';
|
|
||||||
privateKeyFile = "/root/secrets/wireguard/kamoshi";
|
|
||||||
|
|
||||||
peers = [
|
|
||||||
{
|
|
||||||
publicKey = "26lQ3qCZrZ3hAqLIDfQNrmFQSQv983TeyXpJUY59QkI=";
|
|
||||||
allowedIPs = [ "10.100.0.2/32" ];
|
|
||||||
}
|
|
||||||
{
|
|
||||||
publicKey = "W3HCbtf/m/MUZSTTq/Dr9w0mfHjH5eYfOxWtq+eLFXw=";
|
|
||||||
allowedIPs = [ "10.100.0.3/32" ];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
# wireguard.interfaces = {
|
||||||
|
# "wg0" = {
|
||||||
|
# ips = [ "10.100.0.1/24" ];
|
||||||
|
# listenPort = 42069;
|
||||||
|
# postSetup = ''
|
||||||
|
# ${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE
|
||||||
|
# '';
|
||||||
|
# postShutdown = ''
|
||||||
|
# ${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE
|
||||||
|
# '';
|
||||||
|
# privateKeyFile = "/root/secrets/wireguard/kamoshi";
|
||||||
|
#
|
||||||
|
# peers = [
|
||||||
|
# {
|
||||||
|
# publicKey = "26lQ3qCZrZ3hAqLIDfQNrmFQSQv983TeyXpJUY59QkI=";
|
||||||
|
# allowedIPs = [ "10.100.0.2/32" ];
|
||||||
|
# }
|
||||||
|
# {
|
||||||
|
# publicKey = "W3HCbtf/m/MUZSTTq/Dr9w0mfHjH5eYfOxWtq+eLFXw=";
|
||||||
|
# allowedIPs = [ "10.100.0.3/32" ];
|
||||||
|
# }
|
||||||
|
# ];
|
||||||
|
# };
|
||||||
|
# };
|
||||||
};
|
};
|
||||||
|
|
||||||
time.timeZone = "Europe/Warsaw";
|
time.timeZone = "Europe/Warsaw";
|
||||||
|
@ -101,9 +102,9 @@
|
||||||
vim
|
vim
|
||||||
wget
|
wget
|
||||||
neovim
|
neovim
|
||||||
neofetch
|
# neofetch
|
||||||
nushell
|
# nushell
|
||||||
wireguard-tools
|
# wireguard-tools
|
||||||
];
|
];
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
@ -133,25 +134,25 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
syncthing = {
|
# syncthing = {
|
||||||
enable = true;
|
# enable = true;
|
||||||
user = "kamov";
|
# user = "kamov";
|
||||||
dataDir = "/home/kamov/sync";
|
# dataDir = "/home/kamov/sync";
|
||||||
configDir = "/home/kamov/sync/.config";
|
# configDir = "/home/kamov/sync/.config";
|
||||||
guiAddress = "0.0.0.0:8384";
|
# guiAddress = "0.0.0.0:8384";
|
||||||
extraOptions.gui = {
|
# extraOptions.gui = {
|
||||||
user = "admin";
|
# user = "admin";
|
||||||
password = "admin";
|
# password = "admin";
|
||||||
};
|
# };
|
||||||
# public relay options
|
# # public relay options
|
||||||
relay = {
|
# relay = {
|
||||||
enable = true;
|
# enable = true;
|
||||||
providedBy = "kamoshi.org";
|
# providedBy = "kamoshi.org";
|
||||||
statusPort = 22070;
|
# statusPort = 22070;
|
||||||
port = 22067;
|
# port = 22067;
|
||||||
globalRateBps = 25000;
|
# globalRateBps = 25000;
|
||||||
};
|
# };
|
||||||
};
|
# };
|
||||||
};
|
};
|
||||||
|
|
||||||
security.acme = {
|
security.acme = {
|
||||||
|
@ -159,20 +160,6 @@
|
||||||
defaults.email = "maciej@kamoshi.org";
|
defaults.email = "maciej@kamoshi.org";
|
||||||
};
|
};
|
||||||
|
|
||||||
virtualisation = {
|
|
||||||
docker.enable = true;
|
|
||||||
oci-containers = {
|
|
||||||
backend = "docker";
|
|
||||||
containers = {
|
|
||||||
kotori = {
|
|
||||||
image = "kamov/kotori";
|
|
||||||
environmentFiles = [ /root/secrets/kotori.env ];
|
|
||||||
autoStart = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# This value determines the NixOS release from which the default
|
# This value determines the NixOS release from which the default
|
||||||
# settings for stateful data, like file locations and database versions
|
# settings for stateful data, like file locations and database versions
|
||||||
# on your system were taken. It's perfectly fine and recommended to leave
|
# on your system were taken. It's perfectly fine and recommended to leave
|
||||||
|
|
|
@ -8,6 +8,7 @@ in
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
description = "git user";
|
description = "git user";
|
||||||
home = home;
|
home = home;
|
||||||
|
group = "users";
|
||||||
shell = "${pkgs.git}/bin/git-shell";
|
shell = "${pkgs.git}/bin/git-shell";
|
||||||
openssh.authorizedKeys.keyFiles = [
|
openssh.authorizedKeys.keyFiles = [
|
||||||
/root/secrets/ssh/kamov.pub
|
/root/secrets/ssh/kamov.pub
|
||||||
|
|
19
kotori.nix
Normal file
19
kotori.nix
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{
|
||||||
|
virtualisation = {
|
||||||
|
podman = {
|
||||||
|
enable = true;
|
||||||
|
dockerCompat = true;
|
||||||
|
};
|
||||||
|
oci-containers = {
|
||||||
|
backend = "podman";
|
||||||
|
containers = {
|
||||||
|
kotori = {
|
||||||
|
image = "kamov/kotori:latest";
|
||||||
|
environmentFiles = [ /root/.secrets/kotori.env ];
|
||||||
|
autoStart = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
31
nix.nix
Normal file
31
nix.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{ 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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
git
|
||||||
|
vim
|
||||||
|
wget
|
||||||
|
neovim
|
||||||
|
];
|
||||||
|
}
|
25
ssh.nix
Normal file
25
ssh.nix
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{
|
||||||
|
users.users.kamov = {
|
||||||
|
isNormalUser = true;
|
||||||
|
extraGroups = [ "wheel" "www" ];
|
||||||
|
openssh.authorizedKeys.keyFiles = [ /root/.ssh/kamov.pub ];
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [ 22 2222 ];
|
||||||
|
|
||||||
|
services = {
|
||||||
|
endlessh = {
|
||||||
|
enable = true;
|
||||||
|
port = 22;
|
||||||
|
};
|
||||||
|
openssh = {
|
||||||
|
enable = true;
|
||||||
|
ports = [ 2222 ];
|
||||||
|
settings = {
|
||||||
|
PasswordAuthentication = false;
|
||||||
|
KbdInteractiveAuthentication = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
41
web.nix
Normal file
41
web.nix
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{ 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";
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||||
|
|
||||||
|
services = {
|
||||||
|
nginx = {
|
||||||
|
enable = true;
|
||||||
|
recommendedTlsSettings = true;
|
||||||
|
recommendedGzipSettings = true;
|
||||||
|
recommendedOptimisation = true;
|
||||||
|
recommendedProxySettings = true;
|
||||||
|
|
||||||
|
virtualHosts."kamoshi.org" = {
|
||||||
|
root = "/var/www/kamoshi.org";
|
||||||
|
forceSSL = true;
|
||||||
|
enableACME = true;
|
||||||
|
|
||||||
|
listen = [
|
||||||
|
{ addr = "[::]"; port = 80; ssl = false; }
|
||||||
|
{ addr = "0.0.0.0"; port = 80; ssl = false; }
|
||||||
|
{ addr = "[::]"; port = 443; ssl = true; }
|
||||||
|
{ addr = "0.0.0.0"; port = 443; ssl = true; }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue