Files
archtika/nix/dev-vm.nix

118 lines
2.4 KiB
Nix
Raw Normal View History

{
pkgs,
lib,
modulesPath,
...
}:
{
imports = [ "${modulesPath}/virtualisation/qemu-vm.nix" ];
networking = {
hostName = "archtika";
firewall.enable = false;
};
nix.settings.experimental-features = [ "nix-command flakes" ];
users.users.dev = {
isNormalUser = true;
extraGroups = [ "wheel" ];
password = "dev";
};
2025-01-03 15:58:12 +01:00
systemd.tmpfiles.settings = {
"10-archtika" = {
"/var/www/archtika-websites" = {
d = {
mode = "0777";
user = "root";
group = "root";
};
};
};
};
virtualisation = {
2025-01-03 15:58:12 +01:00
msize = 65536;
graphics = false;
2024-10-03 18:51:30 +02:00
memorySize = 2048;
cores = 2;
2024-10-04 17:09:51 +02:00
diskSize = 10240;
sharedDirectories = {
websites = {
source = "/var/www/archtika-websites";
target = "/var/www/archtika-websites";
};
};
# Alternatively a bridge network for QEMU could be setup, but requires much more effort
forwardPorts = [
{
from = "host";
host.port = 15432;
guest.port = 5432;
}
{
from = "host";
host.port = 18000;
guest.port = 1800;
}
];
};
services = {
postgresql = {
enable = true;
ensureDatabases = [ "archtika" ];
authentication = lib.mkForce ''
local all all trust
host all all all trust
'';
enableTCPIP = true;
2025-01-03 15:58:12 +01:00
extensions = ps: with ps; [ pgjwt ];
};
nginx = {
enable = true;
2024-10-03 18:51:30 +02:00
recommendedProxySettings = true;
recommendedTlsSettings = true;
recommendedZstdSettings = true;
recommendedOptimisation = true;
virtualHosts."_" = {
listen = [
{
addr = "0.0.0.0";
port = 1800;
}
];
locations = {
2024-10-03 18:51:30 +02:00
"/previews/" = {
alias = "/var/www/archtika-websites/previews/";
index = "index.html";
tryFiles = "$uri $uri/ $uri.html =404";
};
"/" = {
root = "/var/www/archtika-websites";
index = "index.html";
tryFiles = "$uri $uri/ $uri.html =404";
};
};
extraConfig = ''
port_in_redirect off;
absolute_redirect off;
'';
};
};
};
systemd.services.postgresql = {
path = with pkgs; [
gnutar
gzip
];
};
2024-09-01 18:25:32 +02:00
services.getty.autologinUser = "dev";
system.stateVersion = "24.05";
}