Skip to content
Merged
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@ result
result-*
.direnv/
.nix-*

# Archlinux build artifacts
/pkg/
/src/
*.pkg.tar.*
*.tar.gz
26 changes: 25 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,28 @@ man:
# Maintanence targets
.PHONY: clean
clean:
rm -rf bin coverage.out
rm -rf \
bin coverage.out result result-* tldr .SRCINFO \
pkg/ src/ *.pkg.tar.* *.pkg.tar.zst *.tar.gz \
*.log *.sig *-debug* .goreleaser-dist dist/

# Release targets
.PHONY: pkgsums
pkgsums:
updpkgsums

.PHONY: pkgbuild
pkgbuild:
makepkg --syncdeps --cleanbuild

.PHONY: nixbuild
nix-build:
nix build

.PHONY: nixcheck
nix-check:
nix flake check

.PHONY: nixupdate
nix-update:
nix flake update
31 changes: 31 additions & 0 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Maintainer: TheRootDaemon <harsha.manjula.venkataramanan@gmail.com>

pkgname=tlgc
pkgver=1.0.0
pkgrel=1
pkgdesc="A tldr client written in Go"
arch=('x86_64' 'aarch64')
url="https://github.com/TheRootDaemon/tlgc"
license=('MIT')
depends=()
makedepends=('go')
source=("$pkgname-$pkgver.tar.gz::https://github.com/TheRootDaemon/tlgc/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('4da677a05956869b5bab353d459eb46c3b918c220f6f7efb4dac66e0127f2d82')

build() {
cd "$pkgname-$pkgver"
export CGO_ENABLED=0
go build -trimpath \
-ldflags "-s -w -X github.com/TheRootDaemon/tlgc/version.Version=$pkgver" \
-o tldr ./cmd/tldr
}

package() {
cd "$pkgname-$pkgver"
install -Dm755 tldr "$pkgdir/usr/bin/tldr"
install -Dm644 tldr.1 "$pkgdir/usr/share/man/man1/tldr.1"
install -Dm644 completions/tldr.bash "$pkgdir/usr/share/bash-completion/completions/tldr"
install -Dm644 completions/tldr.fish "$pkgdir/usr/share/fish/vendor_completions.d/tldr.fish"
install -Dm644 completions/_tldr "$pkgdir/usr/share/zsh/site-functions/_tldr"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
59 changes: 58 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,64 @@ A [tldr](https://github.com/tldr-pages/tlgc) client written in Go.

Download the archive for your platform from the [releases page](https://github.com/TheRootDaemon/tlgc/releases).

### Using Go
### Homebrew

Install `tlgc` by adding a tap:

```sh
brew tap therootdaemon/tlgc && brew install tlgc
```

### Nix

Install tlgc using Nix:

```nix
nix profile install github:TheRootDaemon/tlgc
```

Run tlgc without installing it (ephemeral):

```nix
nix run github:TheRootDaemon/tlgc -- --help
```

Use it in your existing flake:

```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
tlgc.url = "github:TheRootDaemon/tlgc";
};

outputs = { nixpkgs, tlgc, ... }: {
nixosConfigurations.host = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";

modules = [
({ pkgs, ... }: {
environment.systemPackages = [
tlgc.packages.${pkgs.stdenv.hostPlatform.system}.default
];
})
];
};
};
}
```

To use it along with your `home-manager`:

```nix
{ inputs, pkgs, ... }: {
home.packages = [
inputs.tlgc.packages.${pkgs.stdenv.hostPlatform.system}.default
];
}
```

### Go

```sh
# This just installs the binary.
Expand Down
Loading