A devcontainer built on Debian and powered by Nix.
- Based on the stable Debian slim image
- Includes the Nix package manager
- Provides a rich zsh experience
- Packaged with modern tooling (i.e. fzf, ripgrep, etc.)
- Focused on reproducible development environments using Nix flakes.
Create a .devcontainer.json
at the root of your repository with the following
contents:
{
"image": "jmgilman/dev-container:v1",
"mounts": [
"source=jmgilman-dev,target=/nix,type=volume",
"source=jmgilman-dev-ext,target=/home/vscode/.vscode-server/extensions,type=volume",
"source=jmgilman-dev-extin,target=/home/vscode/.vscode-server-insiders/extensions,type=volume"
],
"remoteUser": "vscode",
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/home/vscode/.nix-profile/bin/zsh"
}
}
}
}
Omitting anything from the above example is not recommended. The environment makes use of a variety of tools including Oh-My-Zsh and direnv, both of which rely on the terminal settings above being configured correctly. The mounted volume names should be changed to reflect your repository name.
The container utilizes the common Nix development practice of using direnv with
a Nix flake. Your repository root should contain a .envrc
file:
use flake
Along with a flake.nix
file:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
in {
devShell = pkgs.mkShell {
packages = [
pkgs.hello
];
};
}
);
}
Once the container is loaded, opening up a new shell instance will drop you at the root of the repository and direnv will automatically load into the configured Nix development environment.
See the examples directory for more examples. For more detailed information, see the getting started guide.
THe following tools are packaged with the container:
Name | Description | Source |
---|---|---|
bat |
A cat(1) clone with wings | Link |
batman |
Read system manual pages using bat |
Link |
diff-so-fancy |
Good-lookin' diffs | Link |
direnv |
unclutter your .profile | Link |
fd |
A simple, fast and user-friendly alternative to find |
Link |
fzf |
A command-line fuzzy finder | Link |
gh |
Github's official command line tool | Link |
jq |
Command-line JSON processor | Link |
ripgrep |
A modern replacement to grep |
Link |
tldr |
Collaborative cheatsheets for console commands | Link |
Additional required tools should be included in your flake.nix
. The default
container user has sudo
privileges if modifications are required.
You can run test/run.sh
to run a rudimentary smoketest on the container. The
test ensures that the image builds and the environment is configured as
expected.
Check out the issues for items needing attention or submit your own and then:
- Fork the repo (https://github.com/jmgilman/dev-container/fork)
- Create your feature branch (git checkout -b feature/fooBar)
- Commit your changes (git commit -am 'Add some fooBar')
- Push to the branch (git push origin feature/fooBar)
- Create a new Pull Request