This commit is contained in:
Charlotte 🦝 Delenk 2022-11-02 16:02:53 +01:00
parent 273bdf17b9
commit 373940b16e
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
5 changed files with 138 additions and 0 deletions

View file

@ -52,4 +52,6 @@
miifox-net = pkgs.python3Packages.callPackage ./web/miifox-net.nix {};
old-homepage = pkgs.callPackage ./web/old-homepage.nix {};
clean-s3-cache = pkgs.python3Packages.callPackage ./scripts/clean-s3-cache.nix {};
python-instagram = pkgs.python3Packages.callPackage ./python/instagram.nix {};
moa = pkgs.python3Packages.callPackage ./moa {};
}

79
moa/default.nix Normal file
View file

@ -0,0 +1,79 @@
{
fetchFromGitLab,
python3,
certifi,
flask,
flask_sqlalchemy,
flask_mail,
flask_migrate,
flask_wtf,
mastodon-py,
pandas,
psutil,
pygal,
python-twitter,
pymysql,
sentry-sdk,
authlib,
cairosvg,
werkzeug,
wheel,
callPackage,
stdenvNoCC,
lib,
}: let
source = builtins.fromJSON (builtins.readFile ./source.json);
src = fetchFromGitLab {
owner = "hexchen";
repo = "moa";
inherit (source) rev sha256;
};
moa-env = python3.withPackages (_: [
certifi
flask
flask_sqlalchemy
flask_mail
flask_migrate
flask_wtf
mastodon-py
pandas
psutil
pygal
python-twitter
pymysql
sentry-sdk
authlib
cairosvg
werkzeug
wheel
(callPackage ../python/instagram.nix {})
]);
in
stdenvNoCC.mkDerivation {
pname = "moa";
version = source.date;
inherit src;
buildPhase = ''
echo "#!/bin/sh" > start.sh
echo "cd $out" >> start.sh
echo "${moa-env}/bin/python -m moa.models" >> start.sh
echo "exec ${moa-env}/bin/python -m moa.worker" >> start.sh
chmod +x start.sh
'';
installPhase = ''
cp -rv $src $out
chmod +w $out
cp start.sh $out
'';
meta = {
description = "Mastodon-Twitter crossposter";
license = lib.licenses.mit;
};
passthru.updateScript = [
../scripts/update-git.sh
"https://gitlab.com/hexchen/moa"
"moa/source.json"
"--rev refs/heads/fix/pleroma"
];
}

11
moa/source.json Normal file
View file

@ -0,0 +1,11 @@
{
"url": "https://gitlab.com/hexchen/moa",
"rev": "51d1ea9a39845133b1dd3db130d276ea2592c80b",
"date": "2022-09-27T11:21:56+00:00",
"path": "/nix/store/slv4k84fw83fp8yxdkvhw7ffpx4dd4xg-moa",
"sha256": "1sjilfg06n543qpjd0cg52hnnqgmx1mixrzrgm0myf0kk84y2qbf",
"fetchLFS": false,
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
}

11
python/instagram.json Normal file
View file

@ -0,0 +1,11 @@
{
"url": "https://github.com/foozmeat/python-instagram",
"rev": "2d362a1557f1010da8d755f4dec30e96f7505d3b",
"date": "2019-11-13T09:46:29-08:00",
"path": "/nix/store/6kvrivy42gkxznbm3j9ari0qlbzx1siv-python-instagram",
"sha256": "1azjndl45khgx79bwbkk45clzb2fcb7dbl4j77wv1pgs4xxc3gry",
"fetchLFS": false,
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
}

35
python/instagram.nix Normal file
View file

@ -0,0 +1,35 @@
{
buildPythonPackage,
fetchFromGitHub,
httplib2,
simplejson,
six,
pytz,
lib,
}: let
source = builtins.fromJSON (builtins.readFile ./instagram.json);
in
buildPythonPackage {
name = "instagram";
version = source.date;
src = fetchFromGitHub {
owner = "foozmeat";
repo = "python-instagram";
inherit (source) rev sha256;
};
propagatedBuildInputs = [
httplib2
simplejson
six
pytz
];
meta = {
description = "Python Client for Instagram API";
license = lib.licenses.bsd3;
};
passthru.updateScript = [
../scripts/update-git.sh
"https://github.com/foozmeat/python-instagram"
"python/instagram.json"
];
}