From fcc9fe0773b692132be6c95f260e88226c2c4ef0 Mon Sep 17 00:00:00 2001 From: Timo Boomers Date: Fri, 25 Apr 2025 21:09:55 +0200 Subject: [PATCH] Modified caddy to make a simple working code --- hosts/v-th-ctr-01/configuration.nix | 31 +++++++++++++++++++++++++++++ hosts/v-th-ctr-01/home.nix | 2 +- modules/home/containers/caddy.nix | 8 ++++---- 3 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 hosts/v-th-ctr-01/configuration.nix diff --git a/hosts/v-th-ctr-01/configuration.nix b/hosts/v-th-ctr-01/configuration.nix new file mode 100644 index 0000000..d2c230a --- /dev/null +++ b/hosts/v-th-ctr-01/configuration.nix @@ -0,0 +1,31 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ modulesPath, ... }: + +{ + imports = [ + # Include the default incus configuration. + "${modulesPath}/virtualisation/lxc-container.nix" + # Include the container-specific autogenerated configuration. + ]; + + networking = { + dhcpcd.enable = false; + useDHCP = false; + useHostResolvConf = false; + }; + + systemd.network = { + enable = true; + networks."50-eth0" = { + matchConfig.Name = "eth0"; + networkConfig = { + DHCP = "ipv4"; + IPv6AcceptRA = true; + }; + linkConfig.RequiredForOnline = "routable"; + }; + }; +} diff --git a/hosts/v-th-ctr-01/home.nix b/hosts/v-th-ctr-01/home.nix index 76b9a45..5538f19 100644 --- a/hosts/v-th-ctr-01/home.nix +++ b/hosts/v-th-ctr-01/home.nix @@ -37,7 +37,7 @@ containers = { nginx.enable = true; - caddy.enbale = true; + caddy.enable = true; }; }; diff --git a/modules/home/containers/caddy.nix b/modules/home/containers/caddy.nix index 6338e68..669d2a2 100644 --- a/modules/home/containers/caddy.nix +++ b/modules/home/containers/caddy.nix @@ -23,14 +23,14 @@ in { "1443:8443" ]; volumes = [ - "~/containers/caddy/Caddyfile:/etc/caddy/Caddyfile" + "/home/deploy/containers/caddy/Caddyfile:/etc/caddy/Caddyfile:Z" ]; }; home.file."containers/caddy/Caddyfile".text = '' - localhost - - response "Hello, world!" + http://localhost { + respond "Hello there" + } ''; }; }