-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
90 lines (80 loc) · 2.54 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
{
description = "NixOS flake for poetry project";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
poetry2nix.url = "github:nix-community/poetry2nix";
poetry2nix.inputs.nixpkgs.follows = "nixpkgs";
utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
poetry2nix,
utils,
}:
utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ poetry2nix.overlays.default ];
};
p2n = import poetry2nix { inherit pkgs; };
overrides = p2n.defaultPoetryOverrides.extend (
self: super: {
types-tgcrypto = super.types-tgcrypto.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ super.setuptools ];
});
pyqt5-qt5 = super.pyqt5-qt5.overridePythonAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ pkgs.libsForQt5.qt5.qtlottie ];
preFixup = ''
patchelf --replace-needed libtiff.so.5 libtiff.so $out/${self.python.sitePackages}/PyQt5/Qt5/plugins/imageformats/libqtiff.so
'';
});
pyqt5 = super.pyqt5.override { preferWheel = true; };
ruff = super.ruff.override { preferWheel = true; };
}
);
python = pkgs.python312;
pythonEnv = p2n.mkPoetryEnv {
projectDir = self;
editablePackageSources = {
tcd = "tcd";
};
python = python;
overrides = overrides;
};
pythonApp = p2n.mkPoetryApplication {
projectDir = self;
python = python;
overrides = overrides;
meta = with pkgs.lib; {
description = "tool for decrypted telegram desktop media cache";
homepage = "https://github.com/ViZiD/tcd";
license = licenses.mit;
maintainers = with maintainers; [ vizid ];
};
};
in
rec {
packages.default = pythonApp;
defaultPackage = packages.default;
apps.default = {
type = "app";
program = "${self.defaultPackage."${system}"}/bin/tcd";
};
defaultApp = apps.default;
devShells.default = pkgs.mkShell {
buildInputs = [
pythonEnv
pkgs.poetry
];
shellHook = ''
git_root=$(${pkgs.git}/bin/git rev-parse --show-toplevel)
export PYTHONPATH=$git_root:$PYTHONPATH
'';
};
}
);
}