-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jorik
committed
Nov 1, 2024
1 parent
d3783c8
commit 04a1654
Showing
2 changed files
with
173 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
diff --git a/pyproject.toml b/pyproject.toml | ||
index cc30424..a5c6f26 100644 | ||
--- a/pyproject.toml | ||
+++ b/pyproject.toml | ||
@@ -19,7 +19,8 @@ dependencies = [ | ||
# pinned intentionally | ||
"textual-autocomplete==3.0.0a12", | ||
# pinned intentionally | ||
- "watchfiles>=0.24.0", | ||
+ | ||
+ "watchfiles>=0.22.0", | ||
] | ||
readme = "README.md" | ||
requires-python = ">= 3.11" | ||
-- | ||
2.46.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
{ | ||
lib, | ||
fetchFromGitHub, | ||
fetchPypi, | ||
rustPlatform, | ||
python3, | ||
}: | ||
let | ||
py-pkgs = python3.pkgs; | ||
|
||
# Current nixpkgs version is too outdated | ||
pydantic-settings = ( | ||
py-pkgs.pydantic-settings.overrideAttrs (oldAttrs: rec { | ||
version = "2.6.0"; | ||
src = fetchFromGitHub { | ||
owner = "pydantic"; | ||
repo = "pydantic-settings"; | ||
rev = "refs/tags/v${version}"; | ||
hash = "sha256-gJThzYJg6OIkfmfi/4MVINsrvmg+Z+0xMhdlCj7Fn+w="; | ||
}; | ||
propagatedBuildInputs = [ | ||
pydantic | ||
py-pkgs.python-dotenv | ||
]; | ||
}) | ||
); | ||
|
||
# Current nixpkgs version is too outdated | ||
httpx = ( | ||
py-pkgs.httpx.overrideAttrs (oldAttrs: rec { | ||
version = "0.27.2"; | ||
src = fetchFromGitHub { | ||
owner = "encode"; | ||
repo = oldAttrs.pname; | ||
rev = "refs/tags/${version}"; | ||
hash = "sha256-N0ztVA/KMui9kKIovmOfNTwwrdvSimmNkSvvC+3gpck="; | ||
}; | ||
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ py-pkgs.zstandard ]; | ||
}) | ||
); | ||
|
||
# Current nixpkgs version is too outdated | ||
textual = ( | ||
py-pkgs.textual.overrideAttrs (oldAttrs: rec { | ||
version = "0.85.0"; | ||
src = fetchFromGitHub { | ||
owner = "Textualize"; | ||
repo = "textual"; | ||
rev = "refs/tags/v${version}"; | ||
hash = "sha256-ROq/Pjq6XRgi9iqMlCzpLmgzJzLl21MI7148cOxHS3o="; | ||
}; | ||
}) | ||
); | ||
|
||
# Current nixpkgs version is too outdated | ||
pydantic = ( | ||
py-pkgs.pydantic.overrideAttrs (oldAttrs: rec { | ||
version = "2.9.2"; | ||
src = fetchFromGitHub { | ||
owner = "pydantic"; | ||
repo = "pydantic"; | ||
rev = "refs/tags/v${version}"; | ||
hash = "sha256-Eb/9k9bNizRyGhjbW/LAE/2R0Ino4DIRDy5ZrQuzJ7o="; | ||
}; | ||
propagatedBuildInputs = [ | ||
pydantic-core | ||
py-pkgs.annotated-types | ||
py-pkgs.jsonschema | ||
]; | ||
}) | ||
); | ||
|
||
# Exact version of core is required by pydantic | ||
pydantic-core = ( | ||
py-pkgs.pydantic-core.overrideAttrs (oldAttrs: rec { | ||
version = "2.23.4"; | ||
src = fetchFromGitHub { | ||
owner = "pydantic"; | ||
repo = "pydantic-core"; | ||
rev = "refs/tags/v${version}"; | ||
hash = "sha256-WSSwiqmdQN4zB7fqaniHyh4SHmrGeDHdCGpiSJZT7Mg="; | ||
}; | ||
|
||
cargoDeps = rustPlatform.fetchCargoTarball { | ||
inherit src; | ||
name = "${oldAttrs.pname}-${version}"; | ||
hash = "sha256-dX3wDnKQLmC+FabC0van3czkQLRcrBbtp9b90PgepZs="; | ||
}; | ||
|
||
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ py-pkgs.typing-extensions ]; | ||
}) | ||
); | ||
|
||
# Not available in nixpkgs | ||
textual-autocomplete = py-pkgs.buildPythonPackage rec { | ||
pname = "textual_autocomplete"; | ||
version = "3.0.0a12"; | ||
pyproject = true; | ||
# Alpha version of this package are only available on Pypi. | ||
src = fetchPypi { | ||
inherit pname version; | ||
sha256 = "sha256-HSyeTSTH9XWryMYSy2q//0cG9qqrm5OVBrldroRUkwk="; | ||
}; | ||
|
||
nativeBuildInputs = [ py-pkgs.poetry-core ]; | ||
|
||
dependencies = [ | ||
textual | ||
py-pkgs.typing-extensions | ||
]; | ||
}; | ||
in | ||
python3.pkgs.buildPythonApplication rec { | ||
pname = "posting"; | ||
version = "2.0.1"; | ||
pyproject = true; | ||
|
||
src = fetchFromGitHub { | ||
owner = "darrenburns"; | ||
repo = "posting"; | ||
rev = "refs/tags/${version}"; | ||
sha256 = "sha256-6KtC5VuG3x07VTenpyDAJr9KO4jdTCFk1u/pSoyYPsc="; | ||
}; | ||
|
||
# We patch the pyproject.toml to allow a slightly outdated watchfiles dependency. | ||
# The correct version is not in nixpkgs yet and overriding the version is not trivial. | ||
# (i tried) | ||
patches = [ ./allow-watchfiles-v22.patch ]; | ||
|
||
nativeBuildInputs = [ python3.pkgs.hatchling ]; | ||
|
||
propagatedBuildInputs = [ | ||
py-pkgs.click | ||
py-pkgs.xdg-base-dirs | ||
py-pkgs.click-default-group | ||
py-pkgs.pyperclip | ||
py-pkgs.pyyaml | ||
py-pkgs.python-dotenv | ||
py-pkgs.watchfiles | ||
|
||
pydantic | ||
pydantic-settings | ||
textual | ||
textual-autocomplete | ||
httpx | ||
]; | ||
|
||
meta = { | ||
description = "The modern API client that lives in your terminal."; | ||
mainProgram = "posting"; | ||
homepage = "https://posting.sh/"; | ||
license = lib.licenses.asl20; | ||
maintainers = with lib.maintainers; [ jorikvanveen ]; | ||
platforms = lib.platforms.unix; | ||
}; | ||
} |