39 lines
895 B
Nix
39 lines
895 B
Nix
{
|
|
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/
|
|
'';
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
}
|