Giter Club home page Giter Club logo

dev-container's Introduction

dev-container

A devcontainer built on Debian and powered by Nix.

Features

Quickstart

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.

Usage

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.

Tooling

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.

Testing

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.

Contributing

Check out the issues for items needing attention or submit your own and then:

  1. Fork the repo (https://github.com/jmgilman/dev-container/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

dev-container's People

Contributors

jmgilman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.