gigalint everything

This commit is contained in:
iofq 2024-01-28 17:41:08 -06:00
parent 2ce46f1cf5
commit d4c31f8fd1
39 changed files with 499 additions and 398 deletions

View file

@ -1,8 +1,12 @@
{ pkgs, addressList, ... }: {
{
pkgs,
addressList,
...
}: {
imports = [
./hardware-configuration.nix
./vms
#./eth.nix
#./eth.nix
];
environment.systemPackages = with pkgs; [
vim
@ -18,11 +22,13 @@
};
nat = {
enable = true;
forwardPorts = [ {
proto = "tcp";
sourcePort = 80;
destination = addressList.vm-test.ipv4;
} ];
forwardPorts = [
{
proto = "tcp";
sourcePort = 80;
destination = addressList.vm-test.ipv4;
}
];
};
};
services.openssh.enable = true;
@ -32,12 +38,12 @@
};
e = {
isNormalUser = true;
extraGroups = [ "wheel" ];
extraGroups = ["wheel"];
home = "/home/e";
openssh.authorizedKeys.keys = [''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHM4Zr0PFN7QdOG2aJ+nuzRCK6caulrpY6bphA1Ppl8Y e@t14''];
};
};
security.sudo.wheelNeedsPassword = false;
nix.settings.trusted-users = ["e"];
system.stateVersion = "23.11";
system.stateVersion = "23.11";
}

View file

@ -1,4 +1,8 @@
{ system, ethereum-nix, ...}: {
{
system,
ethereum-nix,
...
}: {
services.ethereum.geth.mainnet = {
enable = true;
package = ethereum-nix.packages.${system}.geth;
@ -12,15 +16,15 @@
};
};
services.nginx.enable = true;
services.nginx.virtualHosts."contabo.10110110.xyz" = {
addSSL = true;
enableACME = true;
root = "/var/www/fam";
};
security.acme = {
acceptTerms = true;
defaults.email = "cjriddz@protonmail.com";
};
services.nginx.virtualHosts."contabo.10110110.xyz" = {
addSSL = true;
enableACME = true;
root = "/var/www/fam";
};
security.acme = {
acceptTerms = true;
defaults.email = "cjriddz@protonmail.com";
};
networking.firewall = {
enable = true;
allowedTCPPorts = [80 443];
@ -46,26 +50,25 @@
history = "prune";
graffiti = "yo";
metrics = {
enable = true;
port = 5054;
address = "127.0.0.1";
enable = true;
port = 5054;
address = "127.0.0.1";
};
rest = {
enable = true;
port = 5052;
address = "0.0.0.0";
allow-origin = "*";
enable = true;
port = 5052;
address = "0.0.0.0";
allow-origin = "*";
};
payload-builder = {
enable = true;
url = "http://localhost";
};
light-client-data = {
serve = true;
import-mode = "only-new";
max-periods = "3";
serve = true;
import-mode = "only-new";
max-periods = "3";
};
};
};
}

View file

@ -1,6 +1,9 @@
{ modulesPath, lib, ... }:
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
modulesPath,
lib,
...
}: {
imports = [(modulesPath + "/profiles/qemu-guest.nix")];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
boot = {
tmp.cleanOnBoot = true;
@ -11,11 +14,11 @@
};
initrd.availableKernelModules = [
"ata_piix"
"uhci_hcd"
"xen_blkfront"
"vmw_pvscsi"
"uhci_hcd"
"xen_blkfront"
"vmw_pvscsi"
];
initrd.kernelModules = [ "nvme" ];
initrd.kernelModules = ["nvme"];
};
fileSystems = {
"/boot" = {
@ -27,16 +30,18 @@
fsType = "ext4";
};
};
swapDevices = [{
device = "/dev/dm-1";
}];
swapDevices = [
{
device = "/dev/dm-1";
}
];
zramSwap.enable = false;
networking = {
useNetworkd = true;
nat = {
enable = true;
externalInterface = "enp0s31f6";
internalInterfaces = [ "microvm" ];
internalInterfaces = ["microvm"];
};
};
systemd.network = {
@ -54,9 +59,11 @@
DHCPServer = true;
IPv6SendRA = true;
};
addresses = [ {
addressConfig.Address = "10.0.0.1/24";
} ];
addresses = [
{
addressConfig.Address = "10.0.0.1/24";
}
];
};
"11-microvm" = {
matchConfig.Name = "vm-*";

View file

@ -1,30 +1,44 @@
{ lib, pkgs, addressList, ... }:
let genVMConfig = { name, config ? {}, ro-store ? true }: {
restartIfChanged = true;
pkgs = pkgs;
config = config // {
microvm = {
shares = lib.mkIf (ro-store == true) [{
source = "/nix/store";
mountPoint = "/nix/.ro-store";
tag = "ro-store";
proto = "virtiofs";
}];
interfaces = [
{
type = "tap";
id = name;
mac = addressList.${name}.mac;
}
];
};
} // import ./vmDefaults.nix { inherit name addressList; };
};
{
lib,
pkgs,
addressList,
...
}: let
genVMConfig = {
name,
config ? {},
ro-store ? true,
}: {
restartIfChanged = true;
inherit pkgs;
config =
config
// {
microvm = {
shares = lib.mkIf ro-store [
{
source = "/nix/store";
mountPoint = "/nix/.ro-store";
tag = "ro-store";
proto = "virtiofs";
}
];
interfaces = [
{
type = "tap";
id = name;
inherit (addressList.${name}) mac;
}
];
};
}
// import ./vmDefaults.nix {inherit name addressList;};
};
in {
microvm.vms = {
vm-test = genVMConfig {
name = "vm-test";
config = import ./vm-test.nix { inherit pkgs addressList; };
config = import ./vm-test.nix {inherit pkgs addressList;};
};
};
}

View file

@ -0,0 +1,27 @@
{config, ...}: let
domain = "ts.10110110.xyz";
in {
services = {
headscale = {
enable = true;
address = "0.0.0.0";
port = 8080;
serverUrl = "https://${domain}";
dns = {baseDomain = "10110110.xyz";};
settings = {logtail.enabled = false;};
};
services.nginx = {
enable = true;
virtualHosts.${domain} = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:${toString config.services.headscale.port}";
proxyWebsockets = true;
};
};
};
};
system.stateVersion = "23.11";
}

View file

@ -1,4 +1,4 @@
{ ... }: {
_: {
networking.firewall = {
enable = true;
allowedTCPPorts = [80];

View file

@ -1,4 +1,8 @@
{ name, addressList, ...}: {
{
name,
addressList,
...
}: {
systemd.network = {
enable = true;
networks."20-lan" = {
@ -27,11 +31,12 @@
root = {
openssh.authorizedKeys.keys = [
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIItTJm2iu/5xacOoh4/JAvMtHE62duDlVVXpvVP+uQMR root@htz''
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILU2TUxKyGKoZ68IG4hw23RmxVf72u5K9W0StkgTr0b2 e@t14'' ];
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILU2TUxKyGKoZ68IG4hw23RmxVf72u5K9W0StkgTr0b2 e@t14''
];
};
e = {
isNormalUser = true;
extraGroups = [ "wheel" ];
extraGroups = ["wheel"];
openssh.authorizedKeys.keys = [
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIItTJm2iu/5xacOoh4/JAvMtHE62duDlVVXpvVP+uQMR root@htz''
''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILU2TUxKyGKoZ68IG4hw23RmxVf72u5K9W0StkgTr0b2 e@t14''