b26bef02968e4efaaea225ef8cb43ff56388f728
Once a file was picked the preview <img> overlaid the file input and blocked further clicks, so the drop zone became read-only. Making the preview and the new 'Click to change' hint pointer-events:none lets clicks pass through to the input again. Also parses the JPEG APP1 EXIF segment inline (no dependency) to read DateTimeOriginal and prefill the date field. Falls back to the file's lastModified for PNGs or JPEGs without EXIF. The date field stays editable in either case.
photogallery
A minimal static photo gallery with an Atom feed and an upload API.
How it works
- Drop
photo.jpg+photo.tomlinto the content directory (or upload via the web UI at/upload). - The binary watches the directory and rebuilds the static site on any change.
- nginx serves
public/and proxies/uploadto the local API, secured with htpasswd.
Sidecar format
caption = "Tempelhof at sunrise"
date = "2026-06-14"
If no .toml is present the filename is used as the caption and today's date as the date.
Using as a NixOS flake module
1. Add to your flake inputs
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
photogallery.url = "github:youruser/photogallery";
};
2. Import the module
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
modules = [
inputs.photogallery.nixosModules.default
./configuration.nix
];
};
3. Configure
services.photogallery = {
enable = true;
baseURL = "https://photos.yourdomain.tld";
# Optional: built-in nginx vhost
nginx = {
enable = true;
domain = "photos.yourdomain.tld";
htpasswdFile = "/etc/nginx/.htpasswd-gallery";
};
};
Create the htpasswd file:
nix-shell -p apacheHttpd --run \
"htpasswd -c /etc/nginx/.htpasswd-gallery youruser"
Available options
| Option | Default | Description |
|---|---|---|
enable |
false |
Enable the service |
baseURL |
— | Public URL, no trailing slash |
contentDir |
/var/lib/photogallery/content |
Images and .toml sidecars |
outputDir |
/var/lib/photogallery/public |
Generated site output |
port |
8080 |
Upload API port (localhost only) |
nginx.enable |
false |
Configure an nginx vhost |
nginx.domain |
— | Domain for the vhost |
nginx.htpasswdFile |
— | htpasswd file for /upload |
nginx.enableACME |
true |
Enable Let's Encrypt |
Bootstrap (first build)
buildGoModule needs a go.sum and the correct vendorHash.
# 1. Generate go.sum
go mod tidy
# 2. Commit go.sum
git add go.sum && git commit -m "add go.sum"
# 3. Get the vendorHash — this will fail and print the correct hash
nix build
# error: hash mismatch ... got: sha256-XXXXX...
# 4. Paste the hash into flake.nix, then build again
nix build
Uploading via curl
curl -u user:password \
-F "image=@photo.jpg" \
-F "caption=Tempelhof at sunrise" \
-F "date=2026-06-14" \
https://photos.yourdomain.tld/upload
Or open https://photos.yourdomain.tld/upload in a browser.
Languages
Go
40.1%
HTML
30.8%
Nix
15.5%
CSS
13.6%