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