tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
gitea: build from source
techknowlogick
2 years ago
7a44183c
f99897f4
+37
-14
1 changed file
expand all
collapse all
unified
split
pkgs
applications
version-management
gitea
default.nix
+37
-14
pkgs/applications/version-management/gitea/default.nix
···
1
1
{ lib
2
2
, stdenv
3
3
, buildGoModule
4
4
-
, fetchurl
4
4
+
, fetchFromGitHub
5
5
, makeWrapper
6
6
, git
7
7
, bash
···
16
16
, brotli
17
17
, xorg
18
18
, nixosTests
19
19
+
, buildNpmPackage
19
20
}:
20
21
21
21
-
buildGoModule rec {
22
22
+
let
23
23
+
frontend = buildNpmPackage {
24
24
+
pname = "gitea-frontend";
25
25
+
inherit (gitea) src version;
26
26
+
27
27
+
npmDepsHash = "sha256-gXBBiDIIS0aW6qK37HcF0AuJOliblinznRVXoo6DV1s=";
28
28
+
29
29
+
# use webpack directly instead of 'make frontend' as the packages are already installed
30
30
+
buildPhase = ''
31
31
+
BROWSERSLIST_IGNORE_OLD_DATA=true npx webpack
32
32
+
'';
33
33
+
34
34
+
installPhase = ''
35
35
+
mkdir -p $out
36
36
+
cp -R public $out/
37
37
+
'';
38
38
+
};
39
39
+
in buildGoModule rec {
22
40
pname = "gitea";
23
41
version = "1.22.0";
24
42
25
25
-
# not fetching directly from the git repo, because that lacks several vendor files for the web UI
26
26
-
src = fetchurl {
27
27
-
url = "https://dl.gitea.com/gitea/${version}/gitea-src-${version}.tar.gz";
28
28
-
hash = "sha256-bU4u/RsE12InXjJ2ZvIL31z9AzB7XULyV0+ytAYnyjg=";
43
43
+
src = fetchFromGitHub {
44
44
+
owner = "go-gitea";
45
45
+
repo = "gitea";
46
46
+
rev = "v${gitea.version}";
47
47
+
hash = "sha256-LdNEiPch2BZNYMOjE9yWsq78g6DolMjM5wUci3jXj30=";
29
48
};
30
49
31
31
-
vendorHash = null;
50
50
+
vendorHash = "sha256-8VoJR4p2WnhG6nTFMzBlcrd/B6UwaOU3Q/rnDx9MtWc=";
51
51
+
52
52
+
outputs = [ "out" "data" ];
32
53
33
33
-
patches = [
34
34
-
./static-root-path.patch
35
35
-
];
54
54
+
patches = [ ./static-root-path.patch ];
55
55
+
56
56
+
# go-modules derivation doesn't provide $data
57
57
+
# so we need to wait until it is built, and then
58
58
+
# at that time we can then apply the substituteInPlace
59
59
+
overrideModAttrs = _: { postPatch = null; };
36
60
37
61
postPatch = ''
38
62
substituteInPlace modules/setting/server.go --subst-var data
···
54
78
"-X 'main.Tags=${lib.concatStringsSep " " tags}'"
55
79
];
56
80
57
57
-
outputs = [ "out" "data" ];
58
58
-
59
81
postInstall = ''
60
82
mkdir $data
61
61
-
cp -R ./{public,templates,options} $data
83
83
+
ln -s ${frontend}/public $data/public
84
84
+
cp -R ./{templates,options} $data
62
85
mkdir -p $out
63
86
cp -R ./options/locale $out/locale
64
87
···
84
107
85
108
meta = with lib; {
86
109
description = "Git with a cup of tea";
87
87
-
homepage = "https://gitea.io";
110
110
+
homepage = "https://about.gitea.com";
88
111
license = licenses.mit;
89
112
maintainers = with maintainers; [ ma27 techknowlogick SuperSandro2000 ];
90
113
broken = stdenv.isDarwin;