feat(website): created vm

This commit is contained in:
catvayor 2024-10-28 11:15:27 +01:00
parent 7f5761a250
commit 01f804a517
Signed by: lbailly
GPG key ID: CE3E645251AC63F3
6 changed files with 164 additions and 2 deletions

View file

@ -39,11 +39,11 @@ with lib;
{
kat = {
anywhere = pkgs.writeShellApplication {
name = "anywhere-deploy_${name}.sh";
name = "anywhere-deploy_${config.networking.hostName}.sh";
runtimeInputs = [ pkgs.nixos-anywhere ];
# --kexec ${nodes.kat-kexec.config.system.build.kexecTarball}/${nodes.kat-kexec.config.system.kexec-installer.name}-${pkgs.stdenv.hostPlatform.system}.tar.gz
text = ''
nixos-anywhere --store-paths ${config.system.build.diskoScriptNoDeps} ${config.system.build.toplevel} ${config.deployment.targetHost}
nixos-anywhere --no-substitute-on-destination --store-paths ${config.system.build.diskoScriptNoDeps} ${config.system.build.toplevel} ${config.deployment.targetHost}
'';
};
};

View file

@ -35,6 +35,7 @@
redirects = [
"kat-orchid"
"kat-son"
"kat-www"
"kat-virt"
"kat-mail-test"
];

View file

@ -0,0 +1,95 @@
{
config,
lib,
pkgs,
...
}:
{
deployment = {
targetHost = "www.kat";
tags = [ "kat-vms" ];
};
imports = [
./hardware-configuration.nix
./disks.nix
];
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
kernelParams = [ "console=ttyS0" ];
};
kat = {
fqdn = "website.katvayor.net";
proxies = {
aliases = [
"www.katvayor.net"
"katvayor.net"
];
ip = "192.168.122.7";
};
};
systemd.network.enable = lib.mkForce false;
networking = {
useNetworkd = lib.mkForce false;
interfaces."enp1s0" = {
useDHCP = false;
ipv4.addresses = [
{
address = "192.168.122.7";
prefixLength = 24;
}
];
ipv6.addresses = [
{
address = "fe80::7";
prefixLength = 64;
}
];
};
defaultGateway = "192.168.122.1";
defaultGateway6 = {
address = "fe80::1";
interface = "enp1s0";
};
nameservers = [
"192.168.122.1"
"fe80::1%enp1s0"
];
};
networking.firewall.enable = false;
security.acme = {
acceptTerms = true;
defaults.email = "root@katvayor.net";
};
services = {
openssh.enable = true;
qemuGuest.enable = true;
nginx = {
enable = true;
virtualHosts = {
"website.katvayor.net" = {
serverAliases = [
"www.katvayor.net"
"katvayor.net"
];
enableACME = true;
addSSL = true;
locations."/" = {
alias = "/var/lib/www/";
index = "index.html";
};
};
};
};
};
system.stateVersion = "23.11";
}

View file

@ -0,0 +1,36 @@
{
disko.devices = {
disk = {
vda = {
device = "/dev/vda";
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = {
type = "EF00";
size = "100M";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "bcachefs";
mountpoint = "/";
mountOptions = [
"fsck"
"fix_errors"
];
};
};
};
};
};
};
};
}

View file

@ -0,0 +1,25 @@
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.initrd.availableKernelModules = [
"ahci"
"xhci_pci"
"virtio_pci"
"sr_mod"
"virtio_blk"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View file

@ -39,6 +39,11 @@
hostname = "fe80::6%%virbr0";
proxyJump = "manah.kat";
};
"www.kat" = {
user = "root";
hostname = "fe80::7%%virbr0";
proxyJump = "manah.kat";
};
"sas.ens" = {
user = "lbailly";