nixfiles/pkgs/akkoma-fe-domi/default.nix

54 lines
1.6 KiB
Nix
Raw Permalink Normal View History

2024-10-31 19:44:04 +01:00
{
akkoma-frontends,
fetchFromGitea,
fetchYarnDeps
}:
akkoma-frontends.akkoma-fe.overrideAttrs (let
src = fetchFromGitea {
domain = "git.sakamoto.pl";
owner = "domi";
repo = "akkoma-fe";
rev = "5f0339ce005ccb12365128089edb5fd77f60841b";
hash = "sha256-AHmJyOFmQZXmNMMsp8ONm9Itns1H/idEKl8+sxn2RSA=";
};
offlineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
hash = "sha256-7WB6nmxNckMdftKds2OgD2kClvCCT/I5vmthV0jrkSs=";
};
in {
version = "unstable-2024-07-20";
pname = "akkoma-fe-domi";
inherit src offlineCache;
postPatch = ''
# Build scripts assume to be used within a Git repository checkout
2024-11-01 15:11:59 +01:00
substituteInPlace src/modules/instance.js \
2024-11-04 21:19:57 +01:00
--replace-fail "widenTimeline: true" 'widenTimeline: "50%"'
substituteInPlace src/modules/config.js \
--replace-fail "streaming: false" "streaming: true" \
--replace-fail "useStreamingApi: false" "useStreamingApi: true" \
--replace-fail "webPushNotifications: false" "webPushNotifications: true" \
--replace-fail "postLanguage: undefined" 'postLanguage: "en"'
substituteInPlace src/i18n/en.json \
--replace-fail "meow" "florp" \
--replace-fail "Meow" "Florp"
2024-10-31 19:44:04 +01:00
sed -E -i '/^let commitHash =/,/;$/clet commitHash = "${builtins.substring 0 7 src.rev}";' \
build/webpack.prod.conf.js
'';
configurePhase = ''
runHook preConfigure
export HOME="$(mktemp -d)"
yarn config --offline set yarn-offline-mirror ${offlineCache}
fixup-yarn-lock yarn.lock
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
runHook postConfigure
'';
})