Sandboxes

Sandboxes / starters for different languages

It is useful for skipping most of the set-up phase ⏩ to :

  • do a kata / exercise πŸ₯‹
  • start a project πŸ—οΈ
  • test something in an isolated environment 🧫

What is in the box ? πŸ“¦

  • With a focus on reproducibility built with nix

    It is possible to use it without Nix, but reproducibility cannot be guaranteed as you may have installed an incompatible version

  • Always with sample code 🧩

  • Always with tests πŸ§ͺ

  • Trying to use standard tools depending on the ecosystem 🧰

  • Trying to have a formatter πŸͺ„

  • Trying to have a linter πŸ”Ž

Usage

Online with GitPod

Open in Gitpod

On you own machine

Requirements

List sandboxes

export NIX_CONFIG='extra-experimental-features = flakes nix-command'
nix run 'gitlab:pinage404/nix-sandboxes'

Get one sandbox

e.g. for Rust

export NIX_CONFIG='extra-experimental-features = flakes nix-command'
nix run 'gitlab:pinage404/nix-sandboxes' rust ./your_new_project_directory

Optional steps

VSCode

If you want to use VSCode

  1. Install VSCode

  2. Open from the command line in the folder

    code .
    
  3. Install recommanded extensions

Cache

To avoid rebuilding things that have already been built elsewhere, use Cachix

  1. Install Cachix

  2. Use Nix's cache

    cachix use pinage404-nix-sandboxes
    

Baby steps

If you want to use git-gamble : a tool that blends TDD (Test Driven Development) + TCR (test && commit || revert) to make sure to develop the right thing 😌, baby step by baby step πŸ‘ΆπŸ¦Ά

The tool is already included right out of the box, and tests should pass

git gamble --pass

C with formatting and test

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#c" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn C in Y Minutes

Awesome C

Unity testing framework


Read code on GitLab

Clojure with formatting, linting and test

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#clojure" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn Clojure in Y Minutes

Awesome Clojure

Awesome ClojureScript


Read code on GitLab

Common Lisp with formatting and test

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#common_lisp" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn Common Lisp in Y Minutes

Awesome Common Lisp

FiveAM

FiveAM-Matchers


Read code on GitLab

C++ with formatting and test

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#cpp" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn C++ in Y Minutes

Awesome C++


Read code on GitLab

ELM with formatting, linting and test

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#elm" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn Elm in Y Minutes

Awesome Elm


Read code on GitLab

Erlang with formatting and test

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#erlang" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn Erlang in Y Minutes

Awesome Erlang


Read code on GitLab

Forth with test

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#forth" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn Forth in Y Minutes

Awesome Forth

Gforth cheat sheet

GForth

Forth Foundation Library


Read code on GitLab

F# with format, lint and test

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

nix flake new --template "gitlab:pinage404/nix-sandboxes#fsharp" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn F# in Y Minutes

Awesome F#


Read code on GitLab

Go with formatting and test

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#go" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn Go in Y Minutes

Awesome Go


Read code on GitLab

Haskell with formatting, linting and test

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#haskell" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn Haskell in Y Minutes

Awesome Haskell

Hoogle


Read code on GitLab

Nix with formatting, linting and test

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#nix" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn Nix in Y Minutes

Awesome Nix

Noogle


Read code on GitLab

PHP with linting and test

Depfu


Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#php" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn PHP in Y Minutes

Awesome PHP

Learn Composer in Y Minutes

Awesome Composer


Read code on GitLab

Prolog with test

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#prolog" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn Prolog in Y Minutes

Awesome Prolog


Read code on GitLab

Python with formatting, typing and test

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#python" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn Python in Y Minutes

Awesome Python

Awesome Python Typing


Read code on GitLab

Roc lang

Roc is under construction, not even in alpha stage. It's an attempt to create a backend language inspired by the simplicity of Elm.

There is currently no editor, syntax highlighter or language server. The coffee script highlighter works a little.

You can checkout the tutorial

Use this template

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#roc" ./your_new_project_directory

Available commands

Or just execute

mask help

Roc Documentation


Read code on GitLab

Rockstar with snapshot testing

Also known as Golden Master Testing

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#rockstar" ./your_new_project_directory

Available commands

Or just execute

mask help

Rockstar

Tutorial

Documentation

Esolang wiki


Read code on GitLab

Ruby with test

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#ruby" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn Ruby in Y Minutes

Awesome Ruby

Learn Ruby ecosystem in Y Minutes


Read code on GitLab

Rust with formatting, linting and test

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#rust" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn Rust in Y Minutes

Awesome Rust

Roogle


Read code on GitLab

Bash with formatting, linting and test

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#shell" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn Bash in Y Minutes

Awesome Shell


Read code on GitLab

Small wrapper for snapshot testing

Also known as Golden Master Testing

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#snapshot_testing" ./your_new_project_directory

In .envrc change the SNAPSHOT_TEST_COMMAND with your actual test command

export SNAPSHOT_TEST_COMMAND="sh ./bin/hello" # change this

Available commands

Or just execute

mask help

Amesome Testing


Read code on GitLab

Typescript

There is several Typescript sandboxes because they use different runtime nor test frameworks

TypeScript with formatting and test on Bun

Depfu


Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#typescript_bun" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn JavaScript in Y Minutes

Learn TypeScript in Y Minutes

Awesome Bun

Awesome Node.JS not Bun but still accurate

Awesome JavaScript


Read code on GitLab

TypeScript with formatting, linting and test on Deno

Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#typescript_deno" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn JavaScript in Y Minutes

Learn TypeScript in Y Minutes

Awesome Deno

Awesome Node.JS not Deno but still accurate

Awesome JavaScript


Read code on GitLab

TypeScript with formatting and test with Jest on NodeJS

Depfu


Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#typescript_node_jest" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn JavaScript in Y Minutes

Learn TypeScript in Y Minutes

Awesome Node.JS

Awesome JavaScript


Read code on GitLab

TypeScript with formatting and test with Vitest on NodeJS

Depfu


Open in Gitpod

⚠️ Gitpod will open the root folder

Due to some limitations of Gitpod, we cannot simply open a sub-folder

Opening in Gitpod will open the root folder

Two terminals will be opened :

  1. the first in the root folder
  2. the second in the target folder

Both terminals automatically load the environment of their current folder

Screenshot of Gitpod showing two terminals open, the second being open in the target folder

Or with Nix

NIX_CONFIG="extra-experimental-features = flakes nix-command" \
nix flake new --template "gitlab:pinage404/nix-sandboxes#typescript_node_vitest" ./your_new_project_directory

Available commands

Or just execute

mask help

Learn JavaScript in Y Minutes

Learn TypeScript in Y Minutes

Awesome Node.JS

Awesome JavaScript


Read code on GitLab

Tool comparison table

Give Love ❀️ nor Give Feedbacks πŸ—£οΈ

Do you like this project ?

Contributing

Any contributions (feedback, bug report, merge request ...) are welcome

Adding a language

Commit message format

Commit message should be <language>: <a descriptive message>

  • prefix your commit with
    • <language>: the name of the folder
    • all: when (almost) every languages are touched
    • meta: when it is about the project itself
    • base: when it touch the root folder

Steps

  1. copy an existing folder (e.g. shell)
  2. name the folder with the language
  3. adapt it
    • in <language>/flake.nix, in the packages, add every dependencies needed
    • mask <target> must return 0 code on success, non 0 on fail
    • complete the <language>/maskfile.md with
      • mask test
      • mask lint if possible
      • mask format if possible
      • mask run if possible
        • mask run should display Hello world
        • mask run --name foo should display Hello foo
      • mask install if there is specific steps to do manually such as pulling dependencies
      • mask update if there is specific steps to update the language and dependencies
    • in <language>/.config/git/hooks/pre-gamble, keep
      1. mask format if possible
      2. mask lint if possible
    • in <language>/flake.nix, change the description
    • in <language>/README.md, change the title
    • in <language>/README.md, change <language>
      • in the URL
      • in the flake command
  4. add an usage example of the language
    • using TDD
    • hello without argument or an optionnal (none) or empty string (depending on the language possibility) should output Hello world
    • hello with foo argument as string should output Hello foo
    • if you are a beginner with this language you may need to look at help with language
  5. in flake.nix, in the templates section, add the new template
  6. in .gitlab-ci.yml, in the LANGUAGE list, add the new language

Put the same description in

  • flake.nix's description
  • <language>/flake.nix's description
  • <language>/README.md title

VSCode support

  • in <language>/.vscode/extension.json, add needed extensions

Document it

  • in .docs/tool_comparison_table.md table, add a row for the new language

  • add a symbolic link between the <language>/README.md and the documentation

    ln -s ../../<language>/README.md ./.docs/sandboxes/<language>.md
    
  • in .docs/SUMMARY.md, add a markdwon link to ./sandboxes/<language>.md

Exercices / Katas

List of exercices / katas

Help with languages

List of tools to help writing in some language

Others Bootstraps

List of alternatives bootstraps / setup / template with more languages