Add a repo icon option, rasterized from the randogoth.com favicon

The F-Droid client decodes repo icons as bitmaps, so the site's SVG icon
is shipped as a 512x512 PNG and copied into repo/icons/ on every sync.
This commit is contained in:
randogoth 2026-10-14 14:03:29 +03:00
parent cc0f06eb7d
commit e6fa02e7eb
2 changed files with 18 additions and 0 deletions

BIN
assets/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -34,6 +34,11 @@ let
repo_name: ${cfg.repoName} repo_name: ${cfg.repoName}
repo_description: ${cfg.repoDescription} repo_description: ${cfg.repoDescription}
repo_keyalias: ${cfg.keyAlias} repo_keyalias: ${cfg.keyAlias}
# fdroidserver checks this path for existence relative to the cwd `fdroid
# update` runs in (stateDir), then copies it into repo/icons/ under its
# own basename — so this is deliberately already that destination path,
# which the sync script keeps populated before every run.
repo_icon: repo/icons/icon.png
keystore: ${cfg.keystoreFile} keystore: ${cfg.keystoreFile}
keystorepass: {env: FDROID_KEYSTORE_PASS} keystorepass: {env: FDROID_KEYSTORE_PASS}
keypass: {env: FDROID_KEY_PASS} keypass: {env: FDROID_KEY_PASS}
@ -69,6 +74,9 @@ let
# every run. There is nothing secret in ours, but a warning that is always # every run. There is nothing secret in ours, but a warning that is always
# printed is a warning nobody reads when it finally matters. # printed is a warning nobody reads when it finally matters.
install -m 0600 ${repoConfig} ${cfg.stateDir}/config.yml install -m 0600 ${repoConfig} ${cfg.stateDir}/config.yml
# Kept populated every run rather than once, so an icon change here
# propagates on the next sync without anyone having to touch the server.
install -D -m 0644 ${cfg.repoIcon} ${cfg.stateDir}/repo/icons/icon.png
exec ${pythonEnv}/bin/python3 ${./fdroid-sync.py} ${syncConfig} "$@" exec ${pythonEnv}/bin/python3 ${./fdroid-sync.py} ${syncConfig} "$@"
''; '';
@ -211,6 +219,16 @@ in
description = "Repo description shown in the F-Droid client."; description = "Repo description shown in the F-Droid client.";
}; };
repoIcon = lib.mkOption {
type = lib.types.path;
default = ./assets/icon.png;
description = ''
Icon shown next to the repo in the F-Droid client. Must be a raster
image (PNG) — the client decodes it as a bitmap, so an SVG renders as
a broken icon rather than falling back to anything.
'';
};
keyAlias = lib.mkOption { keyAlias = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "nanuqsaurus"; default = "nanuqsaurus";