1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-02 23:21:02 +01:00

bluetuith: add module

Create the `programs.bluetuith` module with support for defining
settings.
This commit is contained in:
Poseidon 2025-11-10 17:32:16 -06:00 committed by Robert Helgesson
parent 211594c88d
commit 7ec621b510
6 changed files with 127 additions and 0 deletions

View file

@ -0,0 +1,13 @@
{ pkgs, ... }:
{
time = "2025-11-15T08:54:20+00:00";
condition = pkgs.stdenv.hostPlatform.isLinux;
message = ''
A new module is available: 'programs.bluetuith'.
bluetuith is a TUI-based Bluetooth connection manager, which can interact
with Bluetooth adapters and devices. It aims to be a replacement to most
Bluetooth managers, like blueman.
'';
}

View file

@ -0,0 +1,61 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.bluetuith;
jsonFormat = pkgs.formats.json { };
in
{
meta.maintainers = with lib.hm.maintainers; [
poseidon-rises
];
options.programs.bluetuith = {
enable = lib.mkEnableOption "Bluetuith";
package = lib.mkPackageOption pkgs "bluetuith" { nullable = true; };
settings = lib.mkOption {
type = jsonFormat.type;
default = { };
example = lib.literalExpression ''
{
adapter = "hci0";
receive-dir = "/home/user/files";
keybindings = {
Menu = "Alt+m";
};
theme = {
Adapter = "red";
};
}
'';
description = ''
Configuration written to
{file}`$XDG_CONFIG_HOME/bluetuith/bluetuith.conf`.
See <https://bluetuith-org.github.io/bluetuith/Configuration.html> for
details.
'';
};
};
config = lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "programs.bluetuith" pkgs lib.platforms.linux)
];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."bluetuith/bluetuith.conf" = lib.mkIf (cfg.settings != { }) {
source = jsonFormat.generate "bluetuith.conf" cfg.settings;
};
};
}

View file

@ -0,0 +1,5 @@
{ lib, pkgs, ... }:
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
bluetuith-empty-settings = ./empty-settings.nix;
bluetuith-example-settings = ./example-settings.nix;
}

View file

@ -0,0 +1,13 @@
{ config, ... }:
{
config = {
programs.bluetuith = {
enable = true;
package = config.lib.test.mkStubPackage { };
};
nmt.script = ''
assertPathNotExists home-files/.config/bluetuith
'';
};
}

View file

@ -0,0 +1,25 @@
{
programs.bluetuith = {
enable = true;
settings = {
adapter = "hci0";
receive-dir = "/home/user/files";
keybindings = {
Menu = "Alt-m";
};
theme = {
Adapter = "red";
};
};
};
nmt.script = ''
assertFileContent \
"home-files/.config/bluetuith/bluetuith.conf" \
${./expected-settings-output.conf}
'';
}

View file

@ -0,0 +1,10 @@
{
"adapter": "hci0",
"keybindings": {
"Menu": "Alt-m"
},
"receive-dir": "/home/user/files",
"theme": {
"Adapter": "red"
}
}