add vultr
This commit is contained in:
parent
642dcbe426
commit
bcc9a8762d
11 changed files with 157 additions and 4 deletions
|
@ -40,6 +40,14 @@
|
|||
];
|
||||
specialArgs = { inherit inputs; };
|
||||
};
|
||||
vultr1 = nixpkgs-stable.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
(import ./nixos/boxes/vultr1)
|
||||
agenix.nixosModules.age
|
||||
];
|
||||
specialArgs = { inherit inputs; };
|
||||
};
|
||||
};
|
||||
};
|
||||
inputs = {
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
imports = [
|
||||
./brix-boot.nix
|
||||
./real-hardware.nix
|
||||
./security.nix
|
||||
./cli.nix
|
||||
./vpn.nix
|
||||
./prometheus-node.nix
|
||||
../security.nix
|
||||
../cli.nix
|
||||
../vpn.nix
|
||||
./restic-server.nix
|
||||
./i2p.nix
|
||||
./print-server.nix
|
||||
|
|
23
nixos/boxes/vultr1/default.nix
Normal file
23
nixos/boxes/vultr1/default.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ config, pkgs, inputs, lib, ... }:
|
||||
{
|
||||
networking.hostName = "vultr1";
|
||||
|
||||
imports = [
|
||||
./vultr-boot.nix
|
||||
../vpn.nix
|
||||
../security.nix
|
||||
../cli.nix
|
||||
./nginx.nix
|
||||
./search.nix
|
||||
./folding.nix
|
||||
./matrix-front.nix
|
||||
];
|
||||
|
||||
systemd.extraConfig = ''
|
||||
DefaultTimeoutStartSec=900s
|
||||
'';
|
||||
|
||||
security.allowUserNamespaces = true;
|
||||
time.timeZone = "Europe/London";
|
||||
|
||||
}
|
10
nixos/boxes/vultr1/folding.nix
Normal file
10
nixos/boxes/vultr1/folding.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
services.foldingathome = {
|
||||
enable = true;
|
||||
user = "cyplo";
|
||||
};
|
||||
boot.kernel.sysctl = {
|
||||
"kernel.unprivileged_userns_clone" = 1;
|
||||
};
|
||||
}
|
40
nixos/boxes/vultr1/matrix-front.nix
Normal file
40
nixos/boxes/vultr1/matrix-front.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
|
||||
services.nginx = {
|
||||
virtualHosts = {
|
||||
"cyplo.dev" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."= /.well-known/matrix/server".extraConfig =
|
||||
let
|
||||
server = { "m.server" = "cyplo.dev:443"; };
|
||||
in ''
|
||||
add_header Content-Type application/json;
|
||||
return 200 '${builtins.toJSON server}';
|
||||
'';
|
||||
|
||||
locations."= /.well-known/matrix/client".extraConfig =
|
||||
let
|
||||
client = {
|
||||
"m.homeserver" = { "base_url" = "https://cyplo.dev"; };
|
||||
"m.identity_server" = { "base_url" = "https://vector.im"; };
|
||||
};
|
||||
in ''
|
||||
add_header Content-Type application/json;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
return 200 '${builtins.toJSON client}';
|
||||
'';
|
||||
|
||||
locations."/".extraConfig = ''
|
||||
return 404;
|
||||
'';
|
||||
|
||||
locations."/_matrix" = {
|
||||
proxyPass = "http://brix.vpn:8008"; # without a trailing /
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
12
nixos/boxes/vultr1/nginx.nix
Normal file
12
nixos/boxes/vultr1/nginx.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
statusPage = true;
|
||||
recommendedTlsSettings = true;
|
||||
recommendedOptimisation = true;
|
||||
recommendedGzipSettings = true;
|
||||
recommendedProxySettings = true;
|
||||
};
|
||||
}
|
27
nixos/boxes/vultr1/search.nix
Normal file
27
nixos/boxes/vultr1/search.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
|
||||
services.nginx = {
|
||||
virtualHosts = {
|
||||
"search.cyplo.dev" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
extraConfig = ''
|
||||
access_log /dev/null;
|
||||
error_log /dev/null;
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
'';
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:8888";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.searx = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
|
34
nixos/boxes/vultr1/vultr-boot.nix
Normal file
34
nixos/boxes/vultr1/vultr-boot.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
|
||||
boot = {
|
||||
initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" "virtio_net" "virtio_pci" "virtio_mmio" "virtio_blk" "virtio_scsi" "9p" "9pnet_virtio" ];
|
||||
initrd.kernelModules = [ "virtio_balloon" "virtio_console" "virtio_rng" ];
|
||||
|
||||
initrd.postDeviceCommands = ''
|
||||
# Set the system time from the hardware clock to work around a
|
||||
# bug in qemu-kvm > 1.5.2 (where the VM clock is initialised
|
||||
# to the *boot time* of the host).
|
||||
hwclock -s
|
||||
'';
|
||||
|
||||
kernelPackages = pkgs.linuxPackages_latest_hardened;
|
||||
loader.grub.enable = true;
|
||||
loader.grub.version = 2;
|
||||
loader.grub.device = "/dev/vda";
|
||||
};
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/d37c4c81-4807-4b8b-bcd4-05ae76bccbaa";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/swapfile";
|
||||
size = 2048;
|
||||
}
|
||||
];
|
||||
|
||||
}
|
||||
|
Loading…
Reference in a new issue