2021-03-20 04:20:00 +00:00
|
|
|
{ lib
|
2023-01-11 07:51:40 +00:00
|
|
|
, stdenv
|
2023-02-02 18:25:31 +00:00
|
|
|
, buildGoModule
|
2021-03-20 04:20:00 +00:00
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
|
|
|
, git
|
|
|
|
, bash
|
2023-03-24 00:07:29 +00:00
|
|
|
, gitea
|
2021-03-20 04:20:00 +00:00
|
|
|
, gzip
|
|
|
|
, openssh
|
|
|
|
, pam
|
2020-04-24 23:36:52 +00:00
|
|
|
, sqliteSupport ? true
|
|
|
|
, pamSupport ? true
|
2023-03-24 00:07:29 +00:00
|
|
|
, runCommand
|
|
|
|
, brotli
|
|
|
|
, xorg
|
2021-02-05 17:12:51 +00:00
|
|
|
, nixosTests
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
buildGoModule rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "gitea";
|
2023-05-24 13:37:59 +00:00
|
|
|
version = "1.19.3";
|
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 {
|
2023-05-24 13:37:59 +00:00
|
|
|
url = "https://dl.gitea.com/gitea/${version}/gitea-src-${version}.tar.gz";
|
|
|
|
hash = "sha256-rSvBeSnJ356Yba7tZXg0S11ZRzYmF3xnOl4ZUJ8XQYw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
vendorHash = null;
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
subPackages = [ "." ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
buildInputs = lib.optional pamSupport pam;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
tags = lib.optional pamSupport "pam"
|
|
|
|
++ lib.optionals sqliteSupport [ "sqlite" "sqlite_unlock_notify" ];
|
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X main.Version=${version}"
|
|
|
|
"-X 'main.Tags=${lib.concatStringsSep " " tags}'"
|
|
|
|
];
|
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
|
2023-02-02 18:25:31 +00:00
|
|
|
cp -R ./{public,templates,options} $data
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p $out
|
2023-02-02 18:25:31 +00:00
|
|
|
cp -R ./options/locale $out/locale
|
2020-04-24 23:36:52 +00:00
|
|
|
|
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
|
|
|
'';
|
|
|
|
|
2023-03-24 00:07:29 +00:00
|
|
|
passthru = {
|
|
|
|
data-compressed = runCommand "gitea-data-compressed" {
|
|
|
|
nativeBuildInputs = [ brotli xorg.lndir ];
|
|
|
|
} ''
|
|
|
|
mkdir $out
|
|
|
|
lndir ${gitea.data}/ $out/
|
|
|
|
|
|
|
|
# Create static gzip and brotli files
|
|
|
|
find -L $out -type f -regextype posix-extended -iregex '.*\.(css|html|js|svg|ttf|txt)' \
|
|
|
|
-exec gzip --best --keep --force {} ';' \
|
|
|
|
-exec brotli --best --keep --no-copy-stat {} ';'
|
|
|
|
'';
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|