-
-
Notifications
You must be signed in to change notification settings - Fork 111
/
flake.nix
74 lines (68 loc) · 2.15 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
{
description = "Flake for https://github.com/n8henrie/pycookiecheat";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
outputs =
{ self, nixpkgs }:
let
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
eachSystem =
with nixpkgs.lib;
f: foldAttrs mergeAttrs { } (map (s: mapAttrs (_: v: { ${s} = v; }) (f s)) systems);
in
eachSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
pname = "pycookiecheat";
propagatedBuildInputs = with pkgs.python312Packages; [
cryptography
keyring
];
pycookiecheat =
{ lib, python312 }:
python312.pkgs.buildPythonPackage {
inherit pname;
version = builtins.elemAt (lib.splitString "\"" (
lib.findSingle (val: builtins.match "^__version__ = \".*\"$" val != null) (abort "none")
(abort "multiple")
(lib.splitString "\n" (builtins.readFile ./src/pycookiecheat/__init__.py))
)) 1;
src = lib.cleanSource ./.;
pyproject = true;
nativeBuildInputs = with pkgs.python312Packages; [ setuptools-scm ];
inherit propagatedBuildInputs;
};
in
{
packages = {
${pname} = pkgs.callPackage pycookiecheat { };
default = pkgs.python312.withPackages (_: [ self.packages.${system}.${pname} ]);
};
devShells.default = pkgs.mkShell {
venvDir = ".venv";
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
pip install -e .[dev,test]
python -m playwright install chromium firefox
'';
buildInputs = with pkgs; [
python39
python310
python311
python313
python312Packages.venvShellHook
(python312.withPackages (ps: [ ps.tox ]))
];
};
apps.default = {
type = "app";
program = "${self.outputs.packages.${system}.pycookiecheat}/bin/pycookiecheat";
};
}
);
}