This commit is contained in:
chaos 2023-10-16 18:17:28 +01:00
parent 13afaf15a4
commit 85e38766ce
No known key found for this signature in database
13 changed files with 39 additions and 63 deletions

View file

@ -21,7 +21,6 @@
nixos-wsl.inputs.flake-utils.follows = "flake-utils"; nixos-wsl.inputs.flake-utils.follows = "flake-utils";
nixos-wsl.inputs.flake-compat.follows = "flake-compat"; nixos-wsl.inputs.flake-compat.follows = "flake-compat";
tree-input.url = "github:kittywitch/tree"; tree-input.url = "github:kittywitch/tree";
tree-input.inputs.nixpkgs.follows = "nixpkgs-unstable"; tree-input.inputs.nixpkgs.follows = "nixpkgs-unstable";

View file

@ -1,36 +1,21 @@
{ {lib, ...}: let
self,
lib,
...
}: let
inherit (lib.modules) mkMerge; inherit (lib.modules) mkMerge;
inherit (lib.lists) forEach;
inherit (builtins) attrNames;
containerAddresses = import "${self}/hosts/hetzner-arm/data/containerAddresses.nix";
in { in {
programs.ssh.enable = true; programs.ssh = {
programs.ssh.matchBlocks = enable = true;
mkMerge matchBlocks = mkMerge [
((forEach ["hetzner-arm" "hetzner-arm-decrypt" "vault" "vault-decrypt" "raspberry"] (hostname: { (mkMerge (map (hostname: {
"${hostname}" = { "${hostname}" = {
user = "root"; user = "root";
hostname = "${hostname}.servers.genderfucked.monster"; hostname = "${hostname}.servers.genderfucked.monster";
}; };
})) }) ["hetzner-arm" "hetzner-arm-decrypt" "vault" "vault-decrypt" "raspberry"]))
++ (forEach (attrNames containerAddresses.containers) (name: { {
"hetzner-arm-container-${name}" = { "blahaj" = {
user = "root"; user = "chaos";
hostname = "${containerAddresses.containers.${name}}"; hostname = "blahaj.sapphicco.de";
proxyJump = "hetzner-arm";
}; };
})) }
++ [ ];
{ };
"blahaj" = {
user = "chaos";
hostname = "blahaj.sapphicco.de";
};
}
]);
} }

View file

@ -31,9 +31,6 @@ in {
[ [
presets.nixos.containerBase presets.nixos.containerBase
./secrets.nix ./secrets.nix
#./profiles/postgres.nix
#./profiles/restic.nix
] ]
++ (with hosts.hetzner-arm.containers.caldav.profiles; [ ++ (with hosts.hetzner-arm.containers.caldav.profiles; [
radicale radicale

View file

@ -35,8 +35,6 @@ in {
imports = with tree; imports = with tree;
[ [
presets.nixos.containerBase presets.nixos.containerBase
profiles.sshd
profiles.firewallAllow.ssh
./secrets.nix ./secrets.nix
] ]

View file

@ -54,12 +54,11 @@ in {
[ [
presets.nixos.containerBase presets.nixos.containerBase
profiles.nginx
./secrets.nix ./secrets.nix
] ]
++ (with hosts.hetzner-arm.containers.mail; [ ++ (with hosts.hetzner-arm.containers.mail; [
modules.mailserver modules.mailserver
profiles.mailserver profiles.mailserver
profiles.restic profiles.restic
]); ]);

View file

@ -43,8 +43,6 @@ in {
imports = with tree; imports = with tree;
[ [
presets.nixos.containerBase presets.nixos.containerBase
profiles.sshd
profiles.firewallAllow.ssh
profiles.nginx profiles.nginx
profiles.firewallAllow.httpCommon profiles.firewallAllow.httpCommon
@ -89,7 +87,8 @@ in {
in { in {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
locations = mkMerge ([ locations =
mkMerge [
{ {
"/mpd/flac" = { "/mpd/flac" = {
proxyPass = "http://${containerIP}:${toString ports.mpd-flac}"; proxyPass = "http://${containerIP}:${toString ports.mpd-flac}";
@ -97,7 +96,7 @@ in {
}; };
} }
] ]
++ (forEach ["low" "medium" "high"] (quality: { ++ (mkMerge (forEach ["low" "medium" "high"] (quality: {
"/mpd/opus-${quality}" = { "/mpd/opus-${quality}" = {
proxyPass = "http://${containerIP}:${toString ports."mpd-opus-${quality}"}"; proxyPass = "http://${containerIP}:${toString ports."mpd-opus-${quality}"}";
inherit extraConfig; inherit extraConfig;

View file

@ -27,13 +27,15 @@ in {
config = {...}: { config = {...}: {
nixpkgs.pkgs = pkgs; nixpkgs.pkgs = pkgs;
imports = with tree; [ imports = with tree;
presets.nixos.containerBase [
./secrets.nix presets.nixos.containerBase
./secrets.nix
./profiles/postgres.nix ]
./profiles/restic.nix ++ (with hosts.hetzner-arm.containers.postgresql.profiles; [
]; postgres
restic
]);
networking.firewall.allowedTCPPorts = [5432]; networking.firewall.allowedTCPPorts = [5432];

View file

@ -30,8 +30,6 @@ in {
imports = with tree; imports = with tree;
[ [
presets.nixos.containerBase presets.nixos.containerBase
profiles.sshd
profiles.firewallAllow.ssh
./secrets.nix ./secrets.nix
] ]

View file

@ -30,9 +30,6 @@ in {
imports = with tree; imports = with tree;
[ [
presets.nixos.containerBase presets.nixos.containerBase
profiles.sshd
profiles.firewallAllow.ssh
./secrets.nix ./secrets.nix
] ]
++ (with hosts.hetzner-arm.containers.social.profiles; [ ++ (with hosts.hetzner-arm.containers.social.profiles; [

View file

@ -37,10 +37,6 @@ in {
imports = with tree; imports = with tree;
[ [
presets.nixos.containerBase presets.nixos.containerBase
profiles.sshd
profiles.firewallAllow.ssh
./secrets.nix ./secrets.nix
] ]
++ (with hosts.hetzner-arm.containers.storage.profiles; [ ++ (with hosts.hetzner-arm.containers.storage.profiles; [

View file

@ -1,5 +1,5 @@
{ tree, ... }: { {tree, ...}: {
imports = with tree;[ imports = with tree; [
users.root users.root
users.chaos users.chaos
profiles.sshd profiles.sshd

View file

@ -1,8 +1,12 @@
{ config, pkgs, lib, ... }: let {
config,
pkgs,
lib,
...
}: let
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
cfg = config.wsl; cfg = config.wsl;
in in {
{
config = mkIf cfg.enable { config = mkIf cfg.enable {
system.build.tarballBuilderExt = pkgs.writeShellApplication { system.build.tarballBuilderExt = pkgs.writeShellApplication {
name = "nixos-wsl-tarball-builder-ext"; name = "nixos-wsl-tarball-builder-ext";

View file

@ -17,7 +17,9 @@
"tablet" "tablet"
] ]
then usbSSHKeyFile then usbSSHKeyFile
else if builtins.elem currentHostname ["wsl"] then normalSSHKeyFile else throw "host isn't configured for remote-builders"; else if builtins.elem currentHostname ["wsl"]
then normalSSHKeyFile
else throw "host isn't configured for remote-builders";
builderDefaults = { builderDefaults = {
sshUser = "root"; sshUser = "root";