Compare commits

...

7 Commits

Author SHA1 Message Date
74e41de9d6 Enable unify v8 service
All checks were successful
Check Flake / check-flake (push) Successful in 56s
2024-05-26 17:24:46 -06:00
0bf0b8b88b Enable ollama service 2024-05-26 17:24:07 -06:00
702129d778 Enable CUDA support 2024-05-26 17:23:38 -06:00
88c67dde84 Open C&C ports 2024-05-26 17:21:58 -06:00
8e3a0761e8 Clean up 2024-05-26 17:21:34 -06:00
a785890990 Fix esphome so that it can build again 2024-05-26 17:20:05 -06:00
b482a8c106 Restore frigate functionality by reverting to an older tensorflow version for libedgetpu 2024-05-26 17:16:59 -06:00
9 changed files with 110 additions and 41 deletions

View File

@ -35,11 +35,6 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# boot.initrd.luks.devices.${cfg.device.name} = {
# device = cfg.device.path;
# allowDiscards = cfg.device.allowDiscards;
# };
# Unlock LUKS disk over ssh # Unlock LUKS disk over ssh
boot.initrd.network.enable = true; boot.initrd.network.enable = true;
boot.initrd.kernelModules = cfg.kernelModules; boot.initrd.kernelModules = cfg.kernelModules;

17
flake.lock generated
View File

@ -215,6 +215,22 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs-frigate": {
"locked": {
"lastModified": 1695825837,
"narHash": "sha256-4Ne11kNRnQsmSJCRSSNkFRSnHC4Y5gPDBIQGjjPfJiU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5cfafa12d57374f48bcc36fda3274ada276cf69e",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5cfafa12d57374f48bcc36fda3274ada276cf69e",
"type": "github"
}
},
"nixpkgs-xone-fix": { "nixpkgs-xone-fix": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -276,6 +292,7 @@
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-frigate": "nixpkgs-frigate",
"nixpkgs-xone-fix": "nixpkgs-xone-fix", "nixpkgs-xone-fix": "nixpkgs-xone-fix",
"radio": "radio", "radio": "radio",
"radio-web": "radio-web", "radio-web": "radio-web",

View File

@ -1,6 +1,7 @@
{ {
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
nixpkgs-frigate.url = "github:NixOS/nixpkgs/5cfafa12d57374f48bcc36fda3274ada276cf69e";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
@ -82,6 +83,7 @@
src = nixpkgs; src = nixpkgs;
patches = [ patches = [
./patches/gamepadui.patch ./patches/gamepadui.patch
./patches/esphome.patch
inputs.nixpkgs-xone-fix inputs.nixpkgs-xone-fix
]; ];
}; };
@ -123,7 +125,7 @@
"aarch64-linux"."iso" = mkIso "aarch64-linux"; "aarch64-linux"."iso" = mkIso "aarch64-linux";
}; };
overlays.default = import ./overlays; overlays.default = import ./overlays { inherit inputs; };
nixosModules.kernel-modules = import ./overlays/kernel-modules; nixosModules.kernel-modules = import ./overlays/kernel-modules;
deploy.nodes = deploy.nodes =

View File

@ -5,6 +5,8 @@
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
nixpkgs.config.cudaSupport = true;
# for luks onlock over tor # for luks onlock over tor
services.tor.enable = true; services.tor.enable = true;
services.tor.client.enable = true; services.tor.client.enable = true;

View File

@ -218,6 +218,7 @@
4534 4534
8097 8097
9091 9091
8443 # unifi
]; ];
virtualisation.oci-containers.backend = "podman"; virtualisation.oci-containers.backend = "podman";
@ -227,5 +228,11 @@
configFile = ./dashy.yaml; configFile = ./dashy.yaml;
}; };
services.unifi = {
enable = true;
openFirewall = true;
unifiPackage = pkgs.unifi8;
};
boot.binfmt.emulatedSystems = [ "aarch64-linux" "armv7l-linux" ]; boot.binfmt.emulatedSystems = [ "aarch64-linux" "armv7l-linux" ];
} }

View File

@ -3,6 +3,40 @@
let let
frigateHostname = "frigate.s0"; frigateHostname = "frigate.s0";
frigatePort = 61617; frigatePort = 61617;
mkEsp32Cam = address: {
ffmpeg = {
input_args = "";
inputs = [{
path = address;
roles = [ "detect" "record" ];
}];
output_args.record = "-f segment -pix_fmt yuv420p -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v libx264 -preset ultrafast -an ";
};
rtmp.enabled = false;
snapshots = {
enabled = true;
bounding_box = true;
};
record = {
enabled = true;
retain.days = 10; # Keep video for 10 days
events.retain = {
default = 30; # Keep video with detections for 30 days
mode = "active_objects";
};
};
detect = {
enabled = true;
width = 800;
height = 600;
fps = 10;
};
objects = {
track = [ "person" ];
};
};
in in
{ {
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
@ -21,40 +55,7 @@ in
host = "localhost:1883"; host = "localhost:1883";
}; };
cameras = { cameras = {
dahlia-cam = { dahlia-cam = mkEsp32Cam "http://dahlia-cam.lan:8080";
ffmpeg = {
input_args = "";
inputs = [{
path = "http://dahlia-cam.lan:8080";
roles = [ "detect" "record" ];
}];
output_args.record = "-f segment -pix_fmt yuv420p -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v libx264 -preset ultrafast -an ";
};
rtmp.enabled = false;
snapshots = {
enabled = true;
bounding_box = true;
};
record = {
enabled = false;
retain.days = 0; # To not retain any recording if there is no detection of any events
events.retain = {
default = 3; # To retain recording for 3 days of only the events that happened
mode = "active_objects";
};
};
detect = {
enabled = true;
width = 800;
height = 600;
fps = 20;
};
objects = {
track = [ "dog" ];
filters.dog.threshold = 0.4;
};
};
}; };
# ffmpeg = { # ffmpeg = {
# hwaccel_args = "preset-vaapi"; # hwaccel_args = "preset-vaapi";

View File

@ -96,4 +96,14 @@
spotify spotify
retroarchFull retroarchFull
]; ];
# Command and Conquer Ports
networking.firewall.allowedUDPPorts = [ 4321 27900 ];
networking.firewall.allowedTCPPorts = [ 6667 28910 29900 29920 ];
nixpkgs.config.rocmSupport = true;
services.ollama = {
enable = true;
acceleration = "rocm";
};
} }

View File

@ -1,6 +1,22 @@
{ inputs }:
final: prev: final: prev:
let
system = prev.system;
frigatePkgs = inputs.nixpkgs-frigate.legacyPackages.${system};
in
{ {
libedgetpu = prev.callPackage ./libedgetpu { }; # It seems that libedgetpu needs to be built with the newer version of tensorflow in nixpkgs
# but I am lazy so I instead just downgrade by using the old nixpkgs
libedgetpu = frigatePkgs.callPackage ./libedgetpu { };
frigate = frigatePkgs.frigate;
actual-server = prev.callPackage ./actualbudget { }; actual-server = prev.callPackage ./actualbudget { };
unifi8 = prev.unifi.overrideAttrs (oldAttrs: rec {
version = "8.1.113";
src = prev.fetchurl {
url = "https://dl.ui.com/unifi/8.1.113/unifi_sysvinit_all.deb";
sha256 = "1knm+l8MSb7XKq2WIbehAnz7loRPjgnc+R98zpWKEAE=";
};
});
} }

19
patches/esphome.patch Normal file
View File

@ -0,0 +1,19 @@
diff --git a/pkgs/tools/misc/esphome/default.nix b/pkgs/tools/misc/esphome/default.nix
index a8ab91f8f329..81bf135a023f 100644
--- a/pkgs/tools/misc/esphome/default.nix
+++ b/pkgs/tools/misc/esphome/default.nix
@@ -5,6 +5,7 @@
, platformio
, esptool
, git
+, stdenv
}:
let
@@ -76,6 +77,7 @@ python.pkgs.buildPythonApplication rec {
# git is used in esphomeyaml/writer.py
"--prefix PATH : ${lib.makeBinPath [ platformio esptool git ]}"
"--prefix PYTHONPATH : $PYTHONPATH" # will show better error messages
+ "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}"
"--set ESPHOME_USE_SUBPROCESS ''"
];