diff --git a/nix/sources.json b/nix/sources.json index 70bb2814..56d48cae 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -11,12 +11,6 @@ "url": "https://github.com/srid/emanote/archive/584d52c4c7071e643ce738db9db0196f17071518.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, - "mastodon_digest": { - "branch": "main", - "repo": "git@hera.m-0.eu:mastodon_digest", - "rev": "abea31381316d762d3c8eecc6f732eb6620e259e", - "type": "git" - }, "hexa-nur-packages": { "branch": "master", "description": "My personal NUR repository: [maintainer=@mweinelt] ", diff --git a/overlays/mastodon-digest/all-posts.patch b/overlays/mastodon-digest/all-posts.patch new file mode 100644 index 00000000..340254d0 --- /dev/null +++ b/overlays/mastodon-digest/all-posts.patch @@ -0,0 +1,13 @@ +diff --git a/thresholds.py b/thresholds.py +index 8d7f114..0802ff6 100644 +--- a/thresholds.py ++++ b/thresholds.py +@@ -11,8 +11,6 @@ if TYPE_CHECKING: + + + class Threshold(Enum): +- ALL = 0 +- HALF = 50 + LAX = 90 + NORMAL = 95 + STRICT = 98 diff --git a/overlays/mastodon-digest/default.nix b/overlays/mastodon-digest/default.nix new file mode 100644 index 00000000..5646696e --- /dev/null +++ b/overlays/mastodon-digest/default.nix @@ -0,0 +1,34 @@ +final: prev: let + pkgs = final; + deps = ps: + with ps; [ + jinja2 + mastodon-py + scipy + python-dotenv + ]; + python-env = pkgs.python3.withPackages deps; + src = pkgs.fetchFromGitHub { + owner = "hodgesmr"; + repo = "mastodon_digest"; + rev = "07d8827a79086263f0e0f161faa2c12e405b2929"; + hash = "sha256-iFOvexzj5UQve67nvNcGthrvVbL5yQbYyUIXlaRYlug="; + }; + patchedSrc = pkgs.runCommand "mastodon_digest-patched-src" '' { } + cp -r ${src} $out + chmod -R +w $out + patch -d $out -p1 < ${./all-posts.patch} + ''; +in { + mastodon_digest = pkgs.writeShellApplication { + name = "mastodon_digest"; + runtimeInputs = [python-env]; + text = '' + set -o allexport + # shellcheck source=/dev/null + source .env + set +o allexport + cd ${patchedSrc} && python run.py "''${@}" + ''; + }; +}