diff --git a/pkgs/applications/version-management/forgejo/default.nix b/pkgs/applications/version-management/forgejo/default.nix index e00853393e05..91b3b0cd9cd1 100644 --- a/pkgs/applications/version-management/forgejo/default.nix +++ b/pkgs/applications/version-management/forgejo/default.nix @@ -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";