My Nix Configuration

[templates] uv: init

pyrox.dev 68ff8ae5 e775778f

verified
Changed files
+166
templates
+3
flake.nix
···
];
};
};
+
templates = {
+
uv.description = "Python template flake that uses uv";
+
};
outputs-builder = channels: {
# Define default packages to use everywhere
+17
templates/uv/.envrc
···
+
if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
+
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM="
+
fi
+
+
# uncomment all commented lines once uv venv has been set up
+
+
# if test -n "$FISH_VERSION"; then
+
# source ./.venv/bin/activate.fish
+
# elif test -n "$BASH_VERSION"; then
+
# source ./.venv/bin/activate
+
# elif test -n "$NU_VERSION"; then
+
# source ./.venv/bin/activate.nu
+
# fi
+
+
# export UV_PYTHON=${PWD}/.venv/bin/python3
+
+
use flake
+1
templates/uv/README.md
···
+
# dish's `uv` project template
+59
templates/uv/flake.nix
···
+
{
+
inputs = {
+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+
pre-commit-hooks.url = "github:cachix/git-hooks.nix";
+
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
+
};
+
outputs =
+
{
+
self,
+
nixpkgs,
+
pre-commit-hooks,
+
...
+
}:
+
let
+
eachSystem = nixpkgs.lib.genAttrs [ "x86_64-linux" ];
+
in
+
{
+
devShells = eachSystem (
+
system:
+
let
+
pkgs = import nixpkgs { inherit system; };
+
in
+
{
+
default = pkgs.mkShell {
+
inherit (self.checks.${system}.pre-commit-check) shellHook;
+
buildInputs =
+
with pkgs;
+
[
+
python3
+
just
+
nixfmt-rfc-style
+
ruff
+
uv
+
]
+
++ self.checks.${system}.pre-commit-check.enabledPackages;
+
};
+
}
+
);
+
checks = eachSystem (system: {
+
pre-commit-check = pre-commit-hooks.lib.${system}.run {
+
src = ./.;
+
hooks = {
+
check-added-large-files.enable = true;
+
check-executables-have-shebangs.enable = true;
+
check-shebang-scripts-are-executable.enable = true;
+
check-symlinks.enable = true;
+
end-of-file-fixer.enable = true;
+
nixfmt-rfc-style.enable = true;
+
pyright.enable = true;
+
ruff-format.enable = true;
+
ruff.enable = true;
+
# Uncomment for django projects
+
# ruff-format.excludes = [ "^.*migrations/" ];
+
# pyright.excludes = [ "^.*migrations/" ];
+
};
+
};
+
});
+
};
+
}
+86
templates/uv/pyproject.toml
···
+
[build-system]
+
requires = ["setuptools"]
+
build-backend = "setuptools.build_meta"
+
+
[project]
+
name = "uv-template"
+
version = "0.1.0"
+
description = "project description"
+
readme = "README.md"
+
requires-python = ">=3.12"
+
authors = [{ name = "Pyrox/dish", email = "pyrox@pyrox.dev" }]
+
maintainers = [{ name = "Pyrox/dish", email = "pyrox@pyrox.dev" }]
+
keywords = []
+
classifiers = []
+
dependencies = []
+
+
[project.urls]
+
Homepage = "https://git.pyrox.dev/pyrox/nix"
+
Documentation = "https://git.pyrox.dev/pyrox/nix"
+
Repository = "https://git.pyrox.dev/pyrox/nix"
+
Issues = "https://git.pyrox.dev/pyrox/nix/issues"
+
+
[dependency-groups]
+
dev = []
+
+
# Uncomment for django
+
# [tool.djlint]
+
# ignore = "H006"
+
# indent = 2
+
# profile = "django"
+
# use_gitignore = true
+
+
[tool.pyright]
+
venvPath = "."
+
venv = ".venv"
+
# Uncomment for django
+
# exclude = ["**/migrations/*.py", "manage.py", "scripts/*.py"]
+
+
[tool.ruff]
+
indent-width = 4
+
+
[tool.ruff.format]
+
# Uncomment for django
+
# exclude = ["**/migrations/*.py", "manage.py", "scripts/*.py"]
+
line-ending = "lf"
+
indent-style = "space"
+
+
[tool.ruff.lint]
+
select = [
+
"A",
+
"ANN",
+
"ARG",
+
"COM",
+
"DTZ",
+
"ERA",
+
"E4",
+
"E7",
+
"E9",
+
"F",
+
"FURB",
+
"FLY",
+
"INP",
+
"LOG",
+
"PERF",
+
"PIE",
+
"PTH",
+
"Q",
+
"RET",
+
"RUF",
+
"S",
+
"SIM",
+
"T20",
+
"TCH",
+
"TID",
+
"UP",
+
]
+
ignore = ["ANN003", "COM812"]
+
+
[tool.setuptools]
+
packages = [""]
+
+
[tool.uv]
+
compile-bytecode = true
+
package = false
+
+
[tool.uv.sources]