diff --git a/nixos/tests/forgejo.nix b/nixos/tests/forgejo.nix index 8b9ee46ff5d3..827fae2790c6 100644 --- a/nixos/tests/forgejo.nix +++ b/nixos/tests/forgejo.nix @@ -141,9 +141,9 @@ let assert "BEGIN PGP PUBLIC KEY BLOCK" in server.succeed("curl http://localhost:3000/api/v1/signing-key.gpg") api_version = json.loads(server.succeed("curl http://localhost:3000/api/forgejo/v1/version")).get("version") - assert "development" != api_version and "-gitea-" in api_version, ( + assert "development" != api_version and "${pkgs.forgejo.version}+gitea-" in api_version, ( "/api/forgejo/v1/version should not return 'development' " - + f"but should contain a gitea compatibility version string. Got '{api_version}' instead." + + f"but should contain a forgejo+gitea compatibility version string. Got '{api_version}' instead." ) server.succeed( @@ -152,7 +152,7 @@ let ) server.succeed( "su -l forgejo -c 'GITEA_WORK_DIR=/var/lib/forgejo gitea admin user create " - + "--username test --password totallysafe --email test@localhost'" + + "--username test --password totallysafe --email test@localhost --must-change-password=false'" ) api_token = server.succeed( diff --git a/pkgs/applications/version-management/forgejo/package-json-npm-build-frontend.patch b/pkgs/by-name/fo/forgejo/package-json-npm-build-frontend.patch similarity index 58% rename from pkgs/applications/version-management/forgejo/package-json-npm-build-frontend.patch rename to pkgs/by-name/fo/forgejo/package-json-npm-build-frontend.patch index 57e2b7ec6965..f7567da020c6 100644 --- a/pkgs/applications/version-management/forgejo/package-json-npm-build-frontend.patch +++ b/pkgs/by-name/fo/forgejo/package-json-npm-build-frontend.patch @@ -1,11 +1,11 @@ diff --git a/package.json b/package.json -index 57dcfc2f7..c9f23dbf7 100644 +index b50c52cf43..d6aafb8775 100644 --- a/package.json +++ b/package.json -@@ -79,5 +79,8 @@ - "defaults", - "not ie > 0", - "not ie_mob > 0" +@@ -98,5 +98,8 @@ + }, + "browserslist": [ + "defaults" - ] + ], + "scripts": { diff --git a/pkgs/applications/version-management/forgejo/default.nix b/pkgs/by-name/fo/forgejo/package.nix similarity index 68% rename from pkgs/applications/version-management/forgejo/default.nix rename to pkgs/by-name/fo/forgejo/package.nix index 65c683ddbe76..fca06c86646d 100644 --- a/pkgs/applications/version-management/forgejo/default.nix +++ b/pkgs/by-name/fo/forgejo/package.nix @@ -24,7 +24,7 @@ let pname = "forgejo-frontend"; inherit (forgejo) src version; - npmDepsHash = "sha256-uMPy4cqMDNZTpF+pk7YibXEJO1zxVfwlCeFzGgJBiU0="; + npmDepsHash = "sha256-BffoEbIzTU61bw3ECEm5eDHcav4S27MB5jQKsMprkcw="; patches = [ ./package-json-npm-build-frontend.patch @@ -39,33 +39,17 @@ let in buildGoModule rec { pname = "forgejo"; - version = "1.21.11-1"; + version = "7.0.0"; src = fetchFromGitea { domain = "codeberg.org"; owner = "forgejo"; repo = "forgejo"; rev = "v${version}"; - hash = "sha256-7oYsoZpZcNIUw3iXSi1Q5So2yYgKnT5U7GHQ4NVqVdc="; - # Forgejo has multiple different version strings that need to be provided - # via ldflags. main.ForgejoVersion for example is a combination of a - # hardcoded gitea compatibility version string (in the Makefile) and - # git describe and is easiest to get by invoking the Makefile. - # So we do that, store it the src FOD to then extend the ldflags array - # in preConfigure. - # The `echo -e >> Makefile` is temporary and already part of the next - # major release. Furthermore, the ldflags will change next major release - # and need to be updated accordingly. - leaveDotGit = true; - postFetch = '' - cd "$out" - echo -e 'show-version-full:\n\t@echo ''${FORGEJO_VERSION}' >> Makefile - make show-version-full > FULL_VERSION - find "$out" -name .git -print0 | xargs -0 rm -rf - ''; + hash = "sha256-oIx1aPrHgOWx13ocA3t7N5UdTgr+64tgC0XcEnhA/eE="; }; - vendorHash = "sha256-OuWNF+muWM6xqwkFxLIUsn/huqXj2VKg8BN9+JHVw58="; + vendorHash = "sha256-UcjaMi/4XYLdaJhi2j3UWqHqkpTbZBo6EwNXxdRIKLw="; subPackages = [ "." ]; @@ -93,7 +77,7 @@ buildGoModule rec { ]; preConfigure = '' - export ldflags+=" -X code.gitea.io/gitea/routers/api/forgejo/v1.ForgejoVersion=$(cat FULL_VERSION) -X main.ForgejoVersion=$(cat FULL_VERSION)" + export ldflags+=" -X main.ForgejoVersion=$(GITEA_VERSION=${version} make show-version-api)" ''; preBuild = '' diff --git a/pkgs/applications/version-management/forgejo/static-root-path.patch b/pkgs/by-name/fo/forgejo/static-root-path.patch similarity index 60% rename from pkgs/applications/version-management/forgejo/static-root-path.patch rename to pkgs/by-name/fo/forgejo/static-root-path.patch index 7f70329c6040..598c3a8103b1 100644 --- a/pkgs/applications/version-management/forgejo/static-root-path.patch +++ b/pkgs/by-name/fo/forgejo/static-root-path.patch @@ -1,10 +1,10 @@ diff --git a/modules/setting/server.go b/modules/setting/server.go -index 183906268..fa02e8915 100644 +index c20dd1949d..c9bcdce99a 100644 --- a/modules/setting/server.go +++ b/modules/setting/server.go -@@ -319,7 +319,7 @@ func loadServerFrom(rootCfg ConfigProvider) { - OfflineMode = sec.Key("OFFLINE_MODE").MustBool() - Log.DisableRouterLog = sec.Key("DISABLE_ROUTER_LOG").MustBool() +@@ -317,7 +317,7 @@ func loadServerFrom(rootCfg ConfigProvider) { + RedirectorUseProxyProtocol = sec.Key("REDIRECTOR_USE_PROXY_PROTOCOL").MustBool(UseProxyProtocol) + OfflineMode = sec.Key("OFFLINE_MODE").MustBool(true) if len(StaticRootPath) == 0 { - StaticRootPath = AppWorkPath + StaticRootPath = "@data@" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7bc821761088..467311d641ce 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8448,8 +8448,6 @@ with pkgs; gitea-actions-runner = callPackage ../development/tools/continuous-integration/gitea-actions-runner { }; - forgejo = callPackage ../applications/version-management/forgejo { }; - gokart = callPackage ../development/tools/gokart { }; gl2ps = callPackage ../development/libraries/gl2ps { };