1{
2 stdenv,
3 lib,
4 fetchFromGitea,
5 pkg-config,
6 git,
7 libmicrohttpd,
8}:
9
10stdenv.mkDerivation rec {
11 pname = "fileshare";
12 version = "0.2.4";
13
14 src = fetchFromGitea {
15 domain = "git.tkolb.de";
16 owner = "Public";
17 repo = "fileshare";
18 rev = "v${version}";
19 sha256 = "sha256-00MxPivZngQ2I7Hopz2MipJFnbvSZU0HF2wZucmEWQ4=";
20 };
21
22 postPatch = ''
23 sed -i 's,$(shell git rev-parse --short HEAD),/${version},g' Makefile
24 substituteInPlace Makefile \
25 --replace-fail pkg-config "${stdenv.cc.targetPrefix}pkg-config" \
26 --replace-fail gcc "${stdenv.cc.targetPrefix}cc"
27 '';
28
29 env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";
30
31 nativeBuildInputs = [
32 pkg-config
33 git
34 ];
35 buildInputs = [ libmicrohttpd ];
36
37 makeFlags = [ "BUILD=release" ];
38
39 installPhase = ''
40 mkdir -p $out/bin
41 cp bin/release/fileshare $out/bin
42 '';
43
44 meta = with lib; {
45 description = "Small HTTP Server for quickly sharing files over the network";
46 longDescription = "Fileshare is a simple tool for sharing the contents of a directory via a webserver and optionally allowing uploads.";
47 homepage = "https://git.tkolb.de/Public/fileshare";
48 license = licenses.mit;
49 maintainers = [ maintainers.esclear ];
50 platforms = platforms.linux;
51 mainProgram = "fileshare";
52 };
53}