diff options
author | Emile <git@emile.space> | 2023-10-31 20:03:19 +0100 |
---|---|---|
committer | Emile <git@emile.space> | 2023-10-31 20:03:19 +0100 |
commit | 392a7db129387fb2ca8846f7486cfb1b08e721d7 (patch) | |
tree | 31440941474e2c4152eef378df00f11926cbd9d7 /wyze.nix |
initial commit
Diffstat (limited to 'wyze.nix')
-rw-r--r-- | wyze.nix | 40 |
1 files changed, 40 insertions, 0 deletions
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 + ''; +} |