diff --git a/nixos/modules/services/desktops/pipewire/bluez-hardware.conf.json b/nixos/modules/services/desktops/pipewire/bluez-hardware.conf.json deleted file mode 100644 index e5e7517e38d..00000000000 --- a/nixos/modules/services/desktops/pipewire/bluez-hardware.conf.json +++ /dev/null @@ -1,250 +0,0 @@ -{ - "bluez5.features.device": [ - { - "name": "Air 1 Plus", - "no-features": [ - "hw-volume-mic" - ] - }, - { - "name": "AirPods", - "no-features": [ - "msbc-alt1", - "msbc-alt1-rtl" - ] - }, - { - "name": "AirPods Pro", - "no-features": [ - "msbc-alt1", - "msbc-alt1-rtl" - ] - }, - { - "name": "AXLOIE Goin", - "no-features": [ - "msbc-alt1", - "msbc-alt1-rtl" - ] - }, - { - "name": "BAA 100", - "no-features": [ - "hw-volume" - ] - }, - { - "name": "D50s", - "address": "~^00:13:ef:", - "no-features": [ - "hw-volume" - ] - }, - { - "name": "JBL Endurance RUN BT", - "no-features": [ - "msbc-alt1", - "msbc-alt1-rtl", - "sbc-xq" - ] - }, - { - "name": "JBL LIVE650BTNC" - }, - { - "name": "Motorola DC800", - "no-features": [ - "sbc-xq" - ] - }, - { - "name": "Motorola S305", - "no-features": [ - "sbc-xq" - ] - }, - { - "name": "Soundcore Life P2-L", - "no-features": [ - "msbc-alt1", - "msbc-alt1-rtl" - ] - }, - { - "name": "Urbanista Stockholm Plus", - "no-features": [ - "msbc-alt1", - "msbc-alt1-rtl" - ] - }, - { - "address": "~^94:16:25:", - "no-features": [ - "hw-volume" - ] - }, - { - "address": "~^9c:64:8b:", - "no-features": [ - "hw-volume" - ] - }, - { - "address": "~^a0:e9:db:", - "no-features": [ - "hw-volume" - ] - }, - { - "address": "~^0c:a6:94:", - "no-features": [ - "hw-volume" - ] - }, - { - "address": "~^00:14:02:", - "no-features": [ - "hw-volume" - ] - }, - { - "address": "~^44:5e:f3:", - "no-features": [ - "hw-volume" - ] - }, - { - "address": "~^d4:9c:28:", - "no-features": [ - "hw-volume" - ] - }, - { - "address": "~^00:18:6b:", - "no-features": [ - "hw-volume" - ] - }, - { - "address": "~^b8:ad:3e:", - "no-features": [ - "hw-volume" - ] - }, - { - "address": "~^a0:e9:db:", - "no-features": [ - "hw-volume" - ] - }, - { - "address": "~^00:24:1c:", - "no-features": [ - "hw-volume" - ] - }, - { - "address": "~^00:11:b1:", - "no-features": [ - "hw-volume" - ] - }, - { - "address": "~^a4:15:66:", - "no-features": [ - "hw-volume" - ] - }, - { - "address": "~^00:14:f1:", - "no-features": [ - "hw-volume" - ] - }, - { - "address": "~^00:26:7e:", - "no-features": [ - "hw-volume" - ] - }, - { - "address": "~^90:03:b7:", - "no-features": [ - "hw-volume" - ] - } - ], - "bluez5.features.adapter": [ - { - "bus-type": "usb", - "vendor-id": "usb:0bda" - }, - { - "bus-type": "usb", - "no-features": [ - "msbc-alt1-rtl" - ] - }, - { - "no-features": [ - "msbc-alt1-rtl" - ] - } - ], - "bluez5.features.kernel": [ - { - "sysname": "Linux", - "release": "~^[0-4]\\.", - "no-features": [ - "msbc-alt1", - "msbc-alt1-rtl" - ] - }, - { - "sysname": "Linux", - "release": "~^5\\.[1-7]\\.", - "no-features": [ - "msbc-alt1", - "msbc-alt1-rtl" - ] - }, - { - "sysname": "Linux", - "release": "~^5\\.(8|9)\\.", - "no-features": [ - "msbc-alt1" - ] - }, - { - "sysname": "Linux", - "release": "~^5\\.10\\.(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|51|52|53|54|55|56|57|58|59|60|61)($|[^0-9])", - "no-features": [ - "msbc-alt1" - ] - }, - { - "sysname": "Linux", - "release": "~^5\\.12\\.(18|19)($|[^0-9])", - "no-features": [ - "msbc-alt1" - ] - }, - { - "sysname": "Linux", - "release": "~^5\\.13\\.(3|4|5|6|7|8|9|10|11|12|13)($|[^0-9])", - "no-features": [ - "msbc-alt1" - ] - }, - { - "sysname": "Linux", - "release": "~^5\\.14($|[^0-9])", - "no-features": [ - "msbc-alt1" - ] - }, - { - "no-features": [] - } - ] -} diff --git a/nixos/modules/services/desktops/pipewire/client-rt.conf.json b/nixos/modules/services/desktops/pipewire/daemon/client-rt.conf.json similarity index 100% rename from nixos/modules/services/desktops/pipewire/client-rt.conf.json rename to nixos/modules/services/desktops/pipewire/daemon/client-rt.conf.json diff --git a/nixos/modules/services/desktops/pipewire/client.conf.json b/nixos/modules/services/desktops/pipewire/daemon/client.conf.json similarity index 100% rename from nixos/modules/services/desktops/pipewire/client.conf.json rename to nixos/modules/services/desktops/pipewire/daemon/client.conf.json diff --git a/nixos/modules/services/desktops/pipewire/jack.conf.json b/nixos/modules/services/desktops/pipewire/daemon/jack.conf.json similarity index 100% rename from nixos/modules/services/desktops/pipewire/jack.conf.json rename to nixos/modules/services/desktops/pipewire/daemon/jack.conf.json diff --git a/nixos/modules/services/desktops/pipewire/pipewire-pulse.conf.json b/nixos/modules/services/desktops/pipewire/daemon/pipewire-pulse.conf.json similarity index 100% rename from nixos/modules/services/desktops/pipewire/pipewire-pulse.conf.json rename to nixos/modules/services/desktops/pipewire/daemon/pipewire-pulse.conf.json diff --git a/nixos/modules/services/desktops/pipewire/pipewire.conf.json b/nixos/modules/services/desktops/pipewire/daemon/pipewire.conf.json similarity index 100% rename from nixos/modules/services/desktops/pipewire/pipewire.conf.json rename to nixos/modules/services/desktops/pipewire/daemon/pipewire.conf.json diff --git a/nixos/modules/services/desktops/pipewire/alsa-monitor.conf.json b/nixos/modules/services/desktops/pipewire/media-session/alsa-monitor.conf.json similarity index 100% rename from nixos/modules/services/desktops/pipewire/alsa-monitor.conf.json rename to nixos/modules/services/desktops/pipewire/media-session/alsa-monitor.conf.json diff --git a/nixos/modules/services/desktops/pipewire/bluez-monitor.conf.json b/nixos/modules/services/desktops/pipewire/media-session/bluez-monitor.conf.json similarity index 100% rename from nixos/modules/services/desktops/pipewire/bluez-monitor.conf.json rename to nixos/modules/services/desktops/pipewire/media-session/bluez-monitor.conf.json diff --git a/nixos/modules/services/desktops/pipewire/media-session.conf.json b/nixos/modules/services/desktops/pipewire/media-session/media-session.conf.json similarity index 100% rename from nixos/modules/services/desktops/pipewire/media-session.conf.json rename to nixos/modules/services/desktops/pipewire/media-session/media-session.conf.json diff --git a/nixos/modules/services/desktops/pipewire/v4l2-monitor.conf.json b/nixos/modules/services/desktops/pipewire/media-session/v4l2-monitor.conf.json similarity index 100% rename from nixos/modules/services/desktops/pipewire/v4l2-monitor.conf.json rename to nixos/modules/services/desktops/pipewire/media-session/v4l2-monitor.conf.json diff --git a/nixos/modules/services/desktops/pipewire/pipewire-media-session.nix b/nixos/modules/services/desktops/pipewire/pipewire-media-session.nix index 41ab995e329..8fec8b06fc8 100644 --- a/nixos/modules/services/desktops/pipewire/pipewire-media-session.nix +++ b/nixos/modules/services/desktops/pipewire/pipewire-media-session.nix @@ -13,17 +13,15 @@ let # Use upstream config files passed through spa-json-dump as the base # Patched here as necessary for them to work with this module defaults = { - alsa-monitor = (builtins.fromJSON (builtins.readFile ./alsa-monitor.conf.json)); - bluez-monitor = (builtins.fromJSON (builtins.readFile ./bluez-monitor.conf.json)); - bluez-hardware = (builtins.fromJSON (builtins.readFile ./bluez-hardware.conf.json)); - media-session = (builtins.fromJSON (builtins.readFile ./media-session.conf.json)); - v4l2-monitor = (builtins.fromJSON (builtins.readFile ./v4l2-monitor.conf.json)); + alsa-monitor = (builtins.fromJSON (builtins.readFile ./media-session/alsa-monitor.conf.json)); + bluez-monitor = (builtins.fromJSON (builtins.readFile ./media-session/bluez-monitor.conf.json)); + media-session = (builtins.fromJSON (builtins.readFile ./media-session/media-session.conf.json)); + v4l2-monitor = (builtins.fromJSON (builtins.readFile ./media-session/v4l2-monitor.conf.json)); }; configs = { alsa-monitor = recursiveUpdate defaults.alsa-monitor cfg.config.alsa-monitor; bluez-monitor = recursiveUpdate defaults.bluez-monitor cfg.config.bluez-monitor; - bluez-hardware = defaults.bluez-hardware; media-session = recursiveUpdate defaults.media-session cfg.config.media-session; v4l2-monitor = recursiveUpdate defaults.v4l2-monitor cfg.config.v4l2-monitor; }; @@ -45,8 +43,8 @@ in { package = mkOption { type = types.package; - default = pkgs.pipewire.mediaSession; - example = literalExample "pkgs.pipewire.mediaSession"; + default = pkgs.pipewire-media-session; + defaultText = literalExpression "pkgs.pipewire-media-session"; description = '' The pipewire-media-session derivation to use. ''; @@ -57,7 +55,7 @@ in { type = json.type; description = '' Configuration for the media session core. For details see - https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/${cfg.package.version}/src/daemon/media-session.d/media-session.conf + https://gitlab.freedesktop.org/pipewire/media-session/-/blob/${cfg.package.version}/src/daemon/media-session.d/media-session.conf ''; default = {}; }; @@ -66,7 +64,7 @@ in { type = json.type; description = '' Configuration for the alsa monitor. For details see - https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/${cfg.package.version}/src/daemon/media-session.d/alsa-monitor.conf + https://gitlab.freedesktop.org/pipewire/media-session/-/blob/${cfg.package.version}/src/daemon/media-session.d/alsa-monitor.conf ''; default = {}; }; @@ -75,7 +73,7 @@ in { type = json.type; description = '' Configuration for the bluez5 monitor. For details see - https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/${cfg.package.version}/src/daemon/media-session.d/bluez-monitor.conf + https://gitlab.freedesktop.org/pipewire/media-session/-/blob/${cfg.package.version}/src/daemon/media-session.d/bluez-monitor.conf ''; default = {}; }; @@ -84,7 +82,7 @@ in { type = json.type; description = '' Configuration for the V4L2 monitor. For details see - https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/${cfg.package.version}/src/daemon/media-session.d/v4l2-monitor.conf + https://gitlab.freedesktop.org/pipewire/media-session/-/blob/${cfg.package.version}/src/daemon/media-session.d/v4l2-monitor.conf ''; default = {}; }; @@ -122,10 +120,6 @@ in { mkIf config.services.pipewire.pulse.enable { source = json.generate "bluez-monitor.conf" configs.bluez-monitor; }; - environment.etc."pipewire/media-session.d/bluez-hardware.conf" = - mkIf config.services.pipewire.pulse.enable { - source = json.generate "bluez-hardware.conf" configs.bluez-hardware; - }; environment.etc."pipewire/media-session.d/with-jack" = mkIf config.services.pipewire.jack.enable { diff --git a/nixos/modules/services/desktops/pipewire/pipewire.nix b/nixos/modules/services/desktops/pipewire/pipewire.nix index bc75aa2717a..fb5a27a50d6 100644 --- a/nixos/modules/services/desktops/pipewire/pipewire.nix +++ b/nixos/modules/services/desktops/pipewire/pipewire.nix @@ -22,12 +22,11 @@ let # Use upstream config files passed through spa-json-dump as the base # Patched here as necessary for them to work with this module defaults = { - client = builtins.fromJSON (builtins.readFile ./client.conf.json); - client-rt = builtins.fromJSON (builtins.readFile ./client-rt.conf.json); - jack = builtins.fromJSON (builtins.readFile ./jack.conf.json); - # Remove session manager invocation from the upstream generated file, it points to the wrong path - pipewire = builtins.fromJSON (builtins.readFile ./pipewire.conf.json); - pipewire-pulse = builtins.fromJSON (builtins.readFile ./pipewire-pulse.conf.json); + client = builtins.fromJSON (builtins.readFile ./daemon/client.conf.json); + client-rt = builtins.fromJSON (builtins.readFile ./daemon/client-rt.conf.json); + jack = builtins.fromJSON (builtins.readFile ./daemon/jack.conf.json); + pipewire = builtins.fromJSON (builtins.readFile ./daemon/pipewire.conf.json); + pipewire-pulse = builtins.fromJSON (builtins.readFile ./daemon/pipewire-pulse.conf.json); }; configs = { diff --git a/pkgs/development/libraries/pipewire/0050-pipewire-pulse-path.patch b/pkgs/development/libraries/pipewire/0050-pipewire-pulse-path.patch index fd7d031ee0f..84238bf6e5a 100644 --- a/pkgs/development/libraries/pipewire/0050-pipewire-pulse-path.patch +++ b/pkgs/development/libraries/pipewire/0050-pipewire-pulse-path.patch @@ -1,8 +1,8 @@ diff --git a/meson_options.txt b/meson_options.txt -index 66791f3a..93b5e2a9 100644 +index 71c2e35e9..a0f380c04 100644 --- a/meson_options.txt +++ b/meson_options.txt -@@ -172,6 +172,9 @@ option('udev', +@@ -176,6 +176,9 @@ option('udev', option('udevrulesdir', type : 'string', description : 'Directory for udev rules (defaults to /lib/udev/rules.d)') @@ -13,7 +13,7 @@ index 66791f3a..93b5e2a9 100644 type : 'string', description : 'Directory for user systemd units (defaults to /usr/lib/systemd/user)') diff --git a/src/daemon/systemd/user/meson.build b/src/daemon/systemd/user/meson.build -index aa30a86f..1edebb2d 100644 +index 5bd134537..5a3ca9ed5 100644 --- a/src/daemon/systemd/user/meson.build +++ b/src/daemon/systemd/user/meson.build @@ -9,7 +9,7 @@ install_data( @@ -22,6 +22,6 @@ index aa30a86f..1edebb2d 100644 systemd_config.set('PW_BINARY', pipewire_bindir / 'pipewire') -systemd_config.set('PW_PULSE_BINARY', pipewire_bindir / 'pipewire-pulse') +systemd_config.set('PW_PULSE_BINARY', get_option('pipewire_pulse_prefix') / 'bin/pipewire-pulse') - systemd_config.set('PW_MEDIA_SESSION_BINARY', pipewire_bindir / 'pipewire-media-session') configure_file(input : 'pipewire.service.in', + output : 'pipewire.service', diff --git a/pkgs/development/libraries/pipewire/0055-pipewire-media-session-path.patch b/pkgs/development/libraries/pipewire/0055-pipewire-media-session-path.patch deleted file mode 100644 index 8290aec5dfc..00000000000 --- a/pkgs/development/libraries/pipewire/0055-pipewire-media-session-path.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/meson_options.txt b/meson_options.txt -index 93b5e2a9..1b915ac3 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -200,3 +200,6 @@ option('media-session', - type: 'feature', - value: 'auto') -+option('media-session-prefix', -+ description: 'Install directory for pipewire-media-session and its support files', -+ type: 'string') - option('session-managers', -diff --git a/src/daemon/systemd/user/meson.build b/src/daemon/systemd/user/meson.build -index 1edebb2d..251270eb 100644 ---- a/src/daemon/systemd/user/meson.build -+++ b/src/daemon/systemd/user/meson.build -@@ -10,7 +10,7 @@ install_data( - systemd_config = configuration_data() - systemd_config.set('PW_BINARY', pipewire_bindir / 'pipewire') - systemd_config.set('PW_PULSE_BINARY', get_option('pipewire_pulse_prefix') / 'bin/pipewire-pulse') --systemd_config.set('PW_MEDIA_SESSION_BINARY', pipewire_bindir / 'pipewire-media-session') -+systemd_config.set('PW_MEDIA_SESSION_BINARY', get_option('media-session-prefix') / 'bin/pipewire-media-session') - - configure_file(input : 'pipewire.service.in', - output : 'pipewire.service', diff --git a/pkgs/development/libraries/pipewire/0090-pipewire-config-template-paths.patch b/pkgs/development/libraries/pipewire/0090-pipewire-config-template-paths.patch index d3851604a13..ea968e28ea8 100644 --- a/pkgs/development/libraries/pipewire/0090-pipewire-config-template-paths.patch +++ b/pkgs/development/libraries/pipewire/0090-pipewire-config-template-paths.patch @@ -1,5 +1,5 @@ diff --git a/src/daemon/pipewire.conf.in b/src/daemon/pipewire.conf.in -index 95632c250..a88aac6e2 100644 +index 648e13069..50f767f0c 100644 --- a/src/daemon/pipewire.conf.in +++ b/src/daemon/pipewire.conf.in @@ -131,7 +131,7 @@ context.modules = [ @@ -15,8 +15,8 @@ index 95632c250..a88aac6e2 100644 # but it is better to start it as a systemd service. # Run the session manager with -h for options. # -- @sm_comment@{ path = "@session_manager_path@" args = "@session_manager_args@" } -+ @sm_comment@{ path = "" args = "@session_manager_args@" } +- @sm_comment@{ path = "@session_manager_path@" args = "@session_manager_args@" } ++ @sm_comment@{ path = "" args = "@session_manager_args@" } # # You can optionally start the pulseaudio-server here as well # but it is better to start it as a systemd service. diff --git a/pkgs/development/libraries/pipewire/0095-spa-data-dir.patch b/pkgs/development/libraries/pipewire/0095-spa-data-dir.patch new file mode 100644 index 00000000000..d8241a809f6 --- /dev/null +++ b/pkgs/development/libraries/pipewire/0095-spa-data-dir.patch @@ -0,0 +1,12 @@ +diff --git a/meson.build b/meson.build +index 56599ebd1..3bed2d3e3 100644 +--- a/meson.build ++++ b/meson.build +@@ -54,7 +54,7 @@ else + endif + + spa_plugindir = pipewire_libdir / spa_name +-spa_datadir = pipewire_datadir / spa_name ++spa_datadir = pipewire_libdir / spa_name + + alsadatadir = pipewire_datadir / 'alsa-card-profile' / 'mixer' diff --git a/pkgs/development/libraries/pipewire/default.nix b/pkgs/development/libraries/pipewire/default.nix index 85dd7bfbff2..8070222b9e1 100644 --- a/pkgs/development/libraries/pipewire/default.nix +++ b/pkgs/development/libraries/pipewire/default.nix @@ -1,6 +1,7 @@ { stdenv , lib , fetchFromGitLab +, fetchpatch , removeReferencesTo , python3 , meson @@ -24,6 +25,7 @@ , vulkan-loader , webrtc-audio-processing , ncurses +, readline81 # meson can't find <7 as those versions don't have a .pc file , makeFontsConf , callPackage , nixosTests @@ -58,7 +60,7 @@ let self = stdenv.mkDerivation rec { pname = "pipewire"; - version = "0.3.36"; + version = "0.3.39"; outputs = [ "out" @@ -68,7 +70,6 @@ let "dev" "doc" "man" - "mediaSession" "installedTests" ]; @@ -77,7 +78,7 @@ let owner = "pipewire"; repo = "pipewire"; rev = version; - sha256 = "sha256-kwoffB0Hi84T4Q0NaxLxsCyPV4R0LayX9kHmXU/vRPA="; + sha256 = "sha256-peTS1+NuQxZg1rrv8DrnJW5BR9yReleqooIwhZWHLjM="; }; patches = [ @@ -85,14 +86,20 @@ let ./0040-alsa-profiles-use-libdir.patch # Change the path of the pipewire-pulse binary in the service definition. ./0050-pipewire-pulse-path.patch - # Change the path of the pipewire-media-session binary in the service definition. - ./0055-pipewire-media-session-path.patch # Move installed tests into their own output. ./0070-installed-tests-path.patch # Add option for changing the config install directory ./0080-pipewire-config-dir.patch # Remove output paths from the comments in the config templates to break dependency cycles ./0090-pipewire-config-template-paths.patch + # Place SPA data files in lib output to avoid dependency cycles + ./0095-spa-data-dir.patch + # Fix compilation on some architectures + # XXX: REMOVE ON NEXT RELEASE + (fetchpatch { + url = "https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/651f0decea5f83730c271e9bed03cdd0048fcd49.diff"; + sha256 = "1bmpi5qn750mcspaw7m57ww0503sl9781jswqby4gr0f7c5wmqvj"; + }) ]; nativeBuildInputs = [ @@ -113,6 +120,7 @@ let libusb1 libsndfile ncurses + readline81 udev vulkan-headers vulkan-loader @@ -128,12 +136,10 @@ let mesonFlags = [ "-Ddocs=enabled" - "-Dexamples=${mesonEnable withMediaSession}" # only needed for `pipewire-media-session` "-Dudevrulesdir=lib/udev/rules.d" "-Dinstalled_tests=enabled" "-Dinstalled_test_prefix=${placeholder "installedTests"}" "-Dpipewire_pulse_prefix=${placeholder "pulse"}" - "-Dmedia-session-prefix=${placeholder "mediaSession"}" "-Dlibjack-path=${placeholder "jack"}/lib" "-Dlibcamera=disabled" "-Droc=disabled" @@ -148,7 +154,8 @@ let "-Dbluez5-backend-hsphfpd=${mesonEnable hsphfpdSupport}" "-Dsysconfdir=/etc" "-Dpipewire_confdata_dir=${placeholder "lib"}/share/pipewire" - "-Dsession-managers=${mesonList (lib.optional withMediaSession "media-session")}" + "-Dsession-managers=" + "-Dvulkan=enabled" ]; FONTCONFIG_FILE = fontsConf; # Fontconfig error: Cannot load default config file @@ -157,29 +164,20 @@ let postUnpack = '' patchShebangs source/doc/strip-static.sh + patchShebangs source/doc/input-filter.sh + patchShebangs source/doc/input-filter-h.sh patchShebangs source/spa/tests/gen-cpp-test.py ''; postInstall = '' - pushd $lib/share - mkdir -p $out/nix-support/etc/pipewire - for f in pipewire/*.conf; do + mkdir $out/nix-support + pushd $lib/share/pipewire + for f in *.conf; do echo "Generating JSON from $f" - $out/bin/spa-json-dump "$f" > "$out/nix-support/etc/$f.json" - done - - mkdir -p $mediaSession/nix-support/etc/pipewire/media-session.d - for f in pipewire/media-session.d/*.conf; do - echo "Generating JSON from $f" - $out/bin/spa-json-dump "$f" > "$mediaSession/nix-support/etc/$f.json" + $out/bin/spa-json-dump "$f" > "$out/nix-support/$f.json" done popd - moveToOutput "share/pipewire/media-session.d/*.conf" "$mediaSession" - moveToOutput "share/systemd/user/pipewire-media-session.*" "$mediaSession" - moveToOutput "lib/systemd/user/pipewire-media-session.*" "$mediaSession" - moveToOutput "bin/pipewire-media-session" "$mediaSession" - moveToOutput "share/systemd/user/pipewire-pulse.*" "$pulse" moveToOutput "lib/systemd/user/pipewire-pulse.*" "$pulse" moveToOutput "bin/pipewire-pulse" "$pulse" @@ -191,21 +189,14 @@ let installedTests = nixosTests.installed-tests.pipewire; # This ensures that all the paths used by the NixOS module are found. - test-paths = callPackage ./test-paths.nix { + test-paths = callPackage ./test-paths.nix { package = self; } { paths-out = [ "share/alsa/alsa.conf.d/50-pipewire.conf" - "nix-support/etc/pipewire/client-rt.conf.json" - "nix-support/etc/pipewire/client.conf.json" - "nix-support/etc/pipewire/jack.conf.json" - "nix-support/etc/pipewire/pipewire.conf.json" - "nix-support/etc/pipewire/pipewire-pulse.conf.json" - ]; - paths-out-media-session = [ - "nix-support/etc/pipewire/media-session.d/alsa-monitor.conf.json" - "nix-support/etc/pipewire/media-session.d/bluez-monitor.conf.json" - "nix-support/etc/pipewire/media-session.d/bluez-hardware.conf.json" - "nix-support/etc/pipewire/media-session.d/media-session.conf.json" - "nix-support/etc/pipewire/media-session.d/v4l2-monitor.conf.json" + "nix-support/client-rt.conf.json" + "nix-support/client.conf.json" + "nix-support/jack.conf.json" + "nix-support/pipewire.conf.json" + "nix-support/pipewire-pulse.conf.json" ]; paths-lib = [ "lib/alsa-lib/libasound_module_pcm_pipewire.so" diff --git a/pkgs/development/libraries/pipewire/media-session.nix b/pkgs/development/libraries/pipewire/media-session.nix new file mode 100644 index 00000000000..37daffe5c88 --- /dev/null +++ b/pkgs/development/libraries/pipewire/media-session.nix @@ -0,0 +1,93 @@ +{ stdenv +, lib +, fetchFromGitLab +, meson +, ninja +, pkg-config +, doxygen +, graphviz +, systemd +, pipewire +, glib +, dbus +, alsa-lib +, callPackage +}: + +let + mesonEnable = b: if b then "enabled" else "disabled"; + mesonList = l: "[" + lib.concatStringsSep "," l + "]"; + + self = stdenv.mkDerivation rec { + pname = "pipewire-media-session"; + version = "0.4.0"; + + src = fetchFromGitLab { + domain = "gitlab.freedesktop.org"; + owner = "pipewire"; + repo = "media-session"; + rev = version; + sha256 = "sha256-zhOvBlG7DuQkJ+ZZBhBhfKwk+bbLljpt3w4JlK3cJLk="; + }; + + nativeBuildInputs = [ + doxygen + graphviz + meson + ninja + pkg-config + ]; + + buildInputs = [ + alsa-lib + dbus + glib + pipewire + systemd + ]; + + mesonFlags = [ + "-Ddocs=enabled" + # We generate these empty files from the nixos module, don't bother installing them + "-Dwith-module-sets=[]" + ]; + + postUnpack = '' + patchShebangs source/doc/input-filter-h.sh + patchShebangs source/doc/input-filter.sh + ''; + + postInstall = '' + mkdir $out/nix-support + cd $out/share/pipewire/media-session.d + for f in *.conf; do + echo "Generating JSON from $f" + ${pipewire}/bin/spa-json-dump "$f" > "$out/nix-support/$f.json" + done + ''; + + passthru = { + tests = { + test-paths = callPackage ./test-paths.nix { package = self; } { + paths-out = [ + "nix-support/alsa-monitor.conf.json" + "nix-support/bluez-monitor.conf.json" + "nix-support/media-session.conf.json" + "nix-support/v4l2-monitor.conf.json" + ]; + paths-lib = []; + }; + }; + }; + + meta = with lib; { + description = "Example session manager for PipeWire"; + homepage = "https://pipewire.org"; + license = licenses.mit; + platforms = platforms.linux; + maintainers = with maintainers; [ jtojnar kranzes ]; + }; + }; + +in +self diff --git a/pkgs/development/libraries/pipewire/test-paths.nix b/pkgs/development/libraries/pipewire/test-paths.nix index 939b79686e3..1e3e5fef3a6 100644 --- a/pkgs/development/libraries/pipewire/test-paths.nix +++ b/pkgs/development/libraries/pipewire/test-paths.nix @@ -1,4 +1,4 @@ -{ lib, runCommand, pipewire, paths-out, paths-lib, paths-out-media-session }: +{ lib, runCommand, package, paths-out, paths-lib }: let check-path = output: path: '' @@ -14,9 +14,8 @@ let in runCommand "pipewire-test-paths" { } '' touch $out - ${check-output pipewire.mediaSession paths-out-media-session} - ${check-output pipewire.lib paths-lib} - ${check-output pipewire paths-out} + ${check-output package.lib paths-lib} + ${check-output package paths-out} if [[ -n "$error" ]]; then exit 1 diff --git a/pkgs/development/libraries/pipewire/update.sh b/pkgs/development/libraries/pipewire/update.sh index 6d0088c206c..9fc46627667 100755 --- a/pkgs/development/libraries/pipewire/update.sh +++ b/pkgs/development/libraries/pipewire/update.sh @@ -11,14 +11,27 @@ NIXPKGS_ROOT="$(git rev-parse --show-toplevel)" cd "$NIXPKGS_ROOT" nix-update pipewire -outputs=$(nix-build . -A pipewire -A pipewire.mediaSession) +outputs=$(nix-build . -A pipewire) for p in $outputs; do - conf_files=$(find "$p/nix-support/etc/pipewire/" -name '*.conf.json') + conf_files=$(find "$p/nix-support/" -name '*.conf.json') for c in $conf_files; do file_name=$(basename "$c") - if [[ ! -e "nixos/modules/services/desktops/pipewire/$file_name" ]]; then + if [[ ! -e "nixos/modules/services/desktops/pipewire/daemon/$file_name" ]]; then echo "New file $file_name found! Add it to the module config and passthru tests!" fi - install -m 0644 "$c" "nixos/modules/services/desktops/pipewire/" + install -m 0644 "$c" "nixos/modules/services/desktops/pipewire/daemon/" + done +done + +nix-update pipewire-media-session +outputs=$(nix-build . -A pipewire-media-session) +for p in $outputs; do + conf_files=$(find "$p/nix-support/" -name '*.conf.json') + for c in $conf_files; do + file_name=$(basename "$c") + if [[ ! -e "nixos/modules/services/desktops/pipewire/media-session/$file_name" ]]; then + echo "New file $file_name found! Add it to the module config and passthru tests!" + fi + install -m 0644 "$c" "nixos/modules/services/desktops/pipewire/media-session/" done done diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 683acfa23fe..22158b387ab 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12385,6 +12385,7 @@ in pipenv = callPackage ../development/tools/pipenv {}; pipewire = callPackage ../development/libraries/pipewire {}; + pipewire-media-session = callPackage ../development/libraries/pipewire/media-session.nix {}; pipewire_0_2 = callPackage ../development/libraries/pipewire/0.2.nix {}; pyradio = callPackage ../applications/radio/pyradio {};