2021-01-15 14:21:58 +01:00
|
|
|
{ lib, stdenv, buildGoPackage, fetchurl, makeWrapper
|
2018-12-23 01:49:25 +01:00
|
|
|
, git, bash, gzip, openssh, pam
|
2017-10-18 06:16:33 +02:00
|
|
|
, sqliteSupport ? true
|
2018-12-23 01:49:25 +01:00
|
|
|
, pamSupport ? true
|
2017-10-18 06:16:33 +02:00
|
|
|
}:
|
|
|
|
|
2021-01-15 14:21:58 +01:00
|
|
|
with lib;
|
2017-10-18 06:16:33 +02:00
|
|
|
|
|
|
|
buildGoPackage rec {
|
2019-03-30 11:23:35 +01:00
|
|
|
pname = "gitea";
|
2020-12-28 20:32:18 +01:00
|
|
|
version = "1.13.1";
|
2017-10-18 06:16:33 +02:00
|
|
|
|
2020-03-20 01:32:16 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/go-gitea/gitea/releases/download/v${version}/gitea-src-${version}.tar.gz";
|
2020-12-28 20:32:18 +01:00
|
|
|
sha256 = "sha256-tah7ciq+jkkROJq/V+yPRtWPuWaSnf5hKndjnifsQYc=";
|
2017-10-18 06:16:33 +02:00
|
|
|
};
|
|
|
|
|
2020-03-20 01:32:16 +01:00
|
|
|
unpackPhase = ''
|
|
|
|
mkdir source/
|
|
|
|
tar xvf $src -C source/
|
|
|
|
'';
|
|
|
|
|
|
|
|
sourceRoot = "source";
|
|
|
|
|
2020-05-10 02:50:41 +02:00
|
|
|
patches = [
|
|
|
|
./static-root-path.patch
|
|
|
|
];
|
2017-10-18 06:16:33 +02:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs .
|
|
|
|
substituteInPlace modules/setting/setting.go --subst-var data
|
|
|
|
'';
|
|
|
|
|
2020-03-18 13:27:40 +01:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
buildInputs = optional pamSupport pam;
|
2017-10-18 06:16:33 +02:00
|
|
|
|
2019-03-30 14:56:55 +01:00
|
|
|
preBuild = let
|
|
|
|
tags = optional pamSupport "pam"
|
2021-01-11 19:09:14 +01:00
|
|
|
++ optional sqliteSupport "sqlite sqlite_unlock_notify";
|
2019-03-30 14:56:55 +01:00
|
|
|
tagsString = concatStringsSep " " tags;
|
|
|
|
in ''
|
|
|
|
export buildFlagsArray=(
|
|
|
|
-tags="${tagsString}"
|
|
|
|
-ldflags='-X "main.Version=${version}" -X "main.Tags=${tagsString}"'
|
|
|
|
)
|
2018-12-22 04:29:52 +01:00
|
|
|
'';
|
2017-10-18 06:16:33 +02:00
|
|
|
|
2020-04-28 03:50:57 +02:00
|
|
|
outputs = [ "out" "data" ];
|
2017-10-18 06:16:33 +02:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir $data
|
2020-03-20 01:32:16 +01:00
|
|
|
cp -R ./go/src/${goPackagePath}/{public,templates,options} $data
|
2017-10-18 06:16:33 +02:00
|
|
|
mkdir -p $out
|
2020-03-20 01:32:16 +01:00
|
|
|
cp -R ./go/src/${goPackagePath}/options/locale $out/locale
|
2017-10-18 06:16:33 +02:00
|
|
|
|
2020-04-28 03:50:57 +02:00
|
|
|
wrapProgram $out/bin/gitea \
|
2017-10-18 06:16:33 +02:00
|
|
|
--prefix PATH : ${makeBinPath [ bash git gzip openssh ]}
|
|
|
|
'';
|
|
|
|
|
|
|
|
goPackagePath = "code.gitea.io/gitea";
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Git with a cup of tea";
|
2019-09-07 22:25:14 +02:00
|
|
|
homepage = "https://gitea.io";
|
2017-10-18 06:16:33 +02:00
|
|
|
license = licenses.mit;
|
2020-03-20 01:32:16 +01:00
|
|
|
maintainers = with maintainers; [ disassembler kolaente ma27 ];
|
2017-10-18 06:16:33 +02:00
|
|
|
};
|
|
|
|
}
|