577274b382
Pin to oleks/main c45ea82 (PR #20: push SSE update on issue close/reopen for project boards, fixes #19). Only src rev/hash/version change; no go.mod or pnpm-lock changes so vendorHash and pnpmDeps stay valid.
170 lines
4.3 KiB
Nix
170 lines
4.3 KiB
Nix
{
|
|
lib,
|
|
buildGoModule,
|
|
fetchgit,
|
|
makeWrapper,
|
|
git,
|
|
bash,
|
|
coreutils,
|
|
gzip,
|
|
nodejs,
|
|
openssh,
|
|
fetchPnpmDeps,
|
|
pnpmConfigHook,
|
|
pnpm,
|
|
stdenv,
|
|
sqliteSupport ? true,
|
|
}:
|
|
|
|
# Custom Gitea built from Oleks's local fork.
|
|
#
|
|
# Fork repo (local working copy): /home/oleks/projects/gitea
|
|
# Fork remote: https://git.oleks.space/oleks/gitea.git
|
|
# Tracked branch: oleks/main (the fork's integration tip;
|
|
# formerly `feat/projects-api`, renamed
|
|
# 2026-05-13. Carries upstream/main +
|
|
# PR #37518 Projects REST API + a few
|
|
# fork-local commits.)
|
|
# Pin discipline: nix-update bumps `rev` and tags the fork
|
|
# at `v<version>` (see passthru.updateScript
|
|
# below) so the rev stays reachable even
|
|
# after future force-pushes / rebases.
|
|
#
|
|
# Mirrors the structure of nixpkgs' gitea derivation (frontend pnpm sub-drv
|
|
# + buildGoModule with go:embed of public/) but with our fork as src.
|
|
|
|
let
|
|
pname = "gitea-local-fork";
|
|
version = "1.26.0-unstable-2026-05-17.1";
|
|
|
|
src = fetchgit {
|
|
url = "https://git.oleks.space/oleks/gitea.git";
|
|
rev = "c45ea82fd1408bdb7170308080e0eb0ffdea85b2";
|
|
hash = "sha256-AZKXcweNi6JfEgpfuj+agBNLWrQ50fTpxUalNv3XC9A=";
|
|
};
|
|
|
|
# Gitea's package.json requires pnpm >= 11; nixpkgs ships pnpm 10. The
|
|
# lockfile is v9 (forward-compatible), so strip the engine constraint and
|
|
# the packageManager preference before any pnpm tool sees the source.
|
|
# We only patch the source the frontend sees; the Go build doesn't care.
|
|
frontendSrc = stdenv.mkDerivation {
|
|
pname = "${pname}-frontend-src";
|
|
inherit version src;
|
|
dontConfigure = true;
|
|
dontBuild = true;
|
|
installPhase = ''
|
|
cp -R . $out
|
|
chmod -R +w $out
|
|
${nodejs}/bin/node -e '
|
|
const fs = require("fs");
|
|
const path = process.argv[1];
|
|
const pkg = JSON.parse(fs.readFileSync(path, "utf8"));
|
|
if (pkg.engines) delete pkg.engines.pnpm;
|
|
delete pkg.packageManager;
|
|
fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + "\n");
|
|
' "$out/package.json"
|
|
'';
|
|
};
|
|
|
|
frontend = stdenv.mkDerivation (finalAttrs: {
|
|
pname = "${pname}-frontend";
|
|
inherit version;
|
|
src = frontendSrc;
|
|
|
|
pnpmDeps = fetchPnpmDeps {
|
|
inherit (finalAttrs) pname version src;
|
|
fetcherVersion = 3;
|
|
hash = "sha256-TisyRChMRFm5GgdW2wXPHS7NIPu04SSd97oVEgKJ2dI=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
nodejs
|
|
pnpmConfigHook
|
|
pnpm
|
|
];
|
|
|
|
buildPhase = ''
|
|
make frontend
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out
|
|
cp -R public $out/
|
|
'';
|
|
});
|
|
in
|
|
buildGoModule {
|
|
inherit pname version src;
|
|
|
|
proxyVendor = true;
|
|
vendorHash = "sha256-TxLmmeMinazGmIx94iQvpsncWKXb+42ddZcxbwayVgk=";
|
|
|
|
outputs = [
|
|
"out"
|
|
"data"
|
|
];
|
|
|
|
subPackages = [ "." ];
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
tags = lib.optionals sqliteSupport [
|
|
"sqlite"
|
|
"sqlite_unlock_notify"
|
|
];
|
|
|
|
ldflags = [
|
|
"-s"
|
|
"-w"
|
|
"-X main.Version=${version}"
|
|
"-X 'main.Tags=${
|
|
lib.concatStringsSep " " (
|
|
lib.optionals sqliteSupport [
|
|
"sqlite"
|
|
"sqlite_unlock_notify"
|
|
]
|
|
)
|
|
}'"
|
|
];
|
|
|
|
postInstall = ''
|
|
mkdir $data
|
|
ln -s ${frontend}/public $data/public
|
|
cp -R ./{templates,options} $data
|
|
mkdir -p $out
|
|
cp -R ./options/locale $out/locale
|
|
|
|
wrapProgram $out/bin/gitea \
|
|
--prefix PATH : ${
|
|
lib.makeBinPath [
|
|
bash
|
|
coreutils
|
|
git
|
|
gzip
|
|
openssh
|
|
]
|
|
}
|
|
'';
|
|
|
|
passthru = {
|
|
# Expose hashes nix-update needs to find when iterating.
|
|
inherit (frontend) pnpmDeps;
|
|
|
|
# Custom update flow: refresh hashes + retag the gitea fork + push.
|
|
# Invoke with `nix-update --use-update-script gitea-local-fork` or
|
|
# `just gitea-update` (which passes `--use-update-script`).
|
|
updateScript = ../scripts/update-gitea-local-fork.sh;
|
|
};
|
|
|
|
meta = {
|
|
description = "Gitea fork with Projects REST API (upstream PR #37518)";
|
|
homepage = "https://git.oleks.space/oleks/gitea";
|
|
license = lib.licenses.mit;
|
|
mainProgram = "gitea";
|
|
platforms = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
];
|
|
};
|
|
}
|