From ecb3bf02f585ca4d7523256c5dbb59863b214741 Mon Sep 17 00:00:00 2001 From: Constantin Gierczak--Galle Date: Thu, 5 Dec 2024 10:57:36 +0100 Subject: [PATCH 1/3] feat(homebox01): init --- machines/homebox01/_configuration.nix | 24 +++++++++++++ .../homebox01/_hardware-configuration.nix | 34 +++++++++++++++++++ machines/homebox01/homebox.nix | 16 +++++++++ machines/homebox01/nginx.nix | 11 ++++++ machines/homebox01/secrets/secrets.nix | 3 ++ meta/network.nix | 17 ++++++++++ meta/nodes.nix | 8 +++++ 7 files changed, 113 insertions(+) create mode 100644 machines/homebox01/_configuration.nix create mode 100644 machines/homebox01/_hardware-configuration.nix create mode 100644 machines/homebox01/homebox.nix create mode 100644 machines/homebox01/nginx.nix create mode 100644 machines/homebox01/secrets/secrets.nix diff --git a/machines/homebox01/_configuration.nix b/machines/homebox01/_configuration.nix new file mode 100644 index 0000000..5b5533e --- /dev/null +++ b/machines/homebox01/_configuration.nix @@ -0,0 +1,24 @@ +{ lib, ... }: + +lib.extra.mkConfig { + enabledModules = [ + # List of modules to enable + ]; + + enabledServices = [ + # List of services to enable + "homebox" + "nginx" + ]; + + extraConfig = { + networking = { + firewall.allowedTCPPorts = [ + 80 + 443 + ]; + }; + }; + + root = ./.; +} diff --git a/machines/homebox01/_hardware-configuration.nix b/machines/homebox01/_hardware-configuration.nix new file mode 100644 index 0000000..8b0d66a --- /dev/null +++ b/machines/homebox01/_hardware-configuration.nix @@ -0,0 +1,34 @@ +{ lib, modulesPath, ... }: + +{ + imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; + + boot = { + loader.systemd-boot.enable = true; + initrd.kernelModules = [ ]; + kernelModules = [ ]; + extraModulePackages = [ ]; + initrd.availableKernelModules = [ + "ata_piix" + "uhci_hcd" + "virtio_pci" + "virtio_scsi" + "sd_mod" + "sr_mod" + ]; + }; + + fileSystems."/" = { + device = "/dev/disk/by-partlabel/disk-sda-root"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-partlabel/disk-sda-ESP"; + fsType = "vfat"; + }; + + networking.useDHCP = lib.mkDefault false; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/machines/homebox01/homebox.nix b/machines/homebox01/homebox.nix new file mode 100644 index 0000000..842c130 --- /dev/null +++ b/machines/homebox01/homebox.nix @@ -0,0 +1,16 @@ +{ sources, ... }: + +{ + services.homebox = { + enable = true; + settings = { + HBOX_OPTIONS_ALLOW_REGISTRATION = "true"; + }; + }; + services.nginx.virtualHosts."homebox.cgiga.fr" = { + enableACME = true; + forceSSL = true; + serverAliases = [ ]; + locations."/".proxyPass = "http://localhost:7745/"; + }; +} diff --git a/machines/homebox01/nginx.nix b/machines/homebox01/nginx.nix new file mode 100644 index 0000000..eea7719 --- /dev/null +++ b/machines/homebox01/nginx.nix @@ -0,0 +1,11 @@ +{ + services.nginx = { + enable = true; + recommendedTlsSettings = true; + recommendedOptimisation = true; + recommendedGzipSettings = true; + recommendedProxySettings = true; + clientMaxBodySize = "500m"; + }; +} + diff --git a/machines/homebox01/secrets/secrets.nix b/machines/homebox01/secrets/secrets.nix new file mode 100644 index 0000000..8167d7d --- /dev/null +++ b/machines/homebox01/secrets/secrets.nix @@ -0,0 +1,3 @@ +(import ../../../keys).mkSecrets [ "homebox01" ] [ + # List of secrets for router02 +] diff --git a/meta/network.nix b/meta/network.nix index a9dff58..9c4c3a1 100644 --- a/meta/network.nix +++ b/meta/network.nix @@ -16,6 +16,23 @@ hostId = "1758233d"; }; + homebox01 = { + interfaces = { + ens18 = { + ipv4 = [ + { + address = "129.199.146.102"; + prefixLength = 24; + } + ]; + + gateways = [ "129.199.146.254" ]; + enableDefaultDNS = true; + }; + }; + + hostId = "ef3bd5c0"; + }; krz01 = { interfaces = { vmbr0 = { diff --git a/meta/nodes.nix b/meta/nodes.nix index c73f6c4..1bdcafa 100644 --- a/meta/nodes.nix +++ b/meta/nodes.nix @@ -36,6 +36,14 @@ stateVersion = "24.05"; nixpkgs = "unstable"; }; + homebox01 = { + site = "pav01"; + + hashedPassword = "$y$j9T$eNZQgDN.J5y7KTG2hXgat1$J1i5tjx5dnSZu.C9B7swXi5zMFIkUnmRrnmyLHFAt8/"; + + stateVersion = "24.05"; + nixpkgs = "unstable"; + }; labcore01 = { site = "pav01"; -- 2.47.0 From 8445a860c15575d3f2b0e49743c86997a48f183b Mon Sep 17 00:00:00 2001 From: Constantin Gierczak--Galle Date: Thu, 5 Dec 2024 10:58:24 +0100 Subject: [PATCH 2/3] fix: fmt --- machines/homebox01/_configuration.nix | 2 +- machines/homebox01/homebox.nix | 2 -- machines/homebox01/nginx.nix | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/machines/homebox01/_configuration.nix b/machines/homebox01/_configuration.nix index 5b5533e..f9617e1 100644 --- a/machines/homebox01/_configuration.nix +++ b/machines/homebox01/_configuration.nix @@ -11,7 +11,7 @@ lib.extra.mkConfig { "nginx" ]; - extraConfig = { + extraConfig = { networking = { firewall.allowedTCPPorts = [ 80 diff --git a/machines/homebox01/homebox.nix b/machines/homebox01/homebox.nix index 842c130..b23ad4c 100644 --- a/machines/homebox01/homebox.nix +++ b/machines/homebox01/homebox.nix @@ -1,5 +1,3 @@ -{ sources, ... }: - { services.homebox = { enable = true; diff --git a/machines/homebox01/nginx.nix b/machines/homebox01/nginx.nix index eea7719..b44aeaa 100644 --- a/machines/homebox01/nginx.nix +++ b/machines/homebox01/nginx.nix @@ -8,4 +8,3 @@ clientMaxBodySize = "500m"; }; } - -- 2.47.0 From e0a992d3780ff988a1602327d23f38b4904bea42 Mon Sep 17 00:00:00 2001 From: Constantin Gierczak--Galle Date: Thu, 5 Dec 2024 11:02:04 +0100 Subject: [PATCH 3/3] feat(homebox01): disable registration --- machines/homebox01/homebox.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/machines/homebox01/homebox.nix b/machines/homebox01/homebox.nix index b23ad4c..566554c 100644 --- a/machines/homebox01/homebox.nix +++ b/machines/homebox01/homebox.nix @@ -2,7 +2,7 @@ services.homebox = { enable = true; settings = { - HBOX_OPTIONS_ALLOW_REGISTRATION = "true"; + HBOX_OPTIONS_ALLOW_REGISTRATION = "false"; }; }; services.nginx.virtualHosts."homebox.cgiga.fr" = { -- 2.47.0