-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathflake.nix
81 lines (67 loc) · 2.03 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
{
description = "Tools for debloating and installing Google Play Services on Fire Tablets + More!";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = { self, nixpkgs }: let
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pythonDependencies = (python-pkgs: with python-pkgs; [
certifi
charset-normalizer
customtkinter
darkdetect
packaging
requests
tkinter
urllib3
]);
in {
devShells = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
pythonWithDeps = pythonDependencies pkgs.python311Packages;
in {
default = pkgs.mkShellNoCC {
packages = with pkgs; [ android-tools pythonWithDeps ];
};
});
apps = forAllSystems (system: {
default = {
type = "app";
program = "${self.packages.${system}.fire-tools}/bin/fire-tools";
};
});
packages = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
pythonWithDeps = pkgs.python3.withPackages pythonDependencies;
in {
default = self.packages.${system}.fire-tools;
fire-tools = pkgs.stdenv.mkDerivation {
pname = "Fire-Tools";
version = builtins.readFile ./Fire-Tools/version;
src = ./Fire-Tools;
propogatedBuildInputs = with pkgs; [ android-tools pythonWithDeps ];
buildPhase = "";
installPhase = ''
# Copy source files
mkdir -p $out/src
cp -R * $out/src
# Create bin dir
mkdir -p $out/bin
# Create shell script to execute python script
echo '#!/bin/sh' > $out/bin/fire-tools
echo "exec ${pythonWithDeps.interpreter} $out/src/main.py \$@" >> $out/bin/fire-tools
# Make bin and scripts executable
find $out/src -type f -name '*.sh' -exec chmod +x {} \;
chmod +x $out/bin/fire-tools
'';
meta = with pkgs.lib; {
homepage = "https://github.com/mrhaydendp/Fire-Tools";
license = licenses.mit;
platforms = supportedSystems;
maintainers = [ "mrhaydendp" ];
};
};
});
};
}