From 65175b5e919813b4c1410f1abbc67185e71c783f Mon Sep 17 00:00:00 2001 From: bruwbird Date: Tue, 31 Dec 2024 15:27:03 +0900 Subject: [PATCH] other: configuration for devcontainer - Add .devcontainer/devcontainer.json for setting up a development environment using Visual Studio Code and devcontainers. - Update README.md with instructions on how to use the devcontainer for development. - Include .envrc file to use nix flakes. [skip ci] --- .devcontainer/devcontainer.json | 25 +++++++++++++++++++++++++ .envrc | 1 + README.md | 10 ++++++++++ 3 files changed, 36 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .envrc diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..9d593bab --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/go +{ + "name": "peerswap", + "image": "mcr.microsoft.com/devcontainers/go:dev-1.22", + "features": { + "ghcr.io/devcontainers/features/nix:1": {}, + "ghcr.io/devcontainers-contrib/features/direnv:1": {} + }, + "postCreateCommand": "echo 'experimental-features = nix-command flakes' | sudo tee -a /etc/nix/nix.conf > /dev/null && nix-env -iA nixpkgs.nixpkgs-fmt && nix-env -iA cachix -f https://cachix.org/api/v1/install", // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "jnoortheen.nix-ide", + "mkhl.direnv" + ] + } + }, + "containerEnv": { + "RUN_INTEGRATION_TESTS": "1", + "hardeningDisable": "all", + "GOROOT": "", + "CACHIX_AUTH_TOKEN": "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJmNTg3ZjViZi00ZWJiLTRhYmQtYmYzOC0xYzFlZGE3ZGE4NTQiLCJzY29wZXMiOiJjYWNoZSJ9.pzmsXqBwHFAExdVFhbdrtN1mpc4h3U3JWnej7PC-NAA" + } +} \ No newline at end of file diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..3550a30f --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/README.md b/README.md index 6aeaedda..afce4934 100644 --- a/README.md +++ b/README.md @@ -110,3 +110,13 @@ For a LND Bitcoin signet / Liquid testnet setup guide see this [guide](./docs/si ### Development PeerSwap uses the [nix](https://nixos.org/download.html) package manager for a simple development environment. In order to start hacking, install nix, [golang](https://golang.org/doc/install) and run `nix-shell`. This will fetch all dependencies (except golang). + +#### Using Devcontainer + +To use devcontainer for development, follow these steps: + +1. Install [Visual Studio Code](https://code.visualstudio.com/) and the [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension. +2. Open the PeerSwap repository in Visual Studio Code. +3. When prompted to reopen the repository in a container, click "Reopen in Container". +4. The development environment will be set up automatically inside the container. +5. Hit `direnv allow`.