2023-09-16 13:58:47 +02:00
|
|
|
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
|
|
|
# and may be overwritten by future invocations. Please make changes
|
|
|
|
|
# to /etc/nixos/configuration.nix instead.
|
|
|
|
|
{ config, lib, pkgs, modulesPath, ... }: {
|
|
|
|
|
imports = [
|
|
|
|
|
(modulesPath + "/installer/scan/not-detected.nix")
|
2023-10-07 14:50:22 +02:00
|
|
|
|
./temp.nix
|
2023-09-16 13:58:47 +02:00
|
|
|
|
];
|
2023-10-07 12:33:05 +02:00
|
|
|
|
# Enable distributed Builds
|
|
|
|
|
nix.distributedBuilds = true;
|
2023-10-07 14:50:22 +02:00
|
|
|
|
|
|
|
|
|
# Enablet docker and docker-compose
|
|
|
|
|
environment.systemPackages = [ pkgs.docker-compose ];
|
|
|
|
|
virtualisation.docker.enable = true;
|
|
|
|
|
|
2023-09-16 13:58:47 +02:00
|
|
|
|
#####################################################################################
|
|
|
|
|
# BEGIN hardware config
|
|
|
|
|
#####################################################################################
|
|
|
|
|
|
|
|
|
|
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
|
|
|
|
|
boot.loader.grub.enable = false;
|
|
|
|
|
# Enables the generation of /boot/extlinux/extlinux.conf
|
|
|
|
|
boot.loader.generic-extlinux-compatible.enable = true;
|
|
|
|
|
|
|
|
|
|
boot.initrd.availableKernelModules = [ "xhci_pci" "usbhid" ];
|
|
|
|
|
boot.initrd.kernelModules = [ ];
|
|
|
|
|
boot.kernelModules = [ ];
|
|
|
|
|
boot.extraModulePackages = [ ];
|
|
|
|
|
|
|
|
|
|
fileSystems."/" = {
|
2023-09-18 13:55:01 +02:00
|
|
|
|
device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
|
|
|
|
|
fsType = "ext4";
|
|
|
|
|
};
|
2023-09-16 13:58:47 +02:00
|
|
|
|
|
|
|
|
|
swapDevices = [ ];
|
|
|
|
|
networking.useDHCP = lib.mkDefault true;
|
|
|
|
|
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
|
|
|
|
|
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
|
|
|
|
|
networking.hostName = "nixos-rpi4-03";
|
|
|
|
|
#####################################################################################
|
|
|
|
|
# END hardware config
|
|
|
|
|
#####################################################################################
|
|
|
|
|
|
|
|
|
|
# Generic Tailscale configs are in /nixos/common/services/tailscale.nix
|
|
|
|
|
# Set up the secrets file:
|
2023-09-18 13:54:09 +02:00
|
|
|
|
sops.secrets."tailscale_keys/nixos-rpi4-03" = {
|
2023-09-16 13:58:47 +02:00
|
|
|
|
owner = "root";
|
|
|
|
|
sopsFile = ../../../secrets/tailscale.yaml;
|
|
|
|
|
restartUnits = [
|
|
|
|
|
"tailscaled.service"
|
|
|
|
|
"tailscaled-autoconnect.service"
|
|
|
|
|
];
|
|
|
|
|
};
|
2023-09-18 13:49:11 +02:00
|
|
|
|
services.tailscale.authKeyFile = "/run/secrets/tailscale_keys/nixos-rpi4-03";
|
2023-09-16 13:58:47 +02:00
|
|
|
|
services.tailscale.extraUpFlags = [ "--advertise-exit-node" ];
|
|
|
|
|
boot.kernel.sysctl = { "net.ipv4.ip_forward" = true; };
|
|
|
|
|
|
|
|
|
|
# Temporary
|
2023-10-08 10:22:10 +02:00
|
|
|
|
# networking.firewall.allowedTCPPorts = [ 22 ];
|
|
|
|
|
# networking.firewall.allowedUDPPorts = [ 51820 ];
|
2023-10-07 12:33:05 +02:00
|
|
|
|
|
|
|
|
|
# Set up the secrets file:
|
2023-10-07 12:35:35 +02:00
|
|
|
|
sops.secrets."wireguard_keys/nixos-rpi4-03" = {
|
2023-10-07 12:33:05 +02:00
|
|
|
|
owner = "root";
|
|
|
|
|
sopsFile = ../../../secrets/wireguard.yaml;
|
|
|
|
|
};
|
|
|
|
|
sops.secrets."wireguard_keys/preshared_key" = {
|
|
|
|
|
owner = "root";
|
|
|
|
|
sopsFile = ../../../secrets/wireguard.yaml;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Wireguard Forwarder
|
2023-10-07 14:29:33 +02:00
|
|
|
|
networking.firewall.allowPing = true;
|
2023-10-07 12:33:05 +02:00
|
|
|
|
networking.wireguard = {
|
2023-10-07 14:27:15 +02:00
|
|
|
|
enable = true;
|
2023-10-07 12:33:05 +02:00
|
|
|
|
interfaces = {
|
|
|
|
|
"wireguard0" = {
|
2023-10-07 13:10:33 +02:00
|
|
|
|
ips = [ "10.100.0.2/24" ];
|
|
|
|
|
listenPort = 51820;
|
2023-10-07 12:33:05 +02:00
|
|
|
|
privateKeyFile = "/run/secrets/wireguard_keys/nixos-rpi4-03";
|
|
|
|
|
# Testing
|
|
|
|
|
peers = [
|
|
|
|
|
{ # osaka-vultr-01
|
|
|
|
|
publicKey = "yPZ3EmmIqCkReXf1DRTxzVaKQ2k+ifGmYJHji5nnMmE=";
|
2023-10-07 13:10:33 +02:00
|
|
|
|
presharedKeyFile = "/run/secrets/wireguard_keys/preshared_key";
|
2023-10-07 12:33:05 +02:00
|
|
|
|
persistentKeepalive = 5;
|
2023-10-07 14:24:45 +02:00
|
|
|
|
allowedIPs = [ "10.100.0.1/32" ];
|
2023-10-07 12:33:05 +02:00
|
|
|
|
endpoint = "64.176.54.57:51820";
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
2023-09-16 13:58:47 +02:00
|
|
|
|
}
|