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:
parent
211594c88d
commit
7ec621b510
6 changed files with 127 additions and 0 deletions
13
modules/misc/news/2025/11/2025-11-15_09-54-20.nix
Normal file
13
modules/misc/news/2025/11/2025-11-15_09-54-20.nix
Normal 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.
|
||||
'';
|
||||
}
|
||||
61
modules/programs/bluetuith.nix
Normal file
61
modules/programs/bluetuith.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
||||
5
tests/modules/programs/bluetuith/default.nix
Normal file
5
tests/modules/programs/bluetuith/default.nix
Normal 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;
|
||||
}
|
||||
13
tests/modules/programs/bluetuith/empty-settings.nix
Normal file
13
tests/modules/programs/bluetuith/empty-settings.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
config = {
|
||||
programs.bluetuith = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/bluetuith
|
||||
'';
|
||||
};
|
||||
}
|
||||
25
tests/modules/programs/bluetuith/example-settings.nix
Normal file
25
tests/modules/programs/bluetuith/example-settings.nix
Normal 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}
|
||||
'';
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"adapter": "hci0",
|
||||
"keybindings": {
|
||||
"Menu": "Alt-m"
|
||||
},
|
||||
"receive-dir": "/home/user/files",
|
||||
"theme": {
|
||||
"Adapter": "red"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue