1
0
Fork 0
nixos-config/overlays/mastodon-digest/default.nix

30 lines
866 B
Nix
Raw Normal View History

2023-05-22 02:08:50 +00:00
final: _prev:
2023-05-22 01:06:42 +00:00
let
2023-01-15 23:30:51 +00:00
pkgs = final;
2023-05-22 01:06:42 +00:00
deps = ps: with ps; [ jinja2 mastodon-py scipy python-dotenv ];
2023-01-15 23:30:51 +00:00
python-env = pkgs.python3.withPackages deps;
src = pkgs.fetchFromGitHub {
owner = "hodgesmr";
repo = "mastodon_digest";
rev = "07d8827a79086263f0e0f161faa2c12e405b2929";
hash = "sha256-iFOvexzj5UQve67nvNcGthrvVbL5yQbYyUIXlaRYlug=";
};
2023-05-22 01:06:42 +00:00
patchedSrc = pkgs.runCommand "mastodon_digest-patched-src" { } ''
2023-01-16 02:06:03 +00:00
cp -r ${src} $out
chmod -R +w $out
patch -d $out -p1 < ${./all-posts.patch}
2023-02-12 22:07:54 +00:00
cd $out/templates/themes
2023-02-20 12:38:32 +00:00
cp -r default no-boosts
cp ${./index.html.jinja} no-boosts/index.html.jinja
2023-01-15 23:30:51 +00:00
'';
in {
mastodon_digest = pkgs.writeShellApplication {
name = "mastodon_digest";
2023-05-22 01:06:42 +00:00
runtimeInputs = [ python-env ];
2023-01-15 23:30:51 +00:00
text = ''
# shellcheck source=/dev/null
cd ${patchedSrc} && python run.py "''${@}"
'';
};
}