Initial commit, nodes are mostly done, panel is WIP
This commit is contained in:
aloslider committed 2026-11-17 10:47:39 +03:00
commit 67b1571e28
73 files changed
+3410

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
{ ... }:
{
boot.kernelModules = [ "tcp_bbr" ];
boot.kernel.sysctl = {
"net.ipv4.tcp_congestion_control" = "bbr";
"net.core.default_qdisc" = "fq";
};
}
+31
View File
@@ -0,0 +1,31 @@
{
config,
lib,
...
}:
with lib;
let
firmware = config.vps.boot.firmware;
in
{
options.vps.boot.firmware = mkOption {
type = types.enum [
"uefi"
"bios"
];
};
config = {
zramSwap.enable = true;
boot.loader =
if firmware == "uefi" then {
systemd-boot.enable = true;
efi.canTouchEfiVariables = false;
}
else if firmware == "bios" then {
grub.enable = true;
}
else throw "Unknown boot firmware type";
};
}
+14
View File
@@ -0,0 +1,14 @@
{ ... }:
{
imports = [
./bbr.nix
./boot.nix
./disko.nix
./locale.nix
./nix.nix
./openssh.nix
./packages.nix
./sops.nix
./virtualisation.nix
];
}
+71
View File
@@ -0,0 +1,71 @@
{
config,
disko,
lib,
...
}:
with lib;
let
cfg = config.disko.cfg;
in
{
imports = [
disko.nixosModules.disko
];
options.disko.cfg = {
mainDevice = mkOption {
type = types.str;
description = "Main disk name";
};
};
config = {
disko.devices.disk.main = {
device = cfg.mainDevice;
type = "disk";
content = {
type = "gpt";
partitions =
let
swap = {
size = "4G";
priority = 2000;
content.type = "swap";
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
mountOptions = [ "noatime" ];
};
};
in
if config.vps.boot.firmware == "uefi" then
{
ESP = {
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
inherit swap root;
}
else
{
boot = {
size = "1M";
type = "EF02";
};
inherit swap root;
};
};
};
};
}
+11
View File
@@ -0,0 +1,11 @@
{ ... }:
{
time.timeZone = "Europe/Moscow";
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_TIME = "en_GB.UTF-8";
};
};
}
+21
View File
@@ -0,0 +1,21 @@
{ ... }:
{
nix = {
gc = {
automatic = true;
dates = "daily";
options = "--delete-older-than 7d";
};
settings = {
experimental-features = [
"nix-command"
"flakes"
];
auto-optimise-store = true;
trusted-users = [
"root"
"benq"
];
};
};
}
+23
View File
@@ -0,0 +1,23 @@
{ config, lib, ... }:
let
cfg = config.vps.ssh;
in
{
options.vps.ssh = {
public = lib.mkEnableOption "SSH on the public interface";
};
config = {
services.openssh = {
enable = cfg.public;
ports = [ 22 ];
settings = {
PasswordAuthentication = false;
PermitEmptyPasswords = false;
KbdInteractiveAuthentication = false;
PermitRootLogin = "no";
PubkeyAuthentication = true;
};
};
};
}
+19
View File
@@ -0,0 +1,19 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
age
bat
btop
curl
git
jq
lazydocker
lazygit
openssl
ripgrep
sops
tmux
vim
wget
];
}
+17
View File
@@ -0,0 +1,17 @@
{
config,
inputs,
lib,
...
}:
{
imports = [
inputs.sops-nix.nixosModules.sops
];
sops = {
defaultSopsFile = lib.custom.relativeToRoot "hosts/${config.networking.hostName}/secrets.yaml";
age.keyFile = "/etc/age/key.txt";
validateSopsFiles = false;
};
}
+14
View File
@@ -0,0 +1,14 @@
{ ... }:
{
virtualisation = {
oci-containers.backend = "docker";
docker = {
enable = true;
daemon.settings = {
log-driver = "journald";
};
};
};
services.journald.settings.Journal.SystemMaxUse = "200M";
}