Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ go.work.sum
# vim auto backup file
*~
!OWNERS

# Nix specific files when running 'nix build'
result
35 changes: 35 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{ pkgs ? import <nixpkgs> {} }:

pkgs.buildGoModule rec {
name = "goctl";
version = "1.8.3";

src = pkgs.fetchFromGitHub {
owner = "zeromicro";
repo = "go-zero";
tag = "v${version}";
hash = "sha256-v5WzqMotF9C7i9hTYSjaPmTwveBVDVn+SKQXYuS4Rdc=";
};

vendorHash = "sha256-tOIlfYiAI9m7oTZyPDCzTXg9XTwBb6EOVLzDfZnzL4E=";

modRoot = "tools/goctl";
subPackages = [ "." ];

ldflags = [
"-s"
"-w"
];

meta = {
description = "CLI handcuffle of go-zero, a cloud-native Go microservices framework";
longDescription = ''
goctl is a go-zero's built-in handcuffle that is a major
lever to increase development efficiency, generating code,
document, deploying k8s yaml, dockerfile, etc.
'';
license = pkgs.lib.licenses.mit;
homepage = "https://go-zero.dev";
mainProgram = "goctl";
};
}
60 changes: 60 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
description = "goctl's nix flake";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
utils.url = "github:numtide/flake-utils";
};

outputs = { nixpkgs, utils, ... }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
defaultPkg = pkgs.callPackage ./default.nix {
inherit pkgs;
};
in {
devShells.default = pkgs.mkShell {
packages = with pkgs; [
# Development tools
go

# Aux tools
goreleaser
];
};

packages = {
default = defaultPkg;
};
});
}
3 changes: 3 additions & 0 deletions readme-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ GO111MODULE=on GOPROXY=https://goproxy.cn/,direct go get -u github.com/zeromicro

# For Mac
brew install goctl

# For nix user
nix profile install 'github:zeromicro/go-zero'

# docker for all platforms
docker pull kevinwan/goctl
Expand Down
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ go get -u github.com/zeromicro/go-zero
# For Mac
brew install goctl

# For nix user
nix profile install 'github:zeromicro/go-zero'

# docker for all platforms
docker pull kevinwan/goctl
# run goctl
Expand Down