Skip to content

Commit 4d6df40

Browse files
feat: add nix support
feat: add nix support
1 parent eb0d5ad commit 4d6df40

File tree

6 files changed

+135
-0
lines changed

6 files changed

+135
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ go.work.sum
2929
# vim auto backup file
3030
*~
3131
!OWNERS
32+
33+
# Nix specific files when running 'nix build'
34+
result

default.nix

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{ pkgs ? import <nixpkgs> {} }:
2+
3+
pkgs.buildGoModule rec {
4+
name = "goctl";
5+
version = "1.8.3";
6+
7+
src = pkgs.fetchFromGitHub {
8+
owner = "zeromicro";
9+
repo = "go-zero";
10+
tag = "v${version}";
11+
hash = "sha256-v5WzqMotF9C7i9hTYSjaPmTwveBVDVn+SKQXYuS4Rdc=";
12+
};
13+
14+
vendorHash = "sha256-tOIlfYiAI9m7oTZyPDCzTXg9XTwBb6EOVLzDfZnzL4E=";
15+
16+
modRoot = "tools/goctl";
17+
subPackages = [ "." ];
18+
19+
ldflags = [
20+
"-s"
21+
"-w"
22+
];
23+
24+
meta = {
25+
description = "CLI handcuffle of go-zero, a cloud-native Go microservices framework";
26+
longDescription = ''
27+
goctl is a go-zero's built-in handcuffle that is a major
28+
lever to increase development efficiency, generating code,
29+
document, deploying k8s yaml, dockerfile, etc.
30+
'';
31+
license = pkgs.lib.licenses.mit;
32+
homepage = "https://go-zero.dev";
33+
mainProgram = "goctl";
34+
};
35+
}

flake.lock

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
description = "goctl's nix flake";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs";
6+
utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { nixpkgs, utils, ... }:
10+
utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = import nixpkgs { inherit system; };
13+
defaultPkg = pkgs.callPackage ./default.nix {
14+
inherit pkgs;
15+
};
16+
in {
17+
devShells.default = pkgs.mkShell {
18+
packages = with pkgs; [
19+
# Development tools
20+
go
21+
22+
# Aux tools
23+
goreleaser
24+
];
25+
};
26+
27+
packages = {
28+
default = defaultPkg;
29+
};
30+
});
31+
}

readme-cn.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ GO111MODULE=on GOPROXY=https://goproxy.cn/,direct go get -u github.com/zeromicro
117117

118118
# For Mac
119119
brew install goctl
120+
121+
# For nix user
122+
nix profile install 'github:zeromicro/go-zero'
120123

121124
# docker for all platforms
122125
docker pull kevinwan/goctl

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ go get -u github.com/zeromicro/go-zero
124124
# For Mac
125125
brew install goctl
126126

127+
# For nix user
128+
nix profile install 'github:zeromicro/go-zero'
129+
127130
# docker for all platforms
128131
docker pull kevinwan/goctl
129132
# run goctl

0 commit comments

Comments
 (0)