From a4ae6d9832f2b9689706221004d30a864d12da3b Mon Sep 17 00:00:00 2001 From: Eduardo Robles Date: Sun, 23 Jul 2023 06:33:42 +0000 Subject: [PATCH] WIP --- .devcontainer.json | 12 ------- .devcontainer/devcontainer.json | 40 ++++++++++++++++++++++ .devcontainer/docker-compose.yml | 12 +++++++ devenv.lock | 59 ++++++++++++++++++++++++++++++-- devenv.nix | 3 ++ devenv.yaml | 7 ++++ 6 files changed, 118 insertions(+), 15 deletions(-) delete mode 100644 .devcontainer.json create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/docker-compose.yml diff --git a/.devcontainer.json b/.devcontainer.json deleted file mode 100644 index 75b8759..0000000 --- a/.devcontainer.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "customizations": { - "vscode": { - "extensions": [ - "mkhl.direnv" - ] - } - }, - "image": "ghcr.io/cachix/devenv:latest", - "overrideCommand": false, - "updateContentCommand": "devenv ci" -} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..1f4b8b1 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,40 @@ +{ + "name": "backend-services", + "dockerComposeFile": "docker-compose.yml", + "service": "devcontainer", + "forwardPorts": [], + "workspaceFolder": "/workspace", + + "userEnvProbe": "loginShell", + "updateRemoteUserUID": false, + + "updateContentCommand": "devenv ci", + + "customizations": { + "vscode": { + "extensions": [ + // run commands on save + // https://marketplace.visualstudio.com/items?itemName=fsevenm.run-it-on + "fsevenm.run-it-on", + + // Docker for Visual Studio Code + "ms-azuretools.vscode-docker", + + // direnv support + "mkhl.direnv", + + // Nix language support + "jnoortheen.nix-ide", + + // Markdown support and previsualization + "yzhang.markdown-all-in-one", + + // Debugging + "vadimcn.vscode-lldb", + + // Allows to use Alt+Q (or Option+Q in mac) to rewrap lines + "stkb.rewrap" + ] + } + } +} diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 0000000..ddb6a3e --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,12 @@ +version: "3.6" +services: + dev: + image: ghcr.io/cachix/devenv:latest + volumes: + - ../../:/workspaces:cached + - /var/run/docker.sock:/var/run/docker-host.sock + # Required for ptrace-based debuggers like C++, Go, and Rust + cap_add: + - SYS_PTRACE + security_opt: + - label:disable diff --git a/devenv.lock b/devenv.lock index 7472bfb..00db773 100644 --- a/devenv.lock +++ b/devenv.lock @@ -50,6 +50,21 @@ } }, "flake-utils": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { "inputs": { "systems": "systems" }, @@ -66,7 +81,7 @@ "type": "indirect" } }, - "flake-utils_2": { + "flake-utils_3": { "inputs": { "systems": "systems_2" }, @@ -105,6 +120,42 @@ "type": "github" } }, + "mk-shell-bin": { + "locked": { + "lastModified": 1677004959, + "narHash": "sha256-/uEkr1UkJrh11vD02aqufCxtbF5YnhRTIKlx5kyvf+I=", + "owner": "rrbutani", + "repo": "nix-mk-shell-bin", + "rev": "ff5d8bd4d68a347be5042e2f16caee391cd75887", + "type": "github" + }, + "original": { + "owner": "rrbutani", + "repo": "nix-mk-shell-bin", + "type": "github" + } + }, + "nix2container": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1688922987, + "narHash": "sha256-RnQwrCD5anqWfyDAVbfFIeU+Ha6cwt5QcIwIkaGRzQw=", + "owner": "nlewo", + "repo": "nix2container", + "rev": "ab381a7d714ebf96a83882264245dbd34f0a7ec8", + "type": "github" + }, + "original": { + "owner": "nlewo", + "repo": "nix2container", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1689935543, @@ -124,7 +175,7 @@ "nixpkgs-python": { "inputs": { "flake-compat": "flake-compat", - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "nixpkgs": "nixpkgs_2" }, "locked": { @@ -176,7 +227,7 @@ "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_3", "gitignore": "gitignore", "nixpkgs": [ "nixpkgs" @@ -200,6 +251,8 @@ "root": { "inputs": { "devenv": "devenv", + "mk-shell-bin": "mk-shell-bin", + "nix2container": "nix2container", "nixpkgs": "nixpkgs", "nixpkgs-python": "nixpkgs-python", "pre-commit-hooks": "pre-commit-hooks" diff --git a/devenv.nix b/devenv.nix index e896151..14dc88b 100644 --- a/devenv.nix +++ b/devenv.nix @@ -9,6 +9,9 @@ pkgs.git pkgs.ack + # to create containers + pkgs.docker + # used for building uwsgi: pkgs.gcc pkgs.libffi diff --git a/devenv.yaml b/devenv.yaml index a32e623..ae10034 100644 --- a/devenv.yaml +++ b/devenv.yaml @@ -3,3 +3,10 @@ inputs: url: github:NixOS/nixpkgs/nixpkgs-unstable nixpkgs-python: url: github:cachix/nixpkgs-python + nix2container: + url: github:nlewo/nix2container + inputs: + nixpkgs: + follows: nixpkgs + mk-shell-bin: + url: github:rrbutani/nix-mk-shell-bin \ No newline at end of file