Skip to content

❄️ A portable flake for Nix-based development in OCI containers or on hosts where you cannot necessarily use NixOS ⎈

License

Notifications You must be signed in to change notification settings

cameronraysmith/nixpod-home

nixpod home flake

Nix Flakes Ready

tl;dr

While this repository contains a Nix flake, it essentially integrates a few parts of srid/nixos-config into juspay/nix-dev-home. These were merged upstream in juspay/nix-dev-home#7, so you might prefer to look there.

The intention of this repository is to provide a reasonably ergonomic, if somewhat heavy-handed, drop-in configuration on any platform where the nix package manager is, or can be, installed. This is intended to include applications like kubernetes ephemeral containers via images like netshoot, which might be used for debugging purposes adjacent to otherwise minimal container images.

Testing

Note

This repository also intends to support building containers using pkgs.dockerTools, nix2container, and nix-snapshotter, but here we explain how to build the testing image with a Containerfile.

direnv and dev shell

If you have direnv installed and configured you probably know what to do. If you do not and you would like to use the nix dev shell, which will install just using nix, you can execute nix develop. If the container builder specified in the justfile is already installed on your PATH with necessary daemon running and available,

nix develop
just container_command_type="runflake" container-run

should pull or build the container image in containers/Containerfile.debnix and run the flake in that image. If you want to force a local rebuild run just container-build. Note that just just will print help and you can run just -n <command> first for a dry run. See comments in the justfile for additional details.

macOS

If you have a container image manager compatible with macOS installed, such as docker or rancher desktop, and you prefer not to use the nix dev shell, you can probably (with docker desktop for example)

open -a Docker
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo install just
just container_command_type="runflake" container-run

however, please see rust and just for details if you prefer another installation method like homebrew.

Experimenting

If you want to simply run a distribution of this flake in a container image, you can execute

just container_type="container" container_command="zsh" container-run

docker

If you're using docker as the builder, this will execute a series of commands like

docker pull ghcr.io/cameronraysmith/nixpod:latest
docker run -it --rm ghcr.io/cameronraysmith/nixpod:latest

See the justfile for details.

Acknowledgements