From 66b4decdd14efcbcc83b49f7ffd7009003236481 Mon Sep 17 00:00:00 2001 From: jolheiser Date: Fri, 8 Sep 2023 15:24:52 +0000 Subject: [PATCH] feat: devbox (#572) This PR adds a [devbox](https://www.jetpack.io/devbox/) config to the repo. This may be beneficial to anyone interested in nix but doesn't want to deal with the language, or anyone interested in an easy way to start development for `tea`. With `devbox` installed, `devbox shell` should drop you into a shell with `go 1.20.x`, `gopls` (language server), and `make` for build targets available. I didn't want to duplicate all of our Makefile, but I did add a single script `devbox run build` because it also has the packages above available, so at the very least a user with `devbox` should be able to build the project. We don't have CGO, so nothing extra should be required that I can think of, and our linters are invoked via `go run` so they should also work since the `go` package would be available. ----- As a quick note, I am more familiar with nix itself than I am with devbox, but I think this could potentially help anyone wanting to quickly contribute. If you want to get really meta and are a nix user, you could even run `nix run nixpkgs#devbox shell` to drop into the shell. Another alternative would be to write an actual flake with a devShell, however I think `devbox` is a nice in-between. Anyone comfortable with nix can probably whip up a dev environment fairly easily without `devbox`. Co-authored-by: techknowlogick Reviewed-on: https://gitea.com/gitea/tea/pulls/572 Co-authored-by: jolheiser Co-committed-by: jolheiser --- devbox.json | 15 +++++++++++++++ devbox.lock | 23 +++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 devbox.json create mode 100644 devbox.lock diff --git a/devbox.json b/devbox.json new file mode 100644 index 0000000..feb9147 --- /dev/null +++ b/devbox.json @@ -0,0 +1,15 @@ +{ + "packages": [ + "go@1.20", + "gopls@latest", + "gnumake@latest" + ], + "shell": { + "init_hook": [ + "echo 'Welcome to tea. Check out the Makefile for runnable targets.'" + ], + "scripts": { + "build": "make" + } + } +} diff --git a/devbox.lock b/devbox.lock new file mode 100644 index 0000000..f39999e --- /dev/null +++ b/devbox.lock @@ -0,0 +1,23 @@ +{ + "lockfile_version": "1", + "packages": { + "gnumake@latest": { + "last_modified": "2023-08-30T00:25:28Z", + "resolved": "github:NixOS/nixpkgs/a63a64b593dcf2fe05f7c5d666eb395950f36bc9#gnumake", + "source": "devbox-search", + "version": "4.4.1" + }, + "go@1.20": { + "last_modified": "2023-08-30T00:25:28Z", + "resolved": "github:NixOS/nixpkgs/a63a64b593dcf2fe05f7c5d666eb395950f36bc9#go", + "source": "devbox-search", + "version": "1.20.7" + }, + "gopls@latest": { + "last_modified": "2023-08-30T00:25:28Z", + "resolved": "github:NixOS/nixpkgs/a63a64b593dcf2fe05f7c5d666eb395950f36bc9#gopls", + "source": "devbox-search", + "version": "0.13.2" + } + } +}