{ inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; outputs = { nixpkgs, self, ... }: let forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; in { packages = forAllSystems ( system: let pkgs = import nixpkgs { inherit system; }; inherit (pkgs) callPackage; in { default = callPackage ./site.nix { }; } ); apps = forAllSystems ( system: let pkgs = import nixpkgs { inherit system; }; in { default = { type = "app"; program = let caddyfile = pkgs.writeText "Caddyfile" '' :8080 { root * ${self.packages.${system}.default}/public/ file_server try_files {path} {path}.html {path}/ =404 } ''; formattedCaddyfile = pkgs.runCommand "Caddyfile" { nativeBuildInputs = [ pkgs.caddy ]; } ''(caddy fmt ${caddyfile} || :) > "$out"''; script = pkgs.writeShellApplication { name = "logbook"; runtimeInputs = [ pkgs.caddy ]; text = "caddy run --config ${formattedCaddyfile} --adapter caddyfile"; }; in "${pkgs.lib.getExe script}"; }; } ); }; }