> ## Content Index
> Fetch the complete content index at: https://blog.matthewbrunelle.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Building a Better Dog Camera Part 1 - Raspberry Pi with NixOS
- URL: https://blog.matthewbrunelle.com/building-a-better-dog-camera-part-1-raspberry-pi-with-nixos/
- Published: 2026-09-15T11:38:25.000Z
- Updated: 2026-09-15T11:38:25.000Z
- Author: Matthew Brunelle
- Tags: NixOS, Raspberry-pi, Self-hosting

I'll say up top that this part was unfinished before I moved on to my second attempt. So think of this more as a collection of notes rather than complete instructions.

#### On this page

Last year I wrote about [self hosting dog cameras using Frigate](https://blog.matthewbrunelle.com/self-hosting-a-dog-camera-for-away-from-home-monitoring/). At the time I was using a TP-Link Tapo camera and had to write a whole section on securing the cameras by firewalling them off from the internet.

I've been longing for a solution where that wasn't needed. Then Benn Jordan had a video on the [security risk of cameras](https://www.youtube.com/watch?v=UMIwNiwQewQ&ref=blog.matthewbrunelle.com):

> Maybe you should just have a realistic discussion with your family members about the risks you’ve just heard about versus the odds that cameras would actually be useful to you... but if you ask me my opinion, with the way that we seem to be plunging into authoritarianism and considering the sad state of cybersecurity, I’d say that having a cloud-connected camera from a tech conglomerate makes you significantly less safe.

He also suggests if you still feel you need a camera to feel safe you can get an offline model that writes encrypted files to an SD card. I think that's a well balanced approach.

My use case is a little different though, since I don't want cameras outside, and I am not trying to protect my house. I want dog cameras inside to check on my elderly dog when I am away. Like that one time we caught her taking a poop inside. So I unfortunately need something that can be accessed remotely. What I would love is a camera you do not have to firewall, put on a dedicated VLAN, block DNS, etc.

---

## A first attempt: Hand rolling a camera with a RPi

When you boil it down, a dog camera is just a small computer with a camera attached. If I build one myself, then I can avoid the camera phoning home. In my hubris I thought, "How hard could that be?"

I wanted to put something together using commodity parts. Even after the price increases Raspberry Pis are still pretty affordable. I am also fortunate to have a Micro Center near me and they sell them at MSRP if you're buying just one. The price goes up fast when you buy multiple to deter scalpers.

I could just plug a USB webcam in and set up some remote access. I already have one running [BirdNet Go](https://blog.matthewbrunelle.com/birdnet-go-but-we-have-bird-monitoring-at-home/). There are even the various Pi Camera modules that are specced so that the Pi can handle them.

I wanted something small so I went to buy a Raspberry Pi Zero 2w and a Pi Camera 3 NoIR Wide. However, they were actually out of the 2w, so I had to go with a 1GB RPi 4\. The 2gb was also out of stock and who wants to pay $100 for a 4gb. Plus, if I could get everything working on 1gb that would be a big win for others that might want to try.

Oh, and there are also printable [camera mounts](https://www.printables.com/model/368788-raspberry-pi-camera-mount-camera-module-3-version?ref=blog.matthewbrunelle.com) available.

---

## Building a custom image with NixOS

The NixOS wiki has a general [page on the Raspberry Pi](https://nixos.wiki/wiki/NixOS%5Fon%5FARM/Raspberry%5FPi?ref=blog.matthewbrunelle.com), plus a page specifically for the [Pi 4](https://nixos.wiki/wiki/NixOS%5Fon%5FARM/Raspberry%5FPi%5F4?ref=blog.matthewbrunelle.com). You can write the configuration on your desktop and generate an image you can flash.

The examples they provide use nix channels and I wanted to use flakes instead:

```nix
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
    nixos-hardware.url = "github:NixOS/nixos-hardware";
  };

  outputs = { self, nixpkgs, nixos-hardware, ... }: {
    nixosConfigurations.camera = nixpkgs.lib.nixosSystem {
      system = "aarch64-linux";
      modules = [
        "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
        nixos-hardware.nixosModules.raspberry-pi-4
        ./configuration.nix
      ];
    };
  };
}

```

Most of the configuration is pretty standard:

- Enable Tailscale.
- Enable ssh
- Disable bluetooth
- Enable swap

However, there are some specific changes for this project.

Rather than use the [camera section](https://nixos.wiki/wiki/NixOS%5Fon%5FARM/Raspberry%5FPi?ref=blog.matthewbrunelle.com#Camera) on the wiki I used the nixos-hardware overlay:

```nix
hardware.raspberry-pi."4" = {
apply-overlays-dtmerge.enable = lib.mkDefault true;
};
  
hardware.deviceTree.overlays = [
    {
      name = "imx708";
      dtboFile = "${pkgs.raspberrypifw}/share/raspberrypi/boot/overlays/imx708.dtbo";
    }
  ];
  
boot.kernelPackages = pkgs.linuxPackages_rpi4;

```

Then I set up the user in the `video` group:

```nix
  users.users.camera = {
    isNormalUser = true;
    extraGroups = [ "video" "wheel" ];
  };

```

Finally, I generate the image to flash:

```nix
  sdImage.compressImage = true;
  sdImage.imageName = "rpi4-camera.img";

```

The last piece is to set up go2rtc for streaming for the camera, but I got distracted by another option.

---

## Then deciding to try out Secluso

I'll talk about this in more detail in part 2 (TBD), but I came across a project called [Secluso](https://secluso.com/?ref=blog.matthewbrunelle.com) that was aiming to provide a secure and private camera using Pi parts. I decided to can this work and see if I could contribute my time to that project instead. That would mean dropping NixOS, but I would rather work with a group of people on something like this.