From fb86d324d1a6f05a6da55af6e2ae8922e7063498 Mon Sep 17 00:00:00 2001 From: talyz Date: Tue, 27 Apr 2021 12:52:41 +0200 Subject: [PATCH] pipewire: Add update script --- .../services/desktops/pipewire/README.md | 6 --- .../libraries/pipewire/default.nix | 48 ++++++++++--------- pkgs/development/libraries/pipewire/update.sh | 24 ++++++++++ 3 files changed, 49 insertions(+), 29 deletions(-) delete mode 100644 nixos/modules/services/desktops/pipewire/README.md create mode 100755 pkgs/development/libraries/pipewire/update.sh diff --git a/nixos/modules/services/desktops/pipewire/README.md b/nixos/modules/services/desktops/pipewire/README.md deleted file mode 100644 index 87288a81cfe1..000000000000 --- a/nixos/modules/services/desktops/pipewire/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Updating - -1. Update the version & hash in pkgs/development/libraries/pipewire/default.nix -2. run `nix build -f /path/to/nixpkgs/checkout pipewire pipewire.mediaSession` -3. copy all JSON files from result/etc/pipewire and result-mediaSession/etc/pipewire/media-session.d to this directory -4. add new files to the module config and passthru tests diff --git a/pkgs/development/libraries/pipewire/default.nix b/pkgs/development/libraries/pipewire/default.nix index 9f095c7ab780..133853e2362a 100644 --- a/pkgs/development/libraries/pipewire/default.nix +++ b/pkgs/development/libraries/pipewire/default.nix @@ -60,7 +60,7 @@ let owner = "pipewire"; repo = "pipewire"; rev = version; - hash = "sha256:1rqi1sa937lp89ai79b5n7m0p66pigpj4w1mr2vq4dycfp8vppxk"; + sha256 = "sha256-s9+70XXMN4K3yDVwIu+L15gL6rFlpRNVQpeekZQOEec="; }; patches = [ @@ -146,29 +146,31 @@ let moveToOutput "bin/pipewire-pulse" "$pulse" ''; - passthru.tests = { - installedTests = nixosTests.installed-tests.pipewire; + passthru = { + updateScript = ./update.sh; + tests = { + installedTests = nixosTests.installed-tests.pipewire; - # This ensures that all the paths used by the NixOS module are found. - test-paths = callPackage ./test-paths.nix { - paths-out = [ - "share/alsa/alsa.conf.d/50-pipewire.conf" - "nix-support/etc/pipewire/client.conf.json" - "nix-support/etc/pipewire/client-rt.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/media-session.conf.json" - "nix-support/etc/pipewire/media-session.d/v4l2-monitor.conf.json" - ]; - paths-lib = [ - "lib/alsa-lib/libasound_module_pcm_pipewire.so" - "share/alsa-card-profile/mixer" - ]; + # This ensures that all the paths used by the NixOS module are found. + test-paths = callPackage ./test-paths.nix { + paths-out = [ + "share/alsa/alsa.conf.d/50-pipewire.conf" + "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/media-session.conf.json" + "nix-support/etc/pipewire/media-session.d/v4l2-monitor.conf.json" + ]; + paths-lib = [ + "lib/alsa-lib/libasound_module_pcm_pipewire.so" + "share/alsa-card-profile/mixer" + ]; + }; }; }; diff --git a/pkgs/development/libraries/pipewire/update.sh b/pkgs/development/libraries/pipewire/update.sh new file mode 100755 index 000000000000..6d0088c206cb --- /dev/null +++ b/pkgs/development/libraries/pipewire/update.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env nix-shell +#!nix-shell -p nix-update -i bash +# shellcheck shell=bash + +set -o errexit -o pipefail -o nounset -o errtrace +shopt -s inherit_errexit +shopt -s nullglob +IFS=$'\n' + +NIXPKGS_ROOT="$(git rev-parse --show-toplevel)" + +cd "$NIXPKGS_ROOT" +nix-update pipewire +outputs=$(nix-build . -A pipewire -A pipewire.mediaSession) +for p in $outputs; do + conf_files=$(find "$p/nix-support/etc/pipewire/" -name '*.conf.json') + for c in $conf_files; do + file_name=$(basename "$c") + if [[ ! -e "nixos/modules/services/desktops/pipewire/$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/" + done +done