Add a Nix dev shell with Python and uv
Assisted-by: Claude Opus 5.5 via Claude Code
change znqnkwxtzltoztzuypkykoxsrsvpyrol
commit 133a99591e3a8aea41c8cec8823e1ba25802a4d8
author Alpha Chen <alpha@kejadlen.dev>
date
parent ysountsk
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2ddd6a8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+.direnv/
+.venv/
diff --git a/firmament/pyproject.toml b/firmament/pyproject.toml
new file mode 100644
index 0000000..2595d5e
--- /dev/null
+++ b/firmament/pyproject.toml
@@ -0,0 +1,6 @@
+[project]
+name = "firmament"
+version = "0.1.0"
+description = "Find each LED's position in 3D from phone captures"
+requires-python = ">=3.13"
+dependencies = []
diff --git a/firmament/uv.lock b/firmament/uv.lock
new file mode 100644
index 0000000..7573ced
--- /dev/null
+++ b/firmament/uv.lock
@@ -0,0 +1,8 @@
+version = 1
+revision = 5
+requires-python = ">=3.13"
+
+[[package]]
+name = "firmament"
+version = "0.1.0"
+source = { virtual = "." }
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..c1657f1
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,27 @@
+{
+  "nodes": {
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1795249095,
+        "narHash": "sha256-8JDgyVvWUZg5m9hNlL8Ge9aT647ng3Ukc8NPMiKNTPQ=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "93a9ed0a866099a230ed5146a5bb7d16fd5c9b14",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixpkgs-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "nixpkgs": "nixpkgs"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..e713f53
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,47 @@
+{
+  description = "glowdown: notes and tools from LED fiddling";
+
+  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+
+  outputs =
+    { nixpkgs, ... }:
+    let
+      systems = [
+        "aarch64-darwin"
+        "x86_64-darwin"
+        "aarch64-linux"
+        "x86_64-linux"
+      ];
+      forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
+    in
+    {
+      devShells = forAllSystems (
+        pkgs:
+        let
+          python = pkgs.python313;
+        in
+        {
+          default = pkgs.mkShell {
+            packages = [
+              python
+              pkgs.uv
+            ];
+
+            env = {
+              UV_PYTHON = python.interpreter;
+              UV_PYTHON_DOWNLOADS = "never";
+            }
+            // pkgs.lib.optionalAttrs pkgs.stdenv.isLinux {
+              # Nix's Python doesn't search system library paths, which PyPI's manylinux wheels rely on.
+              LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
+                pkgs.stdenv.cc.cc.lib
+                pkgs.zlib
+              ];
+            };
+          };
+        }
+      );
+
+      formatter = forAllSystems (pkgs: pkgs.nixfmt);
+    };
+}