1
0
Fork 0
forked from emily/nixfiles
nixfiles-emily/pkgs/akkoma-fe-domi/default.nix

53 lines
1.6 KiB
Nix

{
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
substituteInPlace src/modules/instance.js \
--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"
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
'';
})