-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
110 lines (98 loc) · 3.24 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
{
description = "Papis-ask";
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 = nixpkgs.legacyPackages.${system};
python = pkgs.python3.override {
packageOverrides = self: super: {
paper-qa = import ./nix/pkgs/paper-qa {inherit pkgs python3Packages;};
fhlmi = import ./nix/pkgs/fhlmi {inherit pkgs python3Packages;};
fhaviary = import ./nix/pkgs/fhaviary {inherit pkgs python3Packages;};
tantivy = import ./nix/pkgs/tantivy {inherit pkgs python3Packages;};
# we need this specific older version of pydantic
pydantic = super.pydantic.overrideAttrs (oldAttrs: rec {
version = "2.10.1";
src = pkgs.fetchFromGitHub {
owner = "pydantic";
repo = "pydantic";
rev = "refs/tags/v${version}";
hash = "sha256-6eqGhTZedJbRZqAcixcxaWgQuRklFLwdy+lmUFRj2Ws=";
};
});
pydantic-core = super.pydantic-core.overrideAttrs (oldAttrs: rec {
pname = "pydantic-core";
version = "2.27.1";
src = pkgs.fetchFromGitHub {
owner = "pydantic";
repo = "pydantic-core";
rev = "refs/tags/v${version}";
hash = "sha256-ikdQAT1y0g+V2gPU0Ohn+UktJrEObnixCW56/J1UsSk=";
};
cargoDeps = pkgs.rustPlatform.fetchCargoVendor {
inherit src;
name = "${pname}-${version}";
hash = "sha256-4mwhe+e2xgFMYZAv+Nblj3AAnDinLvuGGYs8KAHT2Sw=";
};
});
};
};
python3Packages = python.pkgs;
in {
packages = {
papis-ask = python3Packages.buildPythonPackage {
pname = "papis-ask";
version =
if (self ? rev)
then self.shortRev
else self.dirtyShortRev;
format = "pyproject";
src = ./.;
build-system = with python3Packages; [hatchling];
buildInputs = with python3Packages; [
papis
];
dependencies = with python3Packages; [
paper-qa
click-default-group
rich
];
pythonImportsCheck = ["papis_ask"];
# nativeCheckInputs = with python3Packages; [
# pytestCheckHook
# pytest-asyncio
# pytest-mock # TODO: needed?
# ];
meta = {
description = "Use AI to search your Papis library";
homepage = "https://papis.readthedocs.io/";
license = with pkgs.lib.licenses; gpl3Plus;
maintainers = [
{
name = "Julian Hauser";
email = "julian@julianhauser.com";
}
];
};
};
default = self.packages.${system}.papis-ask;
};
devShells.default = pkgs.mkShell {
buildInputs = [
python
pkgs.papis
self.packages.${system}.papis-ask
];
shellHook = ''
export PYTHONPATH="$(pwd):$PYTHONPATH"
'';
};
});
}