livekit-cli icon indicating copy to clipboard operation
livekit-cli copied to clipboard

flake: init

Open nbsp opened this issue 1 year ago • 1 comments

Adds a Nix flake for development and building, which replicates the functionality of the Makefile. The devShell provides the necessary tools to immediately hack on the project, namely Go and an LSP for editor integration.

Rationales for this:

  • Nix is a very powerful package manager and build system. Using it foregoes the need for keeping track of packages you need for development.
  • NixOS doesn't really do the curl|sh thing. This would allow users of NixOS to use livekit-cli without adding it to nixpkgs, by utilizing flakes.

Usage:

  • nix build to build a binary and write it to result/bin/livekit-cli
  • nix run to immediately build & run the CLI
  • nix develop to enter a devShell with tools in $PATH

Caveats:

  • Uses its own independent version instead of reading version.go. This could be fixed by inferring the version from the git tag and using -X ...=$(git describe --tags --long --always) (see this example)
  • gomod2nix.toml needs to be updated every time go.mod is touched: e.g. on module add or update.

nbsp avatar Jan 07 '24 20:01 nbsp

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jan 07 '24 20:01 CLAassistant