Skip to content

cameronraysmith/nixpod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

nixpod home

Nix Flakes Ready

tl;dr

Using nix, home-manager, and nixpkgs dockerTools, nixpod provides a containerized or containerizable drop-in user configuration on any platform where the nix package manager is already, or can be, installed. This is intended to include, but is not limited to, scenarios like those involving kubernetes ephemeral containers via images like netshoot, which might be used for debugging purposes adjacent to otherwise minimal container images. See the github packages associated to this repository for the containers currently built in the nixpod CID.

This repository originally contained a nix flake that essentially integrated 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 want to look there.

Testing

Note

This repository previously supported building containers exclusively via Containerfiles. Currently it uses pkgs.dockerTools and the Containerfiles are only retained for comparison. Other excellent tools for building container images with nix that may be supported in the future are nix2container and nix-snapshotter.

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