This commit is contained in:
Xalir
2025-12-28 21:48:38 +01:00
commit 5c869e8c76
7 changed files with 355 additions and 0 deletions

38
flake.nix Normal file
View File

@@ -0,0 +1,38 @@
{
description = "Serve static website using Caddy";
inputs = {
# Use flake-utils for better structure
flake-utils.url = "github:numtide/flake-utils";
# Fetch nixpkgs flake to get the latest Caddy package
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; # Adjust for your desired version
};
outputs =
{
self,
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (
system:
let
pkgs = import nixpkgs { inherit system; };
in
{
# This section defines a package to run Caddy and serve your website
packages.default = pkgs.stdenv.mkDerivation rec {
name = "static-website";
src = ./src;
buildPhase = ''
mkdir -p $out/var/www
cp -r ${src}/* $out/var/www/
'';
};
}
);
}