mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-07 21:47:02 +09:00
add a sample flake.nix
- takes protoc-gen-gogofaster from anyproto, marshall-append - drpc is already turned into flake by drpc author, just take the flake with the same version from go.mod
This commit is contained in:
parent
089c39e95c
commit
23c2665fce
5 changed files with 182 additions and 3 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -32,3 +32,7 @@ db
|
|||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
|
||||
# Add "use flake" in .envrc to get shell automatically with direnv+nix
|
||||
/.envrc
|
||||
/.direnv/
|
||||
|
|
5
Makefile
5
Makefile
|
@ -1,6 +1,5 @@
|
|||
.PHONY: proto test deps mocks
|
||||
export GOPRIVATE=github.com/anyproto
|
||||
export PATH:=deps:$(PATH)
|
||||
|
||||
all:
|
||||
@set -e;
|
||||
|
@ -35,7 +34,7 @@ proto-execute:
|
|||
mocks:
|
||||
echo 'Generating mocks...'
|
||||
go build -o deps go.uber.org/mock/mockgen
|
||||
PATH=$(CURDIR)/deps:$(PATH) go generate ./...
|
||||
go generate ./...
|
||||
|
||||
deps:
|
||||
go mod download
|
||||
|
@ -47,4 +46,4 @@ test:
|
|||
|
||||
replace-gogo-strings:
|
||||
@echo "Replacing 'github.com/gogo/protobuf' with 'github.com/anyproto/protobuf' in all files recursively..."
|
||||
LC_CTYPE=C LANG=C find . -type f -name "*.go" | xargs sed -i '' "s|github.com/gogo/protobuf|github.com/anyproto/protobuf|g"
|
||||
LC_CTYPE=C LANG=C find . -type f -name "*.go" | xargs sed -i "s|github.com/gogo/protobuf|github.com/anyproto/protobuf|g"
|
||||
|
|
126
flake.lock
generated
Normal file
126
flake.lock
generated
Normal file
|
@ -0,0 +1,126 @@
|
|||
{
|
||||
"nodes": {
|
||||
"drpc": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710270657,
|
||||
"narHash": "sha256-hjb+8iB0HTdAYtsOvr6gY2yhwdg2NLUqQRVJi4qMmJI=",
|
||||
"owner": "storj",
|
||||
"repo": "drpc",
|
||||
"rev": "a5d487af8ae33deb7913b0f7c06b2c7ec7cd4dcc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "storj",
|
||||
"ref": "v0.0.34",
|
||||
"repo": "drpc",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"revCount": 92,
|
||||
"type": "tarball",
|
||||
"url": "https://api.flakehub.com/f/pinned/numtide/flake-utils/0.1.92%2Brev-b1d9ab70662946ef0850d488da1c9019f3a9752a/018e2ca5-e5a2-7f80-9261-445a8cecd4d7/source.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://flakehub.com/f/numtide/flake-utils/%2A.tar.gz"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1710162809,
|
||||
"narHash": "sha256-i2R2bcnQp+85de67yjgZVvJhd6rRnJbSYNpGmB6Leb8=",
|
||||
"rev": "ddcd7598b2184008c97e6c9c6a21c5f37590b8d2",
|
||||
"revCount": 556648,
|
||||
"type": "tarball",
|
||||
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2311.556648%2Brev-ddcd7598b2184008c97e6c9c6a21c5f37590b8d2/018e3162-e13b-7219-a0b5-da03bcc09ecc/source.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://flakehub.com/f/NixOS/nixpkgs/%2A.tar.gz"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1741173522,
|
||||
"narHash": "sha256-k7VSqvv0r1r53nUI/IfPHCppkUAddeXn843YlAC5DR0=",
|
||||
"rev": "d69ab0d71b22fa1ce3dbeff666e6deb4917db049",
|
||||
"revCount": 762848,
|
||||
"type": "tarball",
|
||||
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.762848%2Brev-d69ab0d71b22fa1ce3dbeff666e6deb4917db049/0195698a-02df-791f-8cd3-d10c16d442f0/source.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"drpc": "drpc",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
35
flake.nix
Normal file
35
flake.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
description = "";
|
||||
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
inputs.drpc.url = "github:storj/drpc/v0.0.34";
|
||||
|
||||
outputs = { self, nixpkgs, drpc, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config = { allowUnfree = true; };
|
||||
};
|
||||
|
||||
any-protoc-gen-gogofaster = pkgs.callPackage ./nix/any-protoc-gen-gogofaster.nix {};
|
||||
protoc-gen-go-drpc = drpc.defaultPackage.${system};
|
||||
in {
|
||||
devShell = pkgs.mkShell {
|
||||
name = "any-sync";
|
||||
nativeBuildInputs = [
|
||||
# our forked proto generator
|
||||
any-protoc-gen-gogofaster
|
||||
|
||||
# drpc generator
|
||||
protoc-gen-go-drpc
|
||||
|
||||
pkgs.go_1_23
|
||||
# pkgs.gox
|
||||
pkgs.protobuf3_21
|
||||
pkgs.pkg-config
|
||||
pkgs.pre-commit
|
||||
# todo: govvv, not packaged
|
||||
];
|
||||
};
|
||||
});
|
||||
}
|
15
nix/any-protoc-gen-gogofaster.nix
Normal file
15
nix/any-protoc-gen-gogofaster.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
pkgs.buildGoModule rec {
|
||||
pname = "protoc-gen-gogofaster";
|
||||
name = pname;
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "anyproto";
|
||||
repo = "protobuf";
|
||||
rev = "marshal-append";
|
||||
hash = "sha256-TetJNcPn0/2Dym/JOLczGax4BEnsLKvJtTZIv1mTMdc=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-nOL2Ulo9VlOHAqJgZuHl7fGjz/WFAaWPdemplbQWcak=";
|
||||
|
||||
doCheck = false;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue