Git Product home page Git Product logo

nixos-pi-hole's Introduction

nixos-pi-hole

An example to run pi-hole with docker in a Raspberry Pi device (arm based device).
Refer to NixOS arm documentation for boards' specifications.

The following documentation will build a NixOS image to write on a SD card for targetted devices (arm / aarch64).
pi-hole will be setup through Docker and docker-compose.

Example has been tested on a Raspberry Pi 4 (4GB) and a Raspberry Pi Zero 2 WH.

important notes

  • ensure that no sensitive data (e.g credentials) are passed and store into /nix/store.
  • update the default user password with sudo passwd $USER_NAME


installation

build and write image

# example variables

### the SD card /dev/ path
SD_CARD='/dev/sda'

### the image name (output after step 1)
IMAGE_NAME='nixos-sd-image-...-linux.img'

1. update variables in configuration.nix (system configuration) and docker.nix (containers)

2. build the image from ./configuration.nix

export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1

nix-build '<nixpkgs/nixos>' -A config.system.build.sdImage -I nixos-config=./configuration.nix

Some read-only permission may occur.
Copy the result/sd-image/${IMAGE_NAME}.zst file to another location if this happens.

cp "result/sd-image/${IMAGE_NAME}.zst" /path/to/new/location/

cd /path/to/new/location/

3. de-compress the .img.zst output file

unzstd -d "${IMAGE_NAME}.zst"

4. write .img to SD card

# write to sd card
sudo dd if=$IMAGE_NAME of=$SD_CARD bs=4096 conv=fsync status=progress

5. mount the card on the target device

6. update nix-channel

By default nix-channel is not updated.
This may cause issue such as nixpkgs or $NIX_PATH not found though already set.

Following may be run:

sudo -i nix-channel --update

run pi-hole

1. adjust files in ./pi-hole directory

2. upload / copy ./pi-hole directory to the target host

3. run docker-compose up -d to start the pi-hole container



docker

docker and docker-compose are setup as root (to change).

Files may be copied over via e.g scp or additional nix tools may be used (e.g oci-containers, arion).

The current example uses oci-containers to run pi-hole as a service.

See NixOS Docker documentation.


pi-hole

change password

docker exec -it pi-hole /bin/bash

#
pihole -a -p


documentation and links

nixos-pi-hole's People

Contributors

jimj92120 avatar

Watchers

 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.