Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 120 lines 2.4 kB view raw
1{ 2 lib, 3 buildGoModule, 4 fetchFromGitHub, 5 makeWrapper, 6 git, 7 bash, 8 coreutils, 9 compressDrvWeb, 10 gitea, 11 gzip, 12 openssh, 13 sqliteSupport ? true, 14 nixosTests, 15 buildNpmPackage, 16}: 17 18let 19 frontend = buildNpmPackage { 20 pname = "gitea-frontend"; 21 inherit (gitea) src version; 22 23 npmDepsHash = "sha256-+o7/A+Pqr8LZi+q0fOajQgLkWqquBrJSf0dpEXEJtwM="; 24 25 # use webpack directly instead of 'make frontend' as the packages are already installed 26 buildPhase = '' 27 BROWSERSLIST_IGNORE_OLD_DATA=true npx webpack 28 ''; 29 30 installPhase = '' 31 mkdir -p $out 32 cp -R public $out/ 33 ''; 34 }; 35in 36buildGoModule rec { 37 pname = "gitea"; 38 version = "1.24.3"; 39 40 src = fetchFromGitHub { 41 owner = "go-gitea"; 42 repo = "gitea"; 43 tag = "v${gitea.version}"; 44 hash = "sha256-z9GaUkBh/hfDKkygi/1U0tK725mj39eBR906QKn3MWU="; 45 }; 46 47 proxyVendor = true; 48 49 vendorHash = "sha256-VmlF86Sv6R2NmCtWi4kZ4rfmFAjgMB1RU/1jmnPiIkw="; 50 51 outputs = [ 52 "out" 53 "data" 54 ]; 55 56 patches = [ ./static-root-path.patch ]; 57 58 # go-modules derivation doesn't provide $data 59 # so we need to wait until it is built, and then 60 # at that time we can then apply the substituteInPlace 61 overrideModAttrs = _: { postPatch = null; }; 62 63 postPatch = '' 64 substituteInPlace modules/setting/server.go --subst-var data 65 ''; 66 67 subPackages = [ "." ]; 68 69 nativeBuildInputs = [ makeWrapper ]; 70 71 tags = lib.optionals sqliteSupport [ 72 "sqlite" 73 "sqlite_unlock_notify" 74 ]; 75 76 ldflags = [ 77 "-s" 78 "-w" 79 "-X main.Version=${version}" 80 "-X 'main.Tags=${lib.concatStringsSep " " tags}'" 81 ]; 82 83 postInstall = '' 84 mkdir $data 85 ln -s ${frontend}/public $data/public 86 cp -R ./{templates,options} $data 87 mkdir -p $out 88 cp -R ./options/locale $out/locale 89 90 wrapProgram $out/bin/gitea \ 91 --prefix PATH : ${ 92 lib.makeBinPath [ 93 bash 94 coreutils 95 git 96 gzip 97 openssh 98 ] 99 } 100 ''; 101 102 passthru = { 103 data-compressed = 104 lib.warn "gitea.passthru.data-compressed is deprecated. Use \"compressDrvWeb gitea.data\"." 105 (compressDrvWeb gitea.data { }); 106 107 tests = nixosTests.gitea; 108 }; 109 110 meta = with lib; { 111 description = "Git with a cup of tea"; 112 homepage = "https://about.gitea.com"; 113 license = licenses.mit; 114 maintainers = with maintainers; [ 115 techknowlogick 116 SuperSandro2000 117 ]; 118 mainProgram = "gitea"; 119 }; 120}