Merge pull request #208623 from Izorkin/update-forgejo

This commit is contained in:
Sandro 2023-01-22 23:43:26 +01:00 committed by GitHub
commit 2e2e574060
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,25 +1,66 @@
{ fetchurl, gitea, lib }:
{ lib
, stdenv
, buildGoPackage
, fetchurl
, makeWrapper
, git
, bash
, gzip
, openssh
, pam
, pamSupport ? true
, sqliteSupport ? true
}:
gitea.overrideAttrs (old: rec {
buildGoPackage rec {
pname = "forgejo";
version = "1.18.0-rc1-1";
version = "1.18.2-0";
src = fetchurl {
name = "${pname}-src-${version}.tar.gz";
# see https://codeberg.org/forgejo/forgejo/releases
url = "https://codeberg.org/attachments/976c426a-3e04-49ff-9762-47fab50624a3";
hash = "sha256-kreBMHlMVB1UeG67zMbszGrgjaROateCRswH7GrKnEw=";
url = "https://codeberg.org/attachments/5d59ec04-9f29-4b32-a1ef-bec5c3132e26";
hash = "sha256-RLShwdx8geyFr1Jk5qDVbsEt2hCjdrwX0lNHea7P+pk=";
};
postInstall = old.postInstall or "" + ''
mv $out/bin/{${old.pname},${pname}}
outputs = [ "out" "data" ];
nativeBuildInputs = [ makeWrapper ];
buildInputs = lib.optional pamSupport pam;
patches = [
./../gitea/static-root-path.patch
];
postPatch = ''
substituteInPlace modules/setting/setting.go --subst-var data
'';
tags = lib.optional pamSupport "pam"
++ lib.optionals sqliteSupport [ "sqlite" "sqlite_unlock_notify" ];
ldflags = [
"-X main.Version=${version}"
"-X 'main.Tags=${lib.concatStringsSep " " tags}'"
];
postInstall = ''
mkdir $data
cp -R ./go/src/${goPackagePath}/{public,templates,options} $data
mkdir -p $out
cp -R ./go/src/${goPackagePath}/options/locale $out/locale
wrapProgram $out/bin/gitea \
--prefix PATH : ${lib.makeBinPath [ bash git gzip openssh ]}
'';
goPackagePath = "code.gitea.io/gitea";
meta = with lib; {
description = "A self-hosted lightweight software forge";
homepage = "https://forgejo.org";
changelog = "https://codeberg.org/forgejo/forgejo/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [ urandom ];
broken = stdenv.isDarwin;
};
})
}