Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flake: init #276

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

flake: init #276

wants to merge 1 commit into from

Conversation

nbsp
Copy link
Member

@nbsp nbsp commented Jan 7, 2024

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.

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.

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 https://codeberg.org/pronounscc/pronouns.cc/src/branch/main/Makefile)
- gomod2nix.toml needs to be updated every time go.mod is touched:
  e.g. on module add or update.
@CLAassistant
Copy link

CLAassistant commented Jan 7, 2024

CLA assistant check
All committers have signed the CLA.

nbsp added a commit to nbsp/livekit that referenced this pull request Jan 8, 2024
Adds a Nix flake for development and building, which replicates the
functionality of the magefile. The devShell provides the necessary tools
to immediately hack on the project, namely Go and an LSP for editor
integration.

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 https://codeberg.org/pronounscc/pronouns.cc/src/branch/main/Makefile)
- gomod2nix.toml needs to be updated every time go.mod is touched:
  e.g. on module add or update.

References: livekit/livekit-cli#276
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants