mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-12-07 13:32:15 -06:00
feat: added midnight miner
This commit is contained in:
parent
ada1ed4b14
commit
5e24256bcf
11 changed files with 775 additions and 117 deletions
|
|
@ -124,8 +124,9 @@ in
|
|||
caddy = {
|
||||
enable = true;
|
||||
virtualHosts = {
|
||||
"${serviceCfg.interface.ip}" = {
|
||||
":80" = {
|
||||
extraConfig = ''
|
||||
# Remove the outer http:// block wrapper
|
||||
handle_path /system/* {
|
||||
file_server * {
|
||||
root /var/lib/mastodon/public-system
|
||||
|
|
@ -198,6 +199,27 @@ in
|
|||
systemd = {
|
||||
services = {
|
||||
systemd-networkd.wantedBy = [ "multi-user.target" ];
|
||||
mastodon-web.wantedBy = [ "multi-user.target" ];
|
||||
mastodon-streaming-1.wantedBy = [ "multi-user.target" ];
|
||||
mastodon-streaming-2.wantedBy = [ "multi-user.target" ];
|
||||
mastodon-streaming-3.wantedBy = [ "multi-user.target" ];
|
||||
mastodon-streaming-4.wantedBy = [ "multi-user.target" ];
|
||||
mastodon-streaming-5.wantedBy = [ "multi-user.target" ];
|
||||
mastodon-streaming-6.wantedBy = [ "multi-user.target" ];
|
||||
mastodon-streaming-7.wantedBy = [ "multi-user.target" ];
|
||||
mastodon-sidekiq-all.wantedBy = [ "multi-user.target" ];
|
||||
mastodon-sidekiq-default.wantedBy = [ "multi-user.target" ];
|
||||
mastodon-sidekiq-ingress.wantedBy = [ "multi-user.target" ];
|
||||
mastodon-sidekiq-mailers.wantedBy = [ "multi-user.target" ];
|
||||
mastodon-sidekiq-push-pull.wantedBy = [ "multi-user.target" ];
|
||||
mastodon-init-db = {
|
||||
environment = {
|
||||
DISABLE_BOOTSNAP = "1";
|
||||
};
|
||||
serviceConfig = {
|
||||
TimeoutStartSec = "10min";
|
||||
};
|
||||
};
|
||||
copy-secrets-to-tmpfs = {
|
||||
description = "Copy secrets from virtiofs to tmpfs";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ in
|
|||
config =
|
||||
let
|
||||
macAddress = "02:00:00:00:00:${macOctet}";
|
||||
workers = deviceLogic 45 4 16 6;
|
||||
workers = deviceLogic 45 4 18 6;
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [
|
||||
|
|
|
|||
94
modules/nixos/guests/projectSite/default.nix
Executable file
94
modules/nixos/guests/projectSite/default.nix
Executable file
|
|
@ -0,0 +1,94 @@
|
|||
{
|
||||
config,
|
||||
flake,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (flake.config.people) user0;
|
||||
inherit (flake.config.services) instances;
|
||||
serviceCfg = instances.projectSite;
|
||||
host = flake.inputs.linkpage.secrets.domains.projectsite;
|
||||
websitePkg = flake.inputs.linkpage.packages.${pkgs.system}.websiteFrontend;
|
||||
in
|
||||
{
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${serviceCfg.mntPaths.path0} 0755 microvm wheel - -"
|
||||
];
|
||||
|
||||
microvm.vms.${serviceCfg.name} = {
|
||||
autostart = true;
|
||||
config = {
|
||||
system.stateVersion = "25.05";
|
||||
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
22
|
||||
8080
|
||||
];
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings.PasswordAuthentication = false;
|
||||
};
|
||||
|
||||
environment.etc."website".source = websitePkg;
|
||||
|
||||
users.users.root.openssh.authorizedKeys.keys = flake.config.people.users.${user0}.sshKeys;
|
||||
|
||||
systemd = {
|
||||
network = {
|
||||
enable = true;
|
||||
networks."10-enp" = {
|
||||
matchConfig.Name = "enp0s3";
|
||||
addresses = [ { Address = "${serviceCfg.interface.ip}/24"; } ];
|
||||
gateway = [ serviceCfg.interface.gate ];
|
||||
};
|
||||
};
|
||||
|
||||
services.website = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.miniserve}/bin/miniserve /etc/website --index index.html -p 8080";
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
microvm = {
|
||||
vcpu = 2;
|
||||
mem = 3072;
|
||||
hypervisor = "qemu";
|
||||
interfaces = [
|
||||
{
|
||||
type = "tap";
|
||||
id = serviceCfg.interface.id;
|
||||
mac = serviceCfg.interface.mac;
|
||||
}
|
||||
];
|
||||
shares = [
|
||||
{
|
||||
source = "/nix/store";
|
||||
mountPoint = "/nix/.ro-store";
|
||||
tag = "ro-store";
|
||||
proto = "virtiofs";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Host Caddy
|
||||
services.caddy = {
|
||||
enable = true;
|
||||
virtualHosts.${host}.extraConfig = ''
|
||||
reverse_proxy ${serviceCfg.interface.ip}:8080
|
||||
'';
|
||||
};
|
||||
|
||||
# ACME cert
|
||||
security.acme.certs.${host} = {
|
||||
dnsProvider = instances.web.dns.provider1;
|
||||
environmentFile = config.sops.secrets."dns/${instances.web.dns.provider1}".path;
|
||||
};
|
||||
}
|
||||
97
modules/nixos/guests/website/default.nix
Executable file
97
modules/nixos/guests/website/default.nix
Executable file
|
|
@ -0,0 +1,97 @@
|
|||
{
|
||||
config,
|
||||
flake,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (flake.config.people) user0;
|
||||
inherit (flake.config.services) instances;
|
||||
serviceCfg = instances.upRootNutrition;
|
||||
host = serviceCfg.domains.url0;
|
||||
websitePkg = flake.inputs.upRootNutrition.packages.${pkgs.system}.websiteFrontend;
|
||||
in
|
||||
{
|
||||
microvm.vms.${serviceCfg.name} = {
|
||||
autostart = true;
|
||||
config = {
|
||||
system.stateVersion = "25.05";
|
||||
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
22
|
||||
8080
|
||||
];
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings.PasswordAuthentication = false;
|
||||
};
|
||||
|
||||
environment.etc."website".source = websitePkg;
|
||||
|
||||
users.users.root.openssh.authorizedKeys.keys = flake.config.people.users.${user0}.sshKeys;
|
||||
|
||||
systemd = {
|
||||
network = {
|
||||
enable = true;
|
||||
networks."10-enp" = {
|
||||
matchConfig.Name = "enp0s3";
|
||||
addresses = [
|
||||
{ Address = "${serviceCfg.interface.ip}/24"; }
|
||||
];
|
||||
gateway = [ serviceCfg.interface.gate ];
|
||||
};
|
||||
};
|
||||
|
||||
services.website = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.miniserve}/bin/miniserve /etc/website --index index.html -p 8080";
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
microvm = {
|
||||
vcpu = 2;
|
||||
mem = 3072;
|
||||
hypervisor = "qemu";
|
||||
interfaces = [
|
||||
{
|
||||
type = "tap";
|
||||
id = serviceCfg.interface.id;
|
||||
mac = serviceCfg.interface.mac;
|
||||
}
|
||||
];
|
||||
shares = [
|
||||
{
|
||||
source = "/nix/store";
|
||||
mountPoint = "/nix/.ro-store";
|
||||
tag = "ro-store";
|
||||
proto = "virtiofs";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.caddy = {
|
||||
enable = true;
|
||||
virtualHosts.${host}.extraConfig = ''
|
||||
reverse_proxy ${serviceCfg.interface.ip}:8080
|
||||
|
||||
tls ${serviceCfg.ssl.cert} ${serviceCfg.ssl.key}
|
||||
'';
|
||||
};
|
||||
|
||||
security.acme.certs.${host} = {
|
||||
dnsProvider = instances.web.dns.provider0;
|
||||
environmentFile = config.sops.secrets."dns/${instances.web.dns.provider0}".path;
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${serviceCfg.mntPaths.path0} 0755 microvm wheel - -"
|
||||
];
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue