Add an example nixos config using this site
This commit is contained in:
parent
09a424d956
commit
f2f8efdc1d
4 changed files with 173 additions and 0 deletions
20
nixos-configuration/my-static-site.nix
Normal file
20
nixos-configuration/my-static-site.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{ inputs, pkgs, ... }:
|
||||
let
|
||||
site-url = "example.com";
|
||||
in
|
||||
{
|
||||
services.caddy = {
|
||||
enable = true;
|
||||
# Needs `http://` prefix so that it does not try to request TLS certificates and redirect to 443
|
||||
virtualHosts."http://${site-url}".extraConfig = ''
|
||||
file_server
|
||||
root * ${inputs.our-site.packages."${pkgs.system}".default}
|
||||
encode gzip
|
||||
'';
|
||||
};
|
||||
|
||||
environment.shellAliases = {
|
||||
# Test our site
|
||||
curl-site = "curl -H \"Host: ${site-url}\" localhost";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue