od-cli/flake.nix
2025-07-10 13:41:02 +02:00

89 lines
2.7 KiB
Nix

{
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; };
in
with pkgs;
let
py-typer = python313.pkgs.buildPythonPackage rec {
pname = "typer";
version = "0.16.0";
pyproject = true;
src = fetchFromGitHub {
owner = "fastapi";
repo = "typer";
tag = version;
hash = "sha256-WB9PIxagTHutfk3J+mNTVK8bC7TMDJquu3GLBQgaras=";
};
build-system = [ python313Packages.pdm-backend ];
dependencies = [
python313Packages.click
python313Packages.typing-extensions
# Build includes the standard optional by default
# https://github.com/tiangolo/typer/blob/0.12.3/pyproject.toml#L71-L72
] ++ optional-dependencies.standard;
optional-dependencies = {
standard = [
python313Packages.rich
python313Packages.shellingham
];
};
nativeCheckInputs =
[
python313Packages.coverage # execs coverage in tests
python313Packages.pytest-xdist
python313Packages.pytestCheckHook
writableTmpDirAsHomeHook
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
procps
];
disabledTests =
[
"test_scripts"
# Likely related to https://github.com/sarugaku/shellingham/issues/35
# fails also on Linux
"test_show_completion"
"test_install_completion"
]
++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
"test_install_completion"
];
pythonImportsCheck = [ "typer" ];
meta = {
description = "Library for building CLI applications";
homepage = "https://typer.tiangolo.com/";
changelog = "https://github.com/tiangolo/typer/releases/tag/${version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ winpat ];
};
};
pythonEnv = python313.withPackages (p: [
p.python-gitlab py-typer
]);
in
{
devShells.default = mkShell rec {
packages = [
pythonEnv
];
};
}
);
}