2021-03-20 04:20:00 +00:00
|
|
|
{ lib
|
2023-01-11 07:51:40 +00:00
|
|
|
, stdenv
|
2021-03-20 04:20:00 +00:00
|
|
|
, buildGoPackage
|
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
|
|
|
, git
|
|
|
|
, bash
|
|
|
|
, gzip
|
|
|
|
, openssh
|
|
|
|
, pam
|
2020-04-24 23:36:52 +00:00
|
|
|
, sqliteSupport ? true
|
|
|
|
, pamSupport ? true
|
2021-02-05 17:12:51 +00:00
|
|
|
, nixosTests
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoPackage rec {
|
|
|
|
pname = "gitea";
|
2023-01-20 10:41:00 +00:00
|
|
|
version = "1.18.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-20 04:20:00 +00:00
|
|
|
# not fetching directly from the git repo, because that lacks several vendor files for the web UI
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchurl {
|
2022-10-21 18:38:19 +00:00
|
|
|
url = "https://dl.gitea.io/gitea/${version}/gitea-src-${version}.tar.gz";
|
2023-01-20 10:41:00 +00:00
|
|
|
sha256 = "sha256-FUliQ77P0WiwB1dWHDY3FjeJdHhUAcs/97JKXBdEdl0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
patches = [
|
|
|
|
./static-root-path.patch
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace modules/setting/setting.go --subst-var data
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
buildInputs = lib.optional pamSupport pam;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-20 04:20:00 +00:00
|
|
|
preBuild =
|
|
|
|
let
|
2022-06-26 10:26:21 +00:00
|
|
|
tags = lib.optional pamSupport "pam"
|
|
|
|
++ lib.optional sqliteSupport "sqlite sqlite_unlock_notify";
|
|
|
|
tagsString = lib.concatStringsSep " " tags;
|
2021-03-20 04:20:00 +00:00
|
|
|
in
|
|
|
|
''
|
|
|
|
export buildFlagsArray=(
|
|
|
|
-tags="${tagsString}"
|
|
|
|
-ldflags='-X "main.Version=${version}" -X "main.Tags=${tagsString}"'
|
|
|
|
)
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
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 \
|
2022-06-26 10:26:21 +00:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ bash git gzip openssh ]}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
goPackagePath = "code.gitea.io/gitea";
|
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
passthru.tests = nixosTests.gitea;
|
2021-02-05 17:12:51 +00:00
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Git with a cup of tea";
|
|
|
|
homepage = "https://gitea.io";
|
|
|
|
license = licenses.mit;
|
2022-01-19 23:45:15 +00:00
|
|
|
maintainers = with maintainers; [ disassembler kolaente ma27 techknowlogick ];
|
2023-01-11 07:51:40 +00:00
|
|
|
broken = stdenv.isDarwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|