diff --git a/flake.nix b/flake.nix index 0497e4b..b528923 100644 --- a/flake.nix +++ b/flake.nix @@ -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 { }; }; diff --git a/packages/README.md b/packages/README.md index 69f11f9..b72ac1c 100644 --- a/packages/README.md +++ b/packages/README.md @@ -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. + [nixpkgs]: https://github.com/NixOS/nixpkgs/ diff --git a/packages/miraclecast.nix b/packages/miraclecast.nix new file mode 100644 index 0000000..681a386 --- /dev/null +++ b/packages/miraclecast.nix @@ -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; + }; +}