/ flake.nix
flake.nix
  1  {
  2    description = "Any-sync nix package";
  3  
  4    inputs = {
  5      flake-parts.url = "github:hercules-ci/flake-parts";
  6      nixpkgs.url = "git+https://github.com/nixos/nixpkgs?ref=release-25.11&shallow=1";
  7    };
  8  
  9    outputs = { self, flake-parts, nixpkgs, ... } @ inputs:
 10      flake-parts.lib.mkFlake {inherit inputs; } ( { config, withSystem, moduleWithSystem, ... }: {
 11        systems = [ "x86_64-linux" ];
 12        flake = {
 13          overlays.default = prev: final: {
 14            redisbloom = final.callPackage ({ lib, stdenv, fetchFromGitHub, redis, python3, cmake }:
 15              stdenv.mkDerivation (finalAttrs: {
 16                pname = "redisbloom";
 17                version = "8.2.8";
 18                src = (fetchFromGitHub {
 19                    owner = "redisbloom";
 20                    repo = "redisbloom";
 21                    tag = "v8.2.8";
 22                    hash = "sha256-wRH6fdDTErscBYUxdh2yyf/FeUOeNaGt5312S6eUHsk=";
 23                    fetchSubmodules =  true;
 24                  }) ;
 25                patches = [ ./bloom.diff ];
 26                nativeBuildInputs = [ python3 cmake ];
 27                dontUseCmakeConfigure = true;
 28                cmakeFlage = [];
 29                dontConfigure = true;
 30                preBuild = ''
 31                  patchShebangs --build deps/readies/bin/platform
 32                '';
 33                buildPhase = ''
 34                  runHook preBuild
 35                  make
 36                '';
 37                installPhase = ''
 38                  mkdir -p "$out"/lib
 39                  cp bin/*/redisbloom.so "$out"/lib
 40                '';
 41                meta = {
 42                  license = lib.licenses.agpl3Only;
 43                };
 44              })) {};
 45  
 46            any-sync-tools = final.callPackage ({
 47              lib, buildGoModule, fetchFromGitHub,
 48            }: buildGoModule (finalAttrs: {
 49              pname = "any-sync-tools";
 50              version = "0.6.0";
 51              src = fetchFromGitHub {
 52                owner = "anyproto";
 53                repo = "any-sync-tools";
 54                tag = "v${finalAttrs.version}";
 55                hash = "sha256-8gsZzbc9hoY6zB3cN/OG2Lnalag3M3a5STsKiwH01RQ=";
 56              };
 57              vendorHash = "sha256-5AueL3gPLmPpglXs9EBzuT3EyLhGFWwCLZGuHmfMr60=";
 58              meta = {
 59                description = "Any-sync configuration and debugging tools";
 60                homepage = "https://anytype.io";
 61                license = lib.licenses.mit;
 62                maintainers = with lib.maintainers; [ spacefrogg ];
 63              };
 64            })) {};
 65  
 66            any-sync-coordinator = final.callPackage ({
 67              lib, buildGoModule, fetchFromGitHub,
 68            }: buildGoModule (finalAttrs: {
 69              pname = "any-sync-coordinator";
 70              version = "0.8.4";
 71              src = fetchFromGitHub {
 72                owner = "anyproto";
 73                repo = "any-sync-coordinator";
 74                tag = "v${finalAttrs.version}";
 75                hash = "sha256-pB5E0FTtyQaqXUWeWRYy1xuAaWfmakjCr0ftZ9TlJxE=";
 76              };
 77              vendorHash = "sha256-Gy3LAOzoY1XjgMclp5PNFketYUO7+xre0ypP5QLXe38=";
 78              doCheck = false; # need network
 79              meta = {
 80                description = "Any-sync node coordinator";
 81                homepage = "https://anytype.io";
 82                license = lib.licenses.mit;
 83                maintainers = with lib.maintainers; [ spacefrogg ];
 84              };
 85            })) {};
 86            any-sync-node = final.callPackage ({
 87              lib, buildGoModule, fetchFromGitHub,
 88            }: buildGoModule (finalAttrs: {
 89              pname = "any-sync-node";
 90              version = "0.10.5";
 91              src = fetchFromGitHub {
 92                owner = "anyproto";
 93                repo = "any-sync-node";
 94                tag = "v${finalAttrs.version}";
 95                hash = "sha256-NJ/3B7PtgLx0bOFh7xm2q5FrDsYT9Le1RYM14fCeEn8=";
 96              };
 97              vendorHash = "sha256-0tfhELqnhqeuwJn7iDYmL440iVMtCmbH7lqPG0D1s08=";
 98              meta = {
 99                description = "Any-sync node";
100                homepage = "https://anytype.io";
101                license = lib.licenses.mit;
102                maintainers = with lib.maintainers; [ spacefrogg ];
103              };
104            })) {};
105  
106            any-sync-filenode = final.callPackage ({
107              lib, buildGoModule, fetchFromGitHub,
108            }: buildGoModule (finalAttrs: {
109              pname = "any-sync-filenode";
110              version = "0.10.6";
111              src = fetchFromGitHub {
112                owner = "anyproto";
113                repo = "any-sync-filenode";
114                tag = "v${finalAttrs.version}";
115                hash = "sha256-ethdUxBwB/TCoi6L3fo46hRv4XBTog/BmErjIl1eHvw=";
116              };
117              vendorHash = "sha256-1jPByu4NGnBNWnSVevq/I9KmX9xYjBk9SKLpIKjr9u0=";
118              doCheck = false; # need network
119              meta = {
120                description = "Any-sync file node";
121                homepage = "https://anytype.io";
122                license = lib.licenses.mit;
123                maintainers = with lib.maintainers; [ spacefrogg ];
124              };
125            })) {};
126  
127            any-sync-consensusnode = final.callPackage ({
128              lib, buildGoModule, fetchFromGitHub,
129            }: buildGoModule (finalAttrs: {
130              pname = "any-sync-consensusnode";
131              version = "0.6.2";
132              src = fetchFromGitHub {
133                owner = "anyproto";
134                repo = "any-sync-consensusnode";
135                tag = "v${finalAttrs.version}";
136                hash = "sha256-ABlcnmH4l8TliFnRBjxAR4Ke9LlmeqhBL0Gj2Ci0jnc=";
137              };
138              vendorHash = "sha256-9kpnf4KimW/jZWR1AbrE8NzsYEAPZ24aTQfOei5XLAY=";
139              doCheck = false; # need network
140              meta = {
141                description = "Any-sync consensus node";
142                homepage = "https://anytype.io";
143                license = lib.licenses.mit;
144                maintainers = with lib.maintainers; [ spacefrogg ];
145              };
146            })) {};
147          };
148        };
149        perSystem = { config, self', inputs', pkgs, system, ... }: {
150          _module.args.pkgs = import inputs.nixpkgs {
151            inherit system;
152            overlays = [ self.overlays.redis ];
153          };
154          packages = {
155  
156            any-sync-consensusnode = pkgs.any-sync-consensusnode;
157            any-sync-coordinator = pkgs.any-sync-coordinator;
158            any-sync-filenode = pkgs.any-sync-filnode;
159            any-sync-node = pkgs.any-sync-node;
160            any-sync-tools = pkgs.any-sync-tools;
161            redisbloom = pkgs.redisbloom;
162          };
163        };
164      });
165  }