maunium-stickerpicker-nix/flake.nix
teutat3s f19ee88860
refactor: only download stickers with nix,
manually invoke sticker-pack from the devshell to upload stickers to
matrix, to avoid leaking the access token from config.json to the nix
store.

Nixify SigStickers https://github.com/FHPythonUtils/SigStickers and
dependency https://github.com/signalstickers/signalstickers-client to
download Signal stickers
2024-04-29 00:12:49 +02:00

91 lines
2.3 KiB
Nix

{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
maunium-stickerpicker = {
url = "github:maunium/stickerpicker";
flake = false;
};
};
outputs = { self, nixpkgs, maunium-stickerpicker }: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
fetchers = pkgs.callPackage ./fetchers.nix { };
downloadStickers = pkgs.callPackage ./downloadStickers.nix {
inherit maunium-stickerpicker fetchers;
inherit (self.packages.${system}) stickerpicker-tools;
};
in {
inherit downloadStickers;
devShells.${system}.default = pkgs.mkShell {
name = "python-venv";
venvDir = "./.venv";
buildInputs = [
pkgs.python3Packages.python
pkgs.python3Packages.venvShellHook
self.packages.${system}.stickerpicker-tools
self.packages.${system}.sigstickers
];
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
pip install -r requirements.txt
'';
postShellHook = ''
# allow pip to install wheels
unset SOURCE_DATE_EPOCH
'';
};
packages.${system} =
let
signalstickers-client = (pkgs.python3Packages.callPackage ./python/signalstickers-client.nix {});
in
{
default = self.packages.${system}.stickerpicker-tools;
sigstickers = (pkgs.python3Packages.callPackage ./python/sigstickers.nix { inherit signalstickers-client; });
pub-solar-stickers = downloadStickers {
homeserver = "https://matrix.pub.solar";
userId = "@hakkonaut:pub.solar";
sha256 = "sha256-e5KNPhtrETzgcJxbVZtlWwBXK3RlNKXCZPPZ5Zk46ok=";
packs = [
{
type = "chatsticker";
name = "donald-and-friends";
}
{
type = "chatsticker";
name = "heartwarming-cat-world";
}
{
type = "chatsticker";
name = "kawaii-potato-1";
}
];
};
stickerpicker-tools = pkgs.python3Packages.buildPythonPackage {
name = "stickerpicker-tools";
src = maunium-stickerpicker;
propagatedBuildInputs = with pkgs.python3Packages; [
aiohttp
yarl
pillow
telethon
cryptg
python-magic
pkgs.cacert
];
doCheck = false;
};
};
};
}