From db5f55bfd111a341202a2254a9ee176a760d3b93 Mon Sep 17 00:00:00 2001 From: Gabriel Ebner Date: Sat, 21 Nov 2020 11:28:14 +0100 Subject: [PATCH] refactor --- archachatina.nix | 12 +------- bluez-alsa.nix | 69 +++++++++++++++++++++++++++++++++++++++++++++ common-headless.nix | 11 +++++++- decoysnail.nix | 1 + euhadra.nix | 2 ++ huion.nix | 10 +++++++ large-sw.nix | 3 +- petalius.nix | 3 ++ 8 files changed, 98 insertions(+), 13 deletions(-) create mode 100644 bluez-alsa.nix create mode 100644 huion.nix diff --git a/archachatina.nix b/archachatina.nix index 71723ff..3794b9a 100644 --- a/archachatina.nix +++ b/archachatina.nix @@ -12,6 +12,7 @@ ./qemu-user.nix ./atmega.nix ./v4l2loopback.nix + ./huion.nix ]; environment.etc."lvm/lvm.conf".text = '' @@ -58,8 +59,6 @@ services.thermald.enable = true; - users.extraUsers.gebner.extraGroups = [ "libvirtd" "vboxusers" ]; - virtualisation.virtualbox.host = { enable = true; # enableExtensionPack = true; @@ -77,8 +76,6 @@ "forceuid" "forcegid" "uid=0" "gid=0" ]; }; - hardware.opengl.driSupport32Bit = true; - hardware.opengl.extraPackages = with pkgs; [ rocm-opencl-icd # rocm-runtime-ext @@ -121,13 +118,6 @@ services.ratbagd.enable = true; - services.xserver.digimend.enable = true; - - services.udev.extraRules = '' - SUBSYSTEM=="input", ENV{ID_BUS}=="usb" ENV{ID_VENDOR_ID}=="256c", \ - ATTRS{name}=="* Touch *", ENV{ID_INPUT.tags}="low_res_touch" - ''; - # virtualisation.anbox = { # enable = true; # }; diff --git a/bluez-alsa.nix b/bluez-alsa.nix new file mode 100644 index 0000000..30e4938 --- /dev/null +++ b/bluez-alsa.nix @@ -0,0 +1,69 @@ +{ stdenv, fetchFromGitHub, pkgconfig, autoreconfHook +, alsaLib, bluez, glib, sbc, dbus + +# optional, but useful utils +, readline, libbsd, ncurses + +# optional codecs +, aacSupport ? true, fdk_aac +# TODO: aptxSupport +}: + +with stdenv.lib; + +stdenv.mkDerivation rec { + pname = "bluez-alsa"; + version = "3.0.0"; + + src = fetchFromGitHub { + owner = "Arkq"; + repo = "bluez-alsa"; + rev = "v${version}"; + sha256 = "1jlsgxyqfhncfhx1sy3ry0dp6p95kd4agh7g2b7g51h0c4cv74h8"; + }; + + nativeBuildInputs = [ pkgconfig autoreconfHook ]; + + buildInputs = [ + alsaLib bluez glib sbc dbus + readline libbsd ncurses + ] + ++ optional aacSupport fdk_aac; + + configureFlags = [ + "--with-alsaplugindir=${placeholder "out"}/lib/alsa-lib" + "--with-dbusconfdir=${placeholder "out"}/share/dbus-1/system.d" + "--enable-rfcomm" + "--enable-hcitop" + "--enable-msbc" + ] + ++ optional aacSupport "--enable-aac"; + + meta = { + description = "Bluez 5 Bluetooth Audio ALSA Backend"; + longDescription = '' + Bluez-ALSA (BlueALSA) is an ALSA backend for Bluez 5 audio interface. + Bluez-ALSA registers all Bluetooth devices with audio profiles in Bluez + under a virtual ALSA PCM device called `bluealsa` that supports both + playback and capture. + + Some backstory: Bluez 5 removed built-in support for ALSA in favor of a + generic interface for 3rd party appliations. Thereafter, PulseAudio + implemented a backend for that interface and became the only way to get + Bluetooth audio with Bluez 5. Users prefering ALSA stayed on Bluez 4. + However, Bluez 4 eventually became deprecated. + + This package is a rebirth of a direct interface between ALSA and Bluez 5, + that, unlike PulseAudio, provides KISS near-metal-like experience. It is + not possible to run BluezALSA and PulseAudio Bluetooth at the same time + due to limitations in Bluez, but it is possible to run PulseAudio over + BluezALSA if you disable `bluetooth-discover` and `bluez5-discover` + modules in PA and configure it to play/capture sound over `bluealsa` PCM. + ''; + homepage = src.meta.homepage; + license = licenses.mit; + platforms = platforms.linux; + maintainers = [ maintainers.oxij maintainers.lheckemann ]; + }; + +} diff --git a/common-headless.nix b/common-headless.nix index 72c4c87..13dc283 100644 --- a/common-headless.nix +++ b/common-headless.nix @@ -77,7 +77,16 @@ users.extraUsers.gebner = { isNormalUser = true; - extraGroups = [ "wheel" "networkmanager" "audio" "transmission" ]; + extraGroups = [ + "wheel" + "networkmanager" + "audio" + "transmission" + "lxd" + "libvirtd" + "vboxusers" + "wireshark" + ]; # shell = "${pkgs.zsh}/bin/zsh"; shell = "/run/current-system/sw/bin/fish"; diff --git a/decoysnail.nix b/decoysnail.nix index e7457ea..d07610a 100644 --- a/decoysnail.nix +++ b/decoysnail.nix @@ -10,6 +10,7 @@ ./fstrim.nix ./atmega.nix ./v4l2loopack.nix + ./huion.nix ]; environment.etc."lvm/lvm.conf".text = '' diff --git a/euhadra.nix b/euhadra.nix index c234654..7a72808 100644 --- a/euhadra.nix +++ b/euhadra.nix @@ -27,6 +27,8 @@ let mpdStreamingPort = 8080; in networking.hostName = "euhadra"; networking.hostId = "ddb5f0fd"; + hardware.cpu.intel.updateMicrocode = true; + services.mpd = { enable = true; network.listenAddress = "any"; diff --git a/huion.nix b/huion.nix new file mode 100644 index 0000000..1211bef --- /dev/null +++ b/huion.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + services.xserver.digimend.enable = true; + + services.udev.extraRules = '' + SUBSYSTEM=="input", ENV{ID_BUS}=="usb" ENV{ID_VENDOR_ID}=="256c", \ + ATTRS{name}=="* Touch *", ENV{ID_INPUT.tags}="low_res_touch" + ''; +} diff --git a/large-sw.nix b/large-sw.nix index c8a564c..afe7651 100644 --- a/large-sw.nix +++ b/large-sw.nix @@ -58,6 +58,7 @@ enable = true; package = pkgs.wireshark; }; - users.extraUsers.gebner.extraGroups = [ "wireshark" ]; + + hardware.opengl.driSupport32Bit = true; } diff --git a/petalius.nix b/petalius.nix index dd16d8d..7cb208d 100644 --- a/petalius.nix +++ b/petalius.nix @@ -10,6 +10,7 @@ ./fstrim.nix ./atmega.nix ./v4l2loopback.nix + ./huion.nix ]; environment.etc."lvm/lvm.conf".text = '' @@ -48,6 +49,8 @@ networking.hostName = "petalius"; networking.hostId = "cf58caa9"; + hardware.cpu.intel.updateMicrocode = true; + # systemd.services.ModemManager = { # enable = true; # wantedBy = [ "multi-user.target" ];