An open API service indexing awesome lists of open source software.

https://github.com/aloshy-ai/nixcontainer

A minimalist nix flake enabled devcontainer image with Devbox and Direnv.
https://github.com/aloshy-ai/nixcontainer

devbox devcontainer direnv nix nix-flakes

Last synced: 5 months ago
JSON representation

A minimalist nix flake enabled devcontainer image with Devbox and Direnv.

Awesome Lists containing this project

README

          

# NIXCONTAINER

[![](https://img.shields.io/badge/aloshy.🅰🅸-000000.svg?style=for-the-badge)](https://aloshy.ai)
[![Platform](https://img.shields.io/badge/PLATFORM-DOCKER-2496ED.svg?style=for-the-badge&logo=docker)](https://github.com/aloshy-ai/nixcontainer)
[![Build Status](https://img.shields.io/badge/BUILD-PASSING-success.svg?style=for-the-badge&logo=github)](https://github.com/aloshy-ai/nixcontainer/actions)
[![License](https://img.shields.io/badge/LICENSE-MIT-yellow.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)

## Usage

```sh
ghcr.io/aloshy-ai/nixcontainer:latest
```

Add this to your `.devcontainer/devcontainer.json`:

```json
{
"image": "ghcr.io/aloshy-ai/nixcontainer:latest",
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached",
"workspaceFolder": "/workspace"
}
```

The container is configured with `/workspace` as the default working directory and mount point for your project files. This ensures:
- Your local files are mounted into the container at `/workspace`
- VS Code opens directly in your project directory
- All development tools work with the correct file paths

## Getting Started
This project uses [devbox](https://github.com/jetify-com/devbox) to manage its development environment.

Install devbox:
```sh
curl -fsSL https://get.jetpack.io/devbox | bash
```

Start the devbox shell:
```sh
devbox shell
```

Run a script in the devbox environment:
```sh
devbox run
```
## Scripts
Scripts are custom commands that can be run using this project's environment. This project has the following scripts:

* [build](#devbox-run-build)
* [load](#devbox-run-load)
* [push](#devbox-run-push)

## Shell Init Hook
The Shell Init Hook is a script that runs whenever the devbox environment is instantiated. It runs
on `devbox shell` and on `devbox run`.
```sh
gh auth status &>/dev/null || gh auth login
export GITHUB_TOKEN=$(gh auth token)
export GITHUB_USERNAME=$(gh api user | jq -r .login)
echo "▄▀█ █░░ █▀█ █▀ █░█ █▄░█ ░ ▄▀█ █
█▀█ █▄▄ █▄█ ▄█ █▀█ █░▀█ ▄ █▀█ █"
devbox run --list
```

## Packages

* [alejandra@latest](https://www.nixhub.io/packages/alejandra)
* [act@latest](https://www.nixhub.io/packages/act)
* [jq@latest](https://www.nixhub.io/packages/jq)

## Script Details

### devbox run build
```sh
nix build
```
 

### devbox run load
```sh
nix build .#loadImage && ./result/bin/load-image
```
 

### devbox run push
```sh
nix build .#pushToGhcr && GITHUB_USERNAME=$GITHUB_USERNAME GITHUB_TOKEN=$GITHUB_TOKEN ./result/bin/push-to-ghcr
```
 

<!-- gen-readme end -->