Skip to content

Commit 87ebffc

Browse files
committed
nix: bump telethon, refactor flake
Signed-off-by: SharzyL <[email protected]>
1 parent 8eadb70 commit 87ebffc

File tree

3 files changed

+47
-15
lines changed

3 files changed

+47
-15
lines changed

flake.nix

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,50 @@
77
};
88

99
outputs = { self, nixpkgs, flake-utils }:
10+
let
11+
overlay = final: prev: {
12+
python3 = prev.python3.override {
13+
packageOverrides = pfinal: pprev: {
14+
telethon = pprev.telethon.overridePythonAttrs (oldAttrs: rec {
15+
version = "1.32.1";
16+
src = final.fetchFromGitHub {
17+
owner = "LonamiWebs";
18+
repo = "Telethon";
19+
rev = "refs/tags/v${version}";
20+
hash = "sha256-0477SxYRVqRnCDPsu+q9zxejCnKVj+qa5DmH0VHuJyI=";
21+
};
22+
doCheck = false;
23+
});
24+
25+
tg-searcher = pfinal.callPackage ./nix/searcher-pkg.nix { };
26+
};
27+
};
28+
tg-searcher = final.python3Packages.tg-searcher;
29+
python3Packages = final.python3.pkgs;
30+
};
31+
in
1032
flake-utils.lib.eachDefaultSystem
1133
(system:
1234
let
13-
pkgs = nixpkgs.legacyPackages.${system};
14-
searcher-pkg = pkgs.callPackage ./nix/searcher-pkg.nix { };
35+
pkgs = import nixpkgs {
36+
inherit system;
37+
overlays = [ overlay ];
38+
};
1539
in
16-
{
40+
rec {
41+
defaultPackage = pkgs.tg-searcher;
42+
legacyPackages = pkgs;
1743
devShell = pkgs.mkShell {
18-
buildInputs = [ searcher-pkg ];
44+
buildInputs = [ defaultPackage ];
1945
};
2046

21-
defaultApp = flake-utils.lib.mkApp { drv = searcher-pkg; };
22-
defaultPackage = searcher-pkg;
47+
defaultApp = flake-utils.lib.mkApp { drv = defaultPackage; };
2348
}
2449
)
2550
// {
26-
overlays.default = final: prev: {
27-
tg-searcher = self.defaultPackage.${prev.system};
28-
};
51+
overlays.default = overlay;
2952
nixosModules.default = {
30-
nixpkgs.overlays = [ self.overlays.default ];
53+
nixpkgs.overlays = [ overlay ];
3154
imports = [ ./nix/searcher-service.nix ];
3255
};
3356
};

nix/searcher-pkg.nix

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1-
{ python3Packages, lib }:
1+
{ buildPythonPackage
2+
, lib
3+
, whoosh
4+
, telethon
5+
, jieba
6+
, python-socks
7+
, pyyaml
8+
, redis
9+
, cryptg
10+
}:
211

3-
python3Packages.buildPythonApplication {
12+
buildPythonPackage {
413
version = lib.removeSuffix "\n" (builtins.readFile ../__version__);
514
pname = "tg-searcher";
615
src = builtins.path { path = ./..; name = "tg-searcher"; };
7-
propagatedBuildInputs = with python3Packages; [
16+
propagatedBuildInputs = [
817
whoosh
918
telethon
1019
jieba
@@ -13,6 +22,6 @@ python3Packages.buildPythonApplication {
1322
redis
1423
cryptg
1524
];
16-
doCheck = false; # since we have no test
25+
doCheck = false; # since we have no test
1726
}
1827

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
license='MIT',
2424
python_requires='>=3.8',
2525
install_requires=[
26-
'telethon~=1.26.0',
26+
'telethon~=1.32.1',
2727
'cryptg',
2828
'whoosh~=2.7.4',
2929
'python-socks[asyncio]',

0 commit comments

Comments
 (0)