nixpkgs/pkgs/applications/version-management/gitea/default.nix
Maximilian Bosch b5c6d4dabd
gitea: mark as broken on darwin
Build is currently failing:

```
/nix/store/za0pnll14dv61b124n6xxnjapd150lcr-go-1.19.4/share/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
Undefined symbols for architecture x86_64:
  "_pam_start_confdir", referenced from:
      __cgo_897673d6bfaf_Cfunc_pam_start_confdir in 000032.o
      _check_pam_start_confdir in 000033.o
     (maybe you meant: _check_pam_start_confdir, __cgo_897673d6bfaf_Cfunc_check_pam_start_confdir , __cgo_897673d6bfaf_Cfunc_pam_start_confdir )
ld: symbol(s) not found for architecture x86_64
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
error: builder for '/nix/store/zqr2xx5a66km81m8av714sm45gy3ym0g-gitea-1.18.0.drv' failed with exit code 1;
```
2023-01-02 11:19:05 +01:00

75 lines
1.7 KiB
Nix

{ lib
, stdenv
, buildGoPackage
, fetchurl
, makeWrapper
, git
, bash
, gzip
, openssh
, pam
, sqliteSupport ? true
, pamSupport ? true
, nixosTests
}:
buildGoPackage rec {
pname = "gitea";
version = "1.18.0";
# not fetching directly from the git repo, because that lacks several vendor files for the web UI
src = fetchurl {
url = "https://dl.gitea.io/gitea/${version}/gitea-src-${version}.tar.gz";
sha256 = "sha256-X0KvIB2JvSoh2MR9FcwKObQzod2GxhKeGqIKU5CKTEM=";
};
patches = [
./static-root-path.patch
];
postPatch = ''
substituteInPlace modules/setting/setting.go --subst-var data
'';
nativeBuildInputs = [ makeWrapper ];
buildInputs = lib.optional pamSupport pam;
preBuild =
let
tags = lib.optional pamSupport "pam"
++ lib.optional sqliteSupport "sqlite sqlite_unlock_notify";
tagsString = lib.concatStringsSep " " tags;
in
''
export buildFlagsArray=(
-tags="${tagsString}"
-ldflags='-X "main.Version=${version}" -X "main.Tags=${tagsString}"'
)
'';
outputs = [ "out" "data" ];
postInstall = ''
mkdir $data
cp -R ./go/src/${goPackagePath}/{public,templates,options} $data
mkdir -p $out
cp -R ./go/src/${goPackagePath}/options/locale $out/locale
wrapProgram $out/bin/gitea \
--prefix PATH : ${lib.makeBinPath [ bash git gzip openssh ]}
'';
goPackagePath = "code.gitea.io/gitea";
passthru.tests = nixosTests.gitea;
meta = with lib; {
description = "Git with a cup of tea";
homepage = "https://gitea.io";
license = licenses.mit;
maintainers = with maintainers; [ disassembler kolaente ma27 techknowlogick ];
broken = stdenv.isDarwin;
};
}