Skip to content

Commit 9b25a2b

Browse files
author
Daniils Petrovs
committed
Add nix
1 parent 448210b commit 9b25a2b

File tree

2 files changed

+49
-2
lines changed

2 files changed

+49
-2
lines changed

README.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
## Setup
1515

16-
### Build & Install
16+
### Manual install
1717

1818
Make sure you have `go` and `make` installed, then run
1919

@@ -28,6 +28,17 @@ Optionally install ZSH completions with:
2828
make completions.zsh
2929
```
3030

31+
### With Nix
32+
33+
Clone this repository and run
34+
35+
```bash
36+
nix-build
37+
nix profile install ./result
38+
```
39+
40+
### Configuration
41+
3142
`zube` expects a configuration file with your **client_id**.
3243
`zube` looks for this configuration file, in order, in:
3344

@@ -106,7 +117,7 @@ Read [CONTRIBUTING](CONTRIBUTING.md)
106117
- [ ] Filter support by name instead of just by IDs
107118
- [ ] Optionally dump response data as JSON
108119
- [ ] `zubed` daemon for periodic update polling
109-
- [ ] Move `zube` functionality into dedicated `zube-go` library
120+
- [x] Move `zube` functionality into dedicated `zube-go` library
110121
- Internal
111122
- [x] request caching
112123
- [ ] smart automatic auth using browser cookie store access

default.nix

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
with import <nixpkgs> { };
2+
3+
buildGoModule rec {
4+
pname = "zube-cli";
5+
version = "0.3.3";
6+
binary = "zube";
7+
8+
src = fetchFromGitHub {
9+
owner = "platogo";
10+
repo = "zube-cli";
11+
rev = "${version}";
12+
hash = "sha256-tF4cxqZ/9I+USrUxmGeRc7VxnPVr4vrObmXthYGNDoA=";
13+
};
14+
15+
vendorHash = "sha256-CZHEYjy1oL4ns0MEDE3JxDfeUoTaX+JZktB0EpqVIPk=";
16+
17+
ldflags =
18+
[ "-s" "-w" "-X main.Version=${version}" "-X main.Commit=${version}" ];
19+
20+
meta = with lib; {
21+
description = "Simple command-line snippet manager, written in Go";
22+
homepage = "https://github.com/platogo/zube-cli";
23+
license = licenses.gpl3;
24+
maintainers = with maintainers; [ danirukun ];
25+
};
26+
27+
installPhase = ''
28+
runHook preInstall
29+
install -D $GOPATH/bin/${pname} $out/bin/zube # Rename binary here
30+
runHook postInstall
31+
'';
32+
33+
checkPhase = ''
34+
make test
35+
'';
36+
}

0 commit comments

Comments
 (0)