depot/third_party/nixpkgs/pkgs/applications/version-management/gitea/default.nix
Default email 5557ff764c Project import generated by Copybara.
GitOrigin-RevId: 988cc958c57ce4350ec248d2d53087777f9e1949
2023-02-22 11:55:15 +01:00

73 lines
1.5 KiB
Nix

{ lib
, stdenv
, buildGoModule
, fetchurl
, makeWrapper
, git
, bash
, gzip
, openssh
, pam
, sqliteSupport ? true
, pamSupport ? true
, nixosTests
}:
buildGoModule rec {
pname = "gitea";
version = "1.18.5";
# 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";
hash = "sha256-OGPn4fknYfzmuAi6CL8m/Ih4uRNraVDmpBm20qT3lKk=";
};
vendorHash = null;
patches = [
./static-root-path.patch
];
postPatch = ''
substituteInPlace modules/setting/setting.go --subst-var data
'';
subPackages = [ "." ];
nativeBuildInputs = [ makeWrapper ];
buildInputs = lib.optional pamSupport pam;
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}'"
];
outputs = [ "out" "data" ];
postInstall = ''
mkdir $data
cp -R ./{public,templates,options} $data
mkdir -p $out
cp -R ./options/locale $out/locale
wrapProgram $out/bin/gitea \
--prefix PATH : ${lib.makeBinPath [ bash git gzip openssh ]}
'';
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;
};
}