feat(packages): add miraclecast

This commit is contained in:
Alexandre Cavalheiro S. Tiago da Silva 2025-03-07 22:43:15 -03:00
parent cf1eae0829
commit e72b1b1230
Signed by: wizardlink
GPG key ID: A5767B54367CFBDF
3 changed files with 100 additions and 0 deletions

View file

@ -73,6 +73,7 @@
formatter."${system}" = pkgs.nixfmt-rfc-style;
packages."${system}" = {
miraclecast = pkgs.callPackage ./packages/miraclecast.nix { };
wb32dfu-udev-rules = pkgs.callPackage ./packages/wb32dfu-udev-rules { };
};

View file

@ -18,6 +18,14 @@ This package installs the udev rules necessary to allow flashing QMK/Vial onto k
It is meant to be used in tandem with [NixOS] using the
[`services.udev.packages`](https://search.nixos.org/options?query=services.udev.packages) configuration.
## [miraclecast](https://github.com/albfan/miraclecast/)
This is a suite of programs that allows you to connect external monitors through Wi-Fi, though unfortunately some of the
programs have no documentation and some an unhelpful help command too.
Currently the **package is available in [nixpkgs]** __however it currently fails to compile__, so you have to rely on my
configuration of this package or wait for [nixpkgs#387762](https://github.com/NixOS/nixpkgs/pull/387762) to be merged.
<!-- REFERENCES -->
[nixpkgs]: https://github.com/NixOS/nixpkgs/

91
packages/miraclecast.nix Normal file
View file

@ -0,0 +1,91 @@
{
lib,
fetchFromGitHub,
glib,
gst_all_1,
iproute2,
libtool,
makeBinaryWrapper,
meson,
miraclecast,
ninja,
pkg-config,
readline,
stdenv,
systemdLibs,
testers,
udev,
wpa_supplicant,
relyUdev ? true,
}:
let
gstreamerPluginPaths = lib.concatMapStrings (pth: pth + "/lib/gstreamer-1.0:") [
(lib.getLib gst_all_1.gstreamer)
gst_all_1.gst-libav
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
];
in
stdenv.mkDerivation {
pname = "miraclecast";
version = "1.0-unstable-2024-07-13";
src = fetchFromGitHub {
owner = "albfan";
repo = "miraclecast";
rev = "937747fd4de64a33bccf5adb73924c435ceb821b";
hash = "sha256-y37+AOz8xYjtDk9ITxMB7UeWeMpDH+b6HQBczv+x5zo=";
};
nativeBuildInputs = [
makeBinaryWrapper
meson
ninja
pkg-config
];
buildInputs = [
glib
gst_all_1.gstreamer
iproute2
libtool
readline
systemdLibs
udev
wpa_supplicant
];
mesonFlags =
[
"-Dbuild-tests=true"
"-Dip-binary=${iproute2}/bin/ip"
]
++ lib.optionals relyUdev [
"-Drely-udev=true"
];
postPatch = ''
substituteInPlace res/miracle-gst \
--replace-fail "/usr/bin/gst-launch-1.0" "${gst_all_1.gstreamer}/bin/gst-launch-1.0"
'';
postInstall = ''
wrapProgram $out/bin/miracle-gst --set GST_PLUGIN_SYSTEM_PATH_1_0 ${gstreamerPluginPaths}
'';
passthru.tests.version = testers.testVersion {
package = miraclecast;
command = "miracled --version";
version = "Miraclecast 1";
};
meta = with lib; {
description = "Connect external monitors to your system via Wifi-Display specification also known as Miracast";
homepage = "https://github.com/albfan/miraclecast";
license = licenses.lgpl21Plus;
maintainers = [ maintainers.wizardlink ];
platforms = platforms.linux;
};
}