This commit is contained in:
Jakub Dorfman 2026-04-20 01:41:49 +02:00
parent f52e433423
commit c7c261332e
3 changed files with 71 additions and 71 deletions

22
caddy.nix Normal file → Executable file
View file

@ -1,12 +1,12 @@
{ ... }: { ... }:
{ {
services.caddy = { services.caddy = {
enable = true; enable = true;
email = "admin@srazka.com"; # Replace with your actual email email = "admin@srazka.com"; # Replace with your actual email
# The new hello container # The new hello container
virtualHosts."hello.srazka.com".extraConfig = '' virtualHosts."hello.srazka.com".extraConfig = ''
reverse_proxy 192.168.100.11:80 reverse_proxy 192.168.100.11:80
''; '';
}; };
} }

54
containers/hello.nix Normal file → Executable file
View file

@ -1,27 +1,27 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
containers.hello = { containers.hello = {
autoStart = true; autoStart = true;
privateNetwork = true; privateNetwork = true;
hostAddress = "192.168.100.10"; hostAddress = "192.168.100.10";
localAddress = "192.168.100.11"; localAddress = "192.168.100.11";
config = { config, pkgs, ... }: { config = { config, pkgs, ... }: {
system.stateVersion = "25.11"; system.stateVersion = "25.11";
networking.firewall.allowedTCPPorts = [ 80 ]; networking.firewall.allowedTCPPorts = [ 80 ];
services.nginx = { services.nginx = {
enable = true; enable = true;
virtualHosts."localhost" = { virtualHosts."localhost" = {
# Return a 200 OK directly from nginx # Return a 200 OK directly from nginx
locations."/".return = "200 'Hello world!'"; locations."/".return = "200 'Hello world!'";
locations."/".extraConfig = '' locations."/".extraConfig = ''
default_type text/plain; default_type text/plain;
''; '';
}; };
}; };
}; };
}; };
} }

View file

@ -1,33 +1,33 @@
{ {
description = "vpsAdminOS container"; description = "vpsAdminOS container";
inputs = { inputs = {
vpsadminos.url = "github:vpsfreecz/vpsadminos"; vpsadminos.url = "github:vpsfreecz/vpsadminos";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
}; };
outputs = outputs =
inputs@{ inputs@{
nixpkgs, nixpkgs,
vpsadminos, vpsadminos,
... ...
}: }:
let let
system = "x86_64-linux"; system = "x86_64-linux";
in in
{ {
nixosConfigurations.vps = nixpkgs.lib.nixosSystem { nixosConfigurations.vps = nixpkgs.lib.nixosSystem {
inherit system; inherit system;
modules = [ modules = [
vpsadminos.nixosModules.container_25_11 vpsadminos.nixosModules.container_25_11
./configuration.nix ./configuration.nix
./caddy.nix ./caddy.nix
./containers/hello.nix ./containers/hello.nix
]; ];
specialArgs = { specialArgs = {
inherit inputs; inherit inputs;
}; };
}; };
}; };
} }