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
|
# The rss-kakapo server, as a plain callPackage function, so that a consumer
# can build it against its own nixpkgs:
#
# pkgs.callPackage "${rss-kakapo-src}/package.nix" { src = rss-kakapo-src; }
#
# flake.nix does exactly this with the flake's own nixpkgs.
#
# Produces the server binary (bin/rss-kakapo) plus the www/ tree it serves its
# templates and assets from (share/rss-kakapo/www). rss-kakapo looks www/ up
# relative to its working directory, so whoever runs it has to chdir into
# share/rss-kakapo first.
{ lib, buildGoModule, src }:
let
# Bump the suffix for every fork release; the base is the upstream
# RSS Parrot tag the fork sits on.
version = "0.0.99-kakapo.1";
in
buildGoModule {
pname = "rss-kakapo";
inherit version src;
modRoot = "src/server";
vendorHash = "sha256-tskj7HN1otc1jnxTZucceVS+RCF0gKTrub7sF8PqUO0=";
# mattn/go-sqlite3 needs CGO.
env.CGO_ENABLED = "1";
# Shown in the web footer and sent in the User-Agent header.
postPatch = ''
echo "v${version}" > src/server/www/version.txt
'';
# go install names the binary after the last element of the module path,
# and the module keeps upstream's name rss_parrot (so cherry-picks stay
# clean). No guard: if the name ever changes, the build should fail here
# rather than silently ship a differently named binary.
postInstall = ''
mv "$out/bin/rss_parrot" "$out/bin/rss-kakapo"
mkdir -p $out/share/rss-kakapo
cp -r www $out/share/rss-kakapo/www
'';
meta = {
description = "Turn Mastodon into your feed reader (a fork of RSS Parrot)";
homepage = "https://sources.profpatsch.de/rss-kakapo/";
license = lib.licenses.mit;
mainProgram = "rss-kakapo";
};
}
|