summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-09-23 03:50:53 +0700
committerpolwex <polwex@sortug.com>2025-09-23 03:50:53 +0700
commit57aaafdb137fe49930711f6ed5ccc83b3a119cd2 (patch)
tree1a7556927bed94377630d33dd29c3bf07d159619 /flake.nix
init
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix96
1 files changed, 96 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..61b64d3
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,96 @@
+{
+ description = "Torch cuda flake using nix-community cachix";
+
+ nixConfig = {
+ extra-substituters = [
+ "https://nix-community.cachix.org"
+ "https://nix-ai-stuff.cachix.org"
+ "https://ai.cachix.org"
+ "https://cuda-maintainers.cachix.org"
+ ];
+ extra-trusted-public-keys = [
+ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
+ "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
+ "ai.cachix.org-1:N9dzRK+alWwoKXQlnn0H6aUx0lU/mspIoz8hMvGvbbc="
+ "nix-ai-stuff.cachix.org-1:WlUGeVCs26w9xF0/rjyg32PujDqbVMlSHufpj1fqix8="
+ ];
+ };
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
+ nix-ai-stuff = {
+ url = "github:BatteredBunny/nix-ai-stuff";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ };
+
+ outputs = {
+ self,
+ nixpkgs,
+ nix-ai-stuff,
+ ...
+ }: let
+ pkgs = import nixpkgs {
+ system = "x86_64-linux";
+ config.allowUnfree = true;
+ config.cudaSupport = true;
+ };
+ in {
+ devShell.x86_64-linux = with pkgs;
+ mkShell rec {
+ venvDir = "./.venv";
+ pythonPkgs = pkgs.python3.withPackages (
+ ps:
+ with ps; [
+ mypy
+ ruff
+ torch
+ accelerate
+ transformers
+ typing-extensions
+ psutil
+ ninja
+ einops
+ packaging
+ sentence-transformers
+ nix-ai-stuff.packages.${pkgs.system}.flash-attn
+ # docling
+ uv
+ ]
+ );
+
+ py = with pkgs.python3Packages; [
+ mypy
+ ruff
+ torch
+ accelerate
+ transformers
+ typing-extensions
+ psutil
+ ninja
+ einops
+ packaging
+ sentence-transformers
+ nix-ai-stuff.packages.${pkgs.system}.flash-attn
+ # docling
+ uv
+ ];
+ buildInputs = [
+ pyright
+ pythonPkgs
+ pkgs.sqlite
+ pkgs.sqlite-vec
+ pkgs.virtualenv
+ pkgs.python3Packages.venvShellHook
+ ];
+
+ # LOLPATH = lib.makeSearchPath "" buildInputs;
+ LOLPATH = lib.makeSearchPath "" py;
+ postVenvCreation = ''
+ unset SOURCE_DATE_EPOCH
+ '';
+ shellHook = ''
+ fish
+ '';
+ };
+ };
+}