Display commit date and short hash (e.g., "2026-01-08 fb59ef7") below the ANIMALTRACK title in the sidebar. In development, reads from git directly; in Docker, reads from BUILD_DATE/BUILD_COMMIT env vars injected at build time from the Nix flake. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
98 lines
2.7 KiB
Nix
98 lines
2.7 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
};
|
|
|
|
outputs = { self, nixpkgs }:
|
|
let
|
|
system = "x86_64-linux";
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
# Python with custom packages
|
|
python = pkgs.python313.override {
|
|
self = python;
|
|
packageOverrides = pyfinal: pyprev: {
|
|
# Leaf packages (no custom dependencies)
|
|
mistletoe = pyfinal.callPackage ./packages/mistletoe.nix { };
|
|
sse-starlette = pyfinal.callPackage ./packages/sse-starlette.nix { };
|
|
fastcore = pyfinal.callPackage ./packages/fastcore.nix { };
|
|
|
|
# Second level (depend on leaf packages)
|
|
apswutils = pyfinal.callPackage ./packages/apswutils.nix { };
|
|
fastlite = pyfinal.callPackage ./packages/fastlite.nix { };
|
|
fastmigrate = pyfinal.callPackage ./packages/fastmigrate.nix { };
|
|
|
|
# Top level (depend on second level)
|
|
python-fasthtml = pyfinal.callPackage ./packages/python-fasthtml.nix { };
|
|
monsterui = pyfinal.callPackage ./packages/monsterui.nix { };
|
|
};
|
|
};
|
|
|
|
# Shared Python environment for both dev and Docker
|
|
pythonEnv = python.withPackages (ps: with ps; [
|
|
# From nixpkgs
|
|
uvicorn
|
|
starlette
|
|
httpx
|
|
pydantic
|
|
pydantic-settings
|
|
anyio
|
|
beautifulsoup4
|
|
python-dateutil
|
|
oauthlib
|
|
itsdangerous
|
|
python-multipart
|
|
lxml
|
|
apsw
|
|
packaging
|
|
python-ulid
|
|
xxhash
|
|
|
|
# Custom packages
|
|
fastcore
|
|
apswutils
|
|
fastlite
|
|
fastmigrate
|
|
sse-starlette
|
|
python-fasthtml
|
|
monsterui
|
|
mistletoe
|
|
|
|
# Dev-only (not needed in Docker, but fine to include)
|
|
pytest
|
|
pytest-xdist
|
|
ruff
|
|
filelock
|
|
]);
|
|
in
|
|
{
|
|
packages.${system} = {
|
|
dockerImage = let
|
|
buildDate = let
|
|
d = self.lastModifiedDate or "00000000000000";
|
|
in "${builtins.substring 0 4 d}-${builtins.substring 4 2 d}-${builtins.substring 6 2 d}";
|
|
buildCommit = self.shortRev or self.dirtyShortRev or "unknown";
|
|
in import ./docker.nix { inherit pkgs pythonEnv python buildDate buildCommit; };
|
|
};
|
|
|
|
devShells.${system}.default = pkgs.mkShell {
|
|
buildInputs = [
|
|
pythonEnv
|
|
|
|
# Tools
|
|
pkgs.jq
|
|
pkgs.sqlite
|
|
pkgs.skopeo # For pushing Docker images
|
|
pkgs.lefthook # Git hooks manager
|
|
];
|
|
|
|
shellHook = ''
|
|
export PYTHONPATH="$PWD/src:$PYTHONPATH"
|
|
export PATH="$PWD/bin:$PATH"
|
|
echo "AnimalTrack development environment ready!"
|
|
echo "Run 'animaltrack serve' to start the app"
|
|
'';
|
|
};
|
|
};
|
|
}
|