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.
- Host: GitHub
- URL: https://github.com/aloshy-ai/nixcontainer
- Owner: aloshy-ai
- Created: 2025-01-26T14:36:32.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-03-09T15:16:43.000Z (9 months ago)
- Last Synced: 2025-03-09T15:18:55.096Z (9 months ago)
- Topics: devbox, devcontainer, direnv, nix, nix-flakes
- Language: Nix
- Homepage:
- Size: 65.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NIXCONTAINER
[](https://aloshy.ai)
[](https://github.com/aloshy-ai/nixcontainer)
[](https://github.com/aloshy-ai/nixcontainer/actions)
[](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 -->