This project consists of a portable development environment. Its purpose is to provide a manner to access your development environment in any operational system that supports docker and docker-compose without much effort or configuration.
- Docker
- Docker Compose
- If you're using Wayland, you'll need XWayland.
Git
- Lazygit
- GitHub CLI
Shell
- Fish
- Nix
- Tmux
- Direnv
-
Grant that the
~/Documents/Programming/
directory exists. -
Clone this repository inside
~/Documents/Programming/
. -
Grant run permission to the
init.sh
file usingchmod +x init.sh
. -
Add the following alias to your shell
Bash
alias devE="~/Documents/Programming/dockerized-dev-environment/init.sh"
-
Run the
devE build
command. You'll need to execute this command only to build your container. You must usedevE
to start the environment.
-
Make a directory inside the
~/Documents/Programming
. -
Create a
.envrc
file with the following content:use nix ./shell.nix
-
Create a
shell.nix
file with the following content:{ pkgs ? import <nixpkgs> {} }: let sharedNixShellConfig = import ~/.config/nix/default-shell.nix { inherit pkgs; }; in pkgs.mkShell { buildInputs = sharedNixShellConfig.buildInputs ++ [ # Declare here the packages to install pkgs.packageName ]; # Declare here the commands that the shell must run on start-up shellHook = '' ${sharedNixShellConfig.shellHook} ''; # Declare here your environment variables. Declare the variables like the example below TESTE = "some_value"; }
-
Run
direnv allow
inside the project directory to allow Direnv automatically start the environment. -
The environment will be loaded every time you enter the project directory and unloaded when you exit it.
The Emacs uses the LSP Bridge package. The LSP is enabled only inside a development environment because nix-shell has the package dependencies. Use the packages from one of the configurations below in your shell.nix inside your project directory based on the programming language that you're using.
{ pkgs ? import <nixpkgs> {} }:
let
sharedNixShellConfig = import ~/.config/nix/default-shell.nix { inherit pkgs; };
in
pkgs.mkShell {
buildInputs = sharedNixShellConfig.buildInputs ++ [
pkgs.elixir
pkgs.elixir-ls
# Declare here the packages to install
pkgs.packageName
];
# Declare here the commands that the shell must run on start-up
shellHook = ''
${sharedNixShellConfig.shellHook}
'';
# Declare here your environment variables. Declare the variables like the example below
TESTE = "some_value";
}
{ pkgs ? import <nixpkgs> {} }:
let
sharedNixShellConfig = import ~/.config/nix/default-shell.nix { inherit pkgs; };
in
pkgs.mkShell {
buildInputs = sharedNixShellConfig.buildInputs ++ [
pkgs.pyright
# Declare here the packages to install
pkgs.packageName
];
# Declare here the commands that the shell must run on start-up
shellHook = ''
${sharedNixShellConfig.shellHook}
'';
# Declare here your environment variables. Declare the variables like the example below
TESTE = "some_value";
}
{ pkgs ? import <nixpkgs> {} }:
let
sharedNixShellConfig = import ~/.config/nix/default-shell.nix { inherit pkgs; };
in
pkgs.mkShell {
buildInputs = sharedNixShellConfig.buildInputs ++ [
pkgs.nodePackages.typescript-language-server
pkgs.vscode-langservers-extracted
# Declare here the packages to install
pkgs.packageName
];
# Declare here the commands that the shell must run on start-up
shellHook = ''
${sharedNixShellConfig.shellHook}
'';
# Declare here your environment variables. Declare the variables like the example below
TESTE = "some_value";
}