home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 59f7dda2598fe34d2ec57aff1d5f02c15963dbc3
parent 8035f22061f9e9a962de573f79b65107aac36feb
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Fri,  7 May 2021 14:05:11 +0200

systems: add a versionOlder on nixos…

… to be able to configure hardware.bluetooth differently between nixos version.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Msystems/modules/hardware/bluetooth.nix | 19++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/systems/modules/hardware/bluetooth.nix b/systems/modules/hardware/bluetooth.nix @@ -1,7 +1,8 @@ { config, lib, pkgs, ... }: let - inherit (lib) mkEnableOption mkIf mkMerge; + inherit (lib) mkEnableOption mkIf mkMerge versionOlder; cfg = config.modules.hardware.bluetooth; + stable = versionOlder config.system.nixos.release "21.05"; in { options.modules.hardware.bluetooth = { @@ -9,7 +10,10 @@ in }; config = mkIf cfg.enable (mkMerge [ - { hardware.bluetooth.enable = true; } + { + hardware.bluetooth.enable = true; + # warnings = if stable then [ ] else [ "NixOS release: ${config.system.nixos.release}" ]; + } (mkIf config.modules.hardware.audio.enable { hardware.pulseaudio = { # NixOS allows either a lightweight build (default) or full build of @@ -19,11 +23,20 @@ in # Enable additional codecs extraModules = [ pkgs.pulseaudio-modules-bt ]; }; - + }) + (mkIf (stable && config.modules.hardware.audio.enable) { hardware.bluetooth.extraConfig = '' [General] Enable=Source,Sink,Media,Socket ''; }) + (mkIf ((!stable) && config.modules.hardware.audio.enable) + { + hardware.bluetooth.settings = { + General = { + Enable = "Source,Sink,Media,Socket"; + }; + }; + }) ]); }