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