From a016c22d106ddcae0eb341554860694e37fafd3c Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Thu, 1 Apr 2021 13:55:14 +0300 Subject: [PATCH] Switch to pipewire --- flake.lock | 43 ++++++++++++++++++++++++++++------------ flake.nix | 8 ++++++-- modules/hardware.nix | 47 ++++++-------------------------------------- modules/services.nix | 10 ++++++++-- 4 files changed, 50 insertions(+), 58 deletions(-) diff --git a/flake.lock b/flake.lock index 16ea258..8633272 100644 --- a/flake.lock +++ b/flake.lock @@ -227,11 +227,11 @@ "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1615194819, - "narHash": "sha256-LfPUsgeFRBzRgTp+828E7UhiVItSYH+CK6IJcjmlcZ4=", + "lastModified": 1617098825, + "narHash": "sha256-jiCtWHbFLyJHI0CgywofLYuyl00eZvhZrcPhfU940NU=", "owner": "NixOS", "repo": "nix", - "rev": "1c0e3e453d41b869e4ac7e25dc1c00c349a7c411", + "rev": "e7810665a72592de08b61b1e83b150b5282e1e82", "type": "github" }, "original": { @@ -411,21 +411,21 @@ "type": "github" } }, - "pulseaudio": { + "pipewire": { "flake": false, "locked": { - "lastModified": 1616962871, - "narHash": "sha256-hUSMqLpFQgL8sv9fsc5E4WFZXsAHSuj/kqS9KxhghSk=", - "ref": "a2dp-avrcp-absolute-volume", - "rev": "7f58efcd7cc2e513c155f9504deda6d7a2e466ac", - "revCount": 9724, + "lastModified": 1612480581, + "narHash": "sha256-Ah5qntk3mGKUXzVpH4OPIZsNmnCBJw/gj7VX7P3povI=", + "ref": "bt-mic-volume", + "rev": "c3c9bd0c012ba20b9f3c34535c8d4082860eee52", + "revCount": 5490, "type": "git", - "url": "https://gitlab.freedesktop.org/MarijnS95/pulseaudio.git" + "url": "https://gitlab.freedesktop.org/pvir/pipewire" }, "original": { - "ref": "a2dp-avrcp-absolute-volume", + "ref": "bt-mic-volume", "type": "git", - "url": "https://gitlab.freedesktop.org/MarijnS95/pulseaudio.git" + "url": "https://gitlab.freedesktop.org/pvir/pipewire" } }, "root": { @@ -445,10 +445,11 @@ "nixpkgs": "nixpkgs_5", "nixpkgs-old": "nixpkgs-old", "nixpkgs-wayland": "nixpkgs-wayland", - "pulseaudio": "pulseaudio", + "pipewire": "pipewire", "simple-nixos-mailserver": "simple-nixos-mailserver", "simple-osd-daemons": "simple-osd-daemons", "sonoff-lan": "sonoff-lan", + "upower": "upower", "wee-slack": "wee-slack", "weechat-notify-send": "weechat-notify-send", "weechat-scripts": "weechat-scripts", @@ -506,6 +507,22 @@ "type": "github" } }, + "upower": { + "flake": false, + "locked": { + "lastModified": 1612431950, + "narHash": "sha256-euoLe1/XmW3LK4PvznrryDufNZrASJL3XMW7qaXTXeM=", + "ref": "master", + "rev": "706dcd44e443f630607554b1154a5d3685d43a9c", + "revCount": 1337, + "type": "git", + "url": "https://gitlab.freedesktop.org/upower/upower" + }, + "original": { + "type": "git", + "url": "https://gitlab.freedesktop.org/upower/upower" + } + }, "utils": { "locked": { "lastModified": 1610051610, diff --git a/flake.nix b/flake.nix index 018753b..45c849c 100644 --- a/flake.nix +++ b/flake.nix @@ -63,8 +63,12 @@ url = "git+https://code.librehq.com/qhong/crdt.el"; flake = false; }; - pulseaudio = { - url = "git+https://gitlab.freedesktop.org/MarijnS95/pulseaudio.git?ref=a2dp-avrcp-absolute-volume"; + upower = { + url = "git+https://gitlab.freedesktop.org/upower/upower"; + flake = false; + }; + pipewire = { + url = "git+https://gitlab.freedesktop.org/pvir/pipewire?ref=bt-mic-volume"; flake = false; }; }; diff --git a/modules/hardware.nix b/modules/hardware.nix index bf3c52c..0a302e8 100644 --- a/modules/hardware.nix +++ b/modules/hardware.nix @@ -21,47 +21,12 @@ with deviceSpecific; { services.logind.extraConfig = "HandlePowerKey=suspend"; sound.enable = true; - hardware.pulseaudio = { - enable = true; - package = pkgs.callPackage ({ ... }: - let orig = pkgs.pulseaudioFull; - in pkgs.stdenv.mkDerivation rec { - pname = "pulseaudio"; - version = "1.1.1"; # For compatibility - outputs = [ "out" "dev" ]; - src = inputs.pulseaudio; - nativeBuildInputs = with pkgs; [ - pkg-config - makeWrapper - perlPackages.perl - perlPackages.XMLParser - meson - ninja - ]; - inherit (orig) - propagatedBuildInputs configureFlags installFlags postInstall - preFixup; - buildInputs = orig.buildInputs - ++ (with pkgs; [ libexecinfo tdb orc check ]); - preConfigure = '' - echo "$version" > .tarball-version - ''; - mesonFlags = [ - "-Dgtk=disabled" - "-Delogind=disabled" - "-Dvalgrind=disabled" - "-Dtcpwrap=disabled" - "-Dbluez5-gstreamer=disabled" - "-Dgstreamer=disabled" - "-Dsystemduserunitdir=lib/systemd/user" - "-Dudevrulesdir=lib/udev/rules.d" - ]; - }) { }; - support32Bit = true; - extraConfig = '' - load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 - load-module module-bluetooth-policy auto_switch=2 - ''; + hardware.pulseaudio.enable = false; + + services.pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; }; } diff --git a/modules/services.nix b/modules/services.nix index c4f1f8e..a01db5f 100644 --- a/modules/services.nix +++ b/modules/services.nix @@ -1,5 +1,5 @@ -{ config, lib, pkgs, ... }: { +{ config, lib, pkgs, inputs, ... }: { services.acpid.enable = true; @@ -24,5 +24,11 @@ services.pcscd.enable = true; - services.upower.enable = true; + services.upower = { + enable = true; + package = pkgs.upower.overrideAttrs (oa: { + src = inputs.upower; + nativeBuildInputs = oa.nativeBuildInputs ++ [ pkgs.autoreconfHook pkgs.gtk_doc ]; + }); + }; }