biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / applications / version-management / gitea / default.nix
blob4b2105fda93c03d319c7c394c55ac8599ae7057d
1 { lib
2 , stdenv
3 , buildGoModule
4 , fetchurl
5 , makeWrapper
6 , git
7 , bash
8 , coreutils
9 , gitea
10 , gzip
11 , openssh
12 , pam
13 , sqliteSupport ? true
14 , pamSupport ? true
15 , runCommand
16 , brotli
17 , xorg
18 , nixosTests
21 buildGoModule rec {
22   pname = "gitea";
23   version = "1.21.11";
25   # not fetching directly from the git repo, because that lacks several vendor files for the web UI
26   src = fetchurl {
27     url = "https://dl.gitea.com/gitea/${version}/gitea-src-${version}.tar.gz";
28     hash = "sha256-TxysXw3lVdV/hlILztM+D7wIpeqXfglAy7Ak2AxnlEM=";
29   };
31   vendorHash = null;
33   patches = [
34     ./static-root-path.patch
35   ];
37   postPatch = ''
38     substituteInPlace modules/setting/server.go --subst-var data
39   '';
41   subPackages = [ "." ];
43   nativeBuildInputs = [ makeWrapper ];
45   buildInputs = lib.optional pamSupport pam;
47   tags = lib.optional pamSupport "pam"
48     ++ lib.optionals sqliteSupport [ "sqlite" "sqlite_unlock_notify" ];
50   ldflags = [
51     "-s"
52     "-w"
53     "-X main.Version=${version}"
54     "-X 'main.Tags=${lib.concatStringsSep " " tags}'"
55   ];
57   outputs = [ "out" "data" ];
59   postInstall = ''
60     mkdir $data
61     cp -R ./{public,templates,options} $data
62     mkdir -p $out
63     cp -R ./options/locale $out/locale
65     wrapProgram $out/bin/gitea \
66       --prefix PATH : ${lib.makeBinPath [ bash coreutils git gzip openssh ]}
67   '';
69   passthru = {
70     data-compressed = runCommand "gitea-data-compressed" {
71       nativeBuildInputs = [ brotli xorg.lndir ];
72     } ''
73       mkdir $out
74       lndir ${gitea.data}/ $out/
76       # Create static gzip and brotli files
77       find -L $out -type f -regextype posix-extended -iregex '.*\.(css|html|js|svg|ttf|txt)' \
78         -exec gzip --best --keep --force {} ';' \
79         -exec brotli --best --keep --no-copy-stat {} ';'
80     '';
82     tests = nixosTests.gitea;
83   };
85   meta = with lib; {
86     description = "Git with a cup of tea";
87     homepage = "https://gitea.io";
88     license = licenses.mit;
89     maintainers = with maintainers; [ disassembler kolaente ma27 techknowlogick ];
90     broken = stdenv.isDarwin;
91     mainProgram = "gitea";
92   };