Skip to content

Commit

Permalink
Add nix
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniils Petrovs committed Feb 9, 2024
1 parent 448210b commit 9b25a2b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

## Setup

### Build & Install
### Manual install

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

Expand All @@ -28,6 +28,17 @@ Optionally install ZSH completions with:
make completions.zsh
```

### With Nix

Clone this repository and run

```bash
nix-build
nix profile install ./result
```

### Configuration

`zube` expects a configuration file with your **client_id**.
`zube` looks for this configuration file, in order, in:

Expand Down Expand Up @@ -106,7 +117,7 @@ Read [CONTRIBUTING](CONTRIBUTING.md)
- [ ] Filter support by name instead of just by IDs
- [ ] Optionally dump response data as JSON
- [ ] `zubed` daemon for periodic update polling
- [ ] Move `zube` functionality into dedicated `zube-go` library
- [x] Move `zube` functionality into dedicated `zube-go` library
- Internal
- [x] request caching
- [ ] smart automatic auth using browser cookie store access
36 changes: 36 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
with import <nixpkgs> { };

buildGoModule rec {
pname = "zube-cli";
version = "0.3.3";
binary = "zube";

src = fetchFromGitHub {
owner = "platogo";
repo = "zube-cli";
rev = "${version}";
hash = "sha256-tF4cxqZ/9I+USrUxmGeRc7VxnPVr4vrObmXthYGNDoA=";
};

vendorHash = "sha256-CZHEYjy1oL4ns0MEDE3JxDfeUoTaX+JZktB0EpqVIPk=";

ldflags =
[ "-s" "-w" "-X main.Version=${version}" "-X main.Commit=${version}" ];

meta = with lib; {
description = "Simple command-line snippet manager, written in Go";
homepage = "https://github.com/platogo/zube-cli";
license = licenses.gpl3;
maintainers = with maintainers; [ danirukun ];
};

installPhase = ''
runHook preInstall
install -D $GOPATH/bin/${pname} $out/bin/zube # Rename binary here
runHook postInstall
'';

checkPhase = ''
make test
'';
}

0 comments on commit 9b25a2b

Please sign in to comment.