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