nixpkgs/pkgs/misc/moonfire-nvr/default.nix

82 lines
1.8 KiB
Nix
Raw Normal View History

2023-07-13 09:51:28 +00:00
{ lib
, rustPlatform
, buildNpmPackage
, fetchFromGitHub
, pkg-config
, ncurses
, sqlite
, testers
, moonfire-nvr
}:
let
pname = "moonfire-nvr";
2023-08-04 07:24:48 +00:00
version = "0.7.7";
2023-07-13 09:51:28 +00:00
src = fetchFromGitHub {
owner = "scottlamb";
repo = "moonfire-nvr";
rev = "v${version}";
2023-08-04 07:24:48 +00:00
hash = "sha256-+7VahlS+NgaO2knP+xqdlZnNEfjz8yyF/VmjWf77KXI=";
2023-07-13 09:51:28 +00:00
};
ui = buildNpmPackage {
inherit version src;
pname = "${pname}-ui";
sourceRoot = "${src.name}/ui";
2023-07-13 09:51:28 +00:00
npmDepsHash = "sha256-IpZWgMo6Y3vRn9h495ifMB3tQxobLeTLC0xXS1vrKLA=";
2023-08-04 07:24:48 +00:00
installPhase = ''
2023-07-13 09:51:28 +00:00
runHook preInstall
cp -r build $out
runHook postInstall
2023-08-04 07:24:48 +00:00
'';
2023-07-13 09:51:28 +00:00
};
in rustPlatform.buildRustPackage {
inherit pname version src;
sourceRoot = "${src.name}/server";
2023-07-13 09:51:28 +00:00
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
2023-08-04 07:24:48 +00:00
"coded-0.2.0-pre" = "sha256-ICDvLFCsiPCzAzf3nrRhH/McNPVQz1+uVOmj6Uc5teg=";
2023-07-13 09:51:28 +00:00
"hashlink-0.8.1" = "sha256-h7DEapTVy0SSTaOV9rCkdH3em4A9+PS0k1QQh1+0P4c=";
"mp4-0.9.2" = "sha256-mJZJDzD8Ep9c+4QusyBtRoqAArHK9SLdFxG1AR7JydE=";
};
};
nativeBuildInputs = [
pkg-config
];
buildInputs = [
ncurses
sqlite
];
postInstall = ''
mkdir -p $out/lib/ui
ln -s ${ui} $out/lib/ui
'';
doCheck = false;
passthru = {
inherit ui;
tests.version = testers.testVersion {
inherit version;
package = moonfire-nvr;
command = "moonfire-nvr --version";
};
};
meta = with lib; {
description = "Moonfire NVR, a security camera network video recorder";
homepage = "https://github.com/scottlamb/moonfire-nvr";
changelog = "https://github.com/scottlamb/moonfire-nvr/releases/tag/v${version}";
license = licenses.gpl3Only;
maintainers = with maintainers; [ gaelreyrol ];
2023-11-23 21:09:35 +00:00
mainProgram = "moonfire-nvr";
2023-07-13 09:51:28 +00:00
};
}