nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 buildGoModule,
3 fetchgit,
4 lib,
5}:
6buildGoModule rec {
7 pname = "libcwtch";
8 version = "0.1.6";
9 # This Gitea instance has archive downloads disabled, so: fetchgit
10 src = fetchgit {
11 url = "https://git.openprivacy.ca/cwtch.im/autobindings.git";
12 rev = "v${version}";
13 hash = "sha256-LlnfGHwjZFvygVF1/f9q+q1rD0OpEGIPzt7E6N6HWDc=";
14 };
15
16 vendorHash = "sha256-t9SupYMfWBF0wHY3EFVT1zu0vvcd4OD/aQqlPeExw04=";
17 overrideModAttrs = (
18 old: {
19 preBuild = ''
20 make lib.go
21 '';
22 }
23 );
24
25 postPatch = ''
26 substituteInPlace Makefile \
27 --replace-fail '$(shell git describe --tags)' v${version} \
28 --replace-fail '$(shell git log -1 --format=%cd --date=format:%G-%m-%d-%H-%M)' 1980-01-01-00-00
29 '';
30
31 buildPhase = ''
32 runHook preBuild
33 make libCwtch.so
34 runHook postBuild
35 '';
36
37 installPhase = ''
38 runHook preInstall
39 install -D build/linux/libCwtch.h -t $out/include
40 # * will match either "amd64" or "arm64" depending on the platform.
41 install -D build/linux/*/libCwtch.so $out/lib/libCwtch.so
42 runHook postInstall
43 '';
44
45 meta = {
46 description = "Decentralized, privacy-preserving, multi-party messaging protocol";
47 homepage = "https://cwtch.im/";
48 changelog = "https://docs.cwtch.im/changelog";
49 license = lib.licenses.mit;
50 platforms = lib.platforms.linux;
51 maintainers = [ lib.maintainers.gmacon ];
52 };
53}