Add python template.
This commit is contained in:
parent
cae1182840
commit
fa180a7636
11 changed files with 621 additions and 0 deletions
53
templates/python/flake.nix
Normal file
53
templates/python/flake.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
flake-utils = {
|
||||
url = "github:numtide/flake-utils";
|
||||
};
|
||||
};
|
||||
outputs = {
|
||||
self,
|
||||
flake-utils,
|
||||
nixpkgs,
|
||||
...
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
inherit (pkgs) lib;
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config = {
|
||||
cudaSupport = true;
|
||||
allowUnfree = true;
|
||||
};
|
||||
};
|
||||
defaultPython = pkgs.python3;
|
||||
in {
|
||||
formatter = pkgs.alejandra;
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages =
|
||||
(with pkgs; [
|
||||
ruff
|
||||
pyright
|
||||
|
||||
uv
|
||||
defaultPython
|
||||
])
|
||||
++ (with pkgs.python3Packages; [
|
||||
pydantic
|
||||
torchWithCuda
|
||||
]);
|
||||
shellHook = ''
|
||||
uv sync
|
||||
. ./.venv/bin/activate
|
||||
'';
|
||||
env = {
|
||||
UV_PYTHON_DOWNLOADS = "never";
|
||||
UV_PYTHON = "${lib.getExe' defaultPython "python"}";
|
||||
UV_TORCH_BACKEND = "auto";
|
||||
};
|
||||
};
|
||||
});
|
||||
nixConfig = {
|
||||
keepOutputs = true;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue