From 392a7db129387fb2ca8846f7486cfb1b08e721d7 Mon Sep 17 00:00:00 2001 From: Emile Date: Tue, 31 Oct 2023 20:03:19 +0100 Subject: initial commit --- wyze.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 wyze.nix (limited to 'wyze.nix') diff --git a/wyze.nix b/wyze.nix new file mode 100644 index 0000000..830e873 --- /dev/null +++ b/wyze.nix @@ -0,0 +1,40 @@ +{ attrs, pkgs, ... }: + +pkgs.stdenv.mkDerivation { + name = attrs.name; + version = attrs.version; + + src = pkgs.fetchurl { + url = "https://download.wyzecam.com/firmware/${attrs.basePath}/${attrs.version}.zip"; + hash = attrs.hash; + }; + + phases = [ + "unpackPhase" + "buildPhase" + ]; + + nativeBuildInputs = with pkgs; [ unzip ]; + + unpackPhase = if + pkgs.lib.hasPrefix "wco_cam_sd" attrs.version + || pkgs.lib.hasPrefix "wco_cam_v2_sd" attrs.version + then '' + unzip -d $out $src + '' else '' + unzip -d $out $src + gzip -d $out/*.tar.gz + ''; + + buildPhase = if + pkgs.lib.hasPrefix "wco_cam_sd" attrs.version + || pkgs.lib.hasPrefix "wco_cam_v2_sd" attrs.version + then '' + ls -l $out/sd_update + ls -1 $out/sd_update| xargs -I {} file $out/sd_update/{} > $out/info.txt + '' else '' + tar -xvf $out/*.tar --directory $out + ls -l $out/fw_file + find $out/| xargs -I {} file $out/fw_file/{} > $out/info.txt + ''; +} -- cgit 1.4.1