forgejo: use buildGoModule

This commit is contained in:
Aaron Jheng 2023-01-25 11:44:31 +00:00
parent 4d52a644a7
commit f37a8bd339
No known key found for this signature in database
GPG key ID: F6A547A869D050A3

View file

@ -1,18 +1,18 @@
{ lib
, stdenv
, buildGoPackage
, buildGoModule
, fetchurl
, makeWrapper
, git
, bash
, gzip
, openssh
, gzip
, pam
, pamSupport ? true
, sqliteSupport ? true
}:
buildGoPackage rec {
buildGoModule rec {
pname = "forgejo";
version = "1.18.2-1";
@ -23,10 +23,13 @@ buildGoPackage rec {
hash = "sha256-XSh17AwPtC+Y24lgjjXJzT/uBHg+0hWZ2RZ/eNF4mCY=";
};
vendorHash = null;
subPackages = [ "." ];
outputs = [ "out" "data" ];
nativeBuildInputs = [ makeWrapper ];
buildInputs = lib.optional pamSupport pam;
patches = [
@ -39,22 +42,23 @@ buildGoPackage rec {
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}'"
];
postInstall = ''
mkdir $data
cp -R ./go/src/${goPackagePath}/{public,templates,options} $data
cp -R ./{public,templates,options} $data
mkdir -p $out
cp -R ./go/src/${goPackagePath}/options/locale $out/locale
cp -R ./options/locale $out/locale
wrapProgram $out/bin/gitea \
--prefix PATH : ${lib.makeBinPath [ bash git gzip openssh ]}
'';
goPackagePath = "code.gitea.io/gitea";
meta = with lib; {
description = "A self-hosted lightweight software forge";
homepage = "https://forgejo.org";