Add skycam host
All checks were successful
Check flake / build-amd64-linux (push) Successful in 2m37s

This commit is contained in:
Jordan Holt 2024-08-03 20:11:11 +01:00
parent c589766673
commit f42442dd0e
Signed by: jordan
GPG Key ID: B8CFFF61F1CCF520
5 changed files with 129 additions and 2 deletions

View File

@ -104,6 +104,7 @@
mail = mkNixosSystem { system = "x86_64-linux"; name = "mail"; };
odyssey = mkNixosSystem { system = "x86_64-linux"; name = "odyssey"; };
pi = mkNixosSystem { system = "aarch64-linux"; name = "pi"; extraModules = [ nixos-hardware.nixosModules.raspberry-pi-4 ]; };
skycam = mkNixosSystem { system = "aarch64-linux"; name = "skycam"; extraModules = [ nixos-hardware.nixosModules.raspberry-pi-4 ]; };
vps1 = mkNixosSystem { system = "x86_64-linux"; name = "vps1"; };
};

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, pkgs, ... }:
{
time.timeZone = "Europe/London";
@ -15,7 +15,7 @@
LC_TELEPHONE = "en_GB.UTF-8";
LC_TIME = "en_GB.UTF-8";
};
console.keyMap = "uk";
security.sudo.execWheelOnly = true;

22
hosts/skycam/README.md Normal file
View File

@ -0,0 +1,22 @@
# Skycam
## Overview
Raspberry Pi 4-based webcam
## Specs
* SoC - Broadcom BCM2711
* CPU - ARM Cortex-A72 @ 1.8 GHz
* Memory - 8 GB LPDDR4
### Disks
Device | Partitions _(filesystem, usage)_
--- | ---
SD card | `/dev/mmcblk0` (ext4, NixOS Root)
### Networks
- DHCP on `10.0.1.0/24` subnet.
- Tailscale on `100.64.0.0/10` subnet. FQDN: `skycam.mesh.vimium.net`.
## Devices and connections
- Camera Module 3 with wide-angle lens

71
hosts/skycam/default.nix Normal file
View File

@ -0,0 +1,71 @@
{ config, pkgs, ... }:
{
imports = [
./hardware-configuration.nix
../server.nix
];
hardware = {
raspberry-pi."4" = {
apply-overlays-dtmerge.enable = true;
audio.enable = false;
fkms-3d.enable = true; # VideoCore with 512 MB CMA reservation
tc358743.enable = true; # HDMI-to-CSI-2 converter
xhci.enable = false;
};
firmware = with pkgs; [
firmwareLinuxNonfree
wireless-regdb
];
};
networking = {
hostId = "731d1660";
firewall = {
enable = true;
allowedTCPPorts = [ 8080 ];
allowedUDPPorts = [ 8080 ];
};
};
systemd.services.ustreamer = {
enable = true;
description = "uStreamer service";
unitConfig = {
Type = "simple";
};
serviceConfig = {
ExecStartPre = ''${pkgs.v4l-utils}/bin/v4l2-ctl \
--device=/dev/video0 \
--fix-edid-checksums \
--info-edid
'';
ExecStart = ''${pkgs.unstable.ustreamer}/bin/ustreamer \
--device=/dev/video0 \
--resolution=1280x720 \
--format=uyvy \
--encoder=m2m-image \
--workers=3 \
--persistent \
--dv-timings \
--drop-same-frames=30 \
--host=0.0.0.0 \
--port=8080
'';
};
wantedBy = [ "network-online.target" ];
confinement.mode = "chroot-only";
};
environment.systemPackages = with pkgs; [
git
neovim
libraspberrypi
raspberrypi-eeprom
v4l-utils
unstable.ustreamer
];
system.stateVersion = "24.05";
}

View File

@ -0,0 +1,33 @@
{ config, lib, modulesPath, ... }:
{
imports = [
(modulesPath + "/installer/sd-card/sd-image-aarch64.nix")
];
boot = {
kernelModules = [ "bcm2835-v4l2" ];
loader.raspberryPi.firmwareConfig = ''
start_x=1
gpu_mem=256
'';
supportedFilesystems = lib.mkForce [ "f2fs" "vfat xfs" ];
tmp.cleanOnBoot = true;
};
nixpkgs.overlays = [
(final: super: {
makeModulesClosure = x:
super.makeModulesClosure (x // { allowMissing = true; });
})
];
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
options = [ "noatime" ];
};
};
}