chore(dev): add reproducible Nix development environment
- Add flake.nix defining the reproducible development shell. - Add .envrc-example for automatic `direnv`/Nix flake integration - Add development dependencies: Python 3.12, uv, Buf, Make, Transmission, SQLite and Docker Compose - Include a shellHook to report tool versions and sync uv when .venv doesn't exist. - Fix .gitignore so generated worker protobuf files are also ignored.
This commit is contained in:
1 parent
e7247a4904
commit
8c7ad3a5d8
3 files changed
+62
No files matched your search
@@ -0,0 +1 @@
|
||||
use flake
|
||||
@@ -20,3 +20,4 @@ docs/api_spec.md
|
||||
.envrc
|
||||
.direnv/
|
||||
services/bff/src/bff/magnetflix/v1/
|
||||
services/worker/src/worker/magnetflix/v1/
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
description = "MagNetFlix — Movie acquisition pipeline development environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
name = "magnetflix-dev-shell";
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
buf
|
||||
gnumake
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
# Python & package management
|
||||
python312
|
||||
uv
|
||||
|
||||
# Local torrent daemon for dev/testing
|
||||
transmission_4
|
||||
|
||||
# Database tooling
|
||||
sqlite
|
||||
|
||||
# Container tooling
|
||||
docker-compose
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
echo "🎬 Entering MagNetFlix DevShell"
|
||||
echo " • Python: $(python3 --version)"
|
||||
echo " • UV: $(uv --version)"
|
||||
echo " • Buf: $(buf --version)"
|
||||
echo " • Transmission: $(transmission-daemon --version 2>&1 | head -n 1)"
|
||||
|
||||
# Automatically sync uv workspace if .venv is missing
|
||||
if [ ! -d ".venv" ]; then
|
||||
echo "Creating virtual environment and syncing workspace..."
|
||||
uv sync
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user