gurk-rs: add module (#7466)

This commit is contained in:
awwpotato
2025-07-13 15:51:03 -07:00
committed by GitHub
parent bf893ad4cb
commit 7969ed8baa
4 changed files with 106 additions and 0 deletions

2
.github/labeler.yml vendored
View File

@@ -108,6 +108,7 @@
- modules/programs/fastfetch.nix
- modules/programs/fd.nix
- modules/programs/fzf.nix
- modules/programs/gurk-rs.nix
- modules/programs/hstr.nix
- modules/programs/htop.nix
- modules/programs/hwatch.nix
@@ -328,6 +329,7 @@
- modules/programs/chawan.nix
- modules/programs/discocss.nix
- modules/programs/element-desktop.nix
- modules/programs/gurk-rs.nix
- modules/programs/halloy.nix
- modules/programs/havoc.nix
- modules/programs/hexchat.nix

View File

@@ -0,0 +1,55 @@
{
lib,
pkgs,
config,
...
}:
let
tomlFormat = pkgs.formats.toml { };
cfg = config.programs.gurk-rs;
in
{
meta.maintainers = [ lib.maintainers.awwpotato ];
options.programs.gurk-rs = {
enable = lib.mkEnableOption "gurk-rs";
package = lib.mkPackageOption pkgs "gurk-rs" { nullable = true; };
settings = lib.mkOption {
inherit (tomlFormat) type;
default = { };
description = ''
Configuration written to {file}`$XDG_CONFIG_HOME/.config/gurk/gurk.toml`
or {file}`Library/Application Support/gurk/gurk.toml`. Options are
declared at <https://github.com/boxdot/gurk-rs/blob/main/src/config.rs>.
Note that `data_path` and `signal_db_path` should be set.
'';
example = lib.literalExpression ''
{
data_path = "/home/USERNAME/.local/share/gurk/gurk.data.json";
signal_db_path = "/home/USERNAME/.local/share/gurk/signal-db";
first_name_only = false;
show_receipts = true;
notifications = true;
bell = true;
colored_messages = false;
default_keybindings = true;
user = {
name = "MYNAME";
phone_number = "MYNUMBER";
};
keybindings = { };
}
'';
};
};
config = lib.mkIf cfg.enable {
home.package = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file."${
if pkgs.stdenv.hostPlatform.isDarwin then "Library/Application Support" else config.xdg.configHome
}/gurk/gurk.toml".source =
lib.mkIf (cfg.settings != { }) (tomlFormat.generate "gurk-config" cfg.settings);
};
}

View File

@@ -0,0 +1,46 @@
{ pkgs, ... }:
{
programs.gurk-rs = {
enable = true;
settings = {
first_name_only = false;
show_receipts = true;
notifications = true;
bell = true;
colored_messages = false;
default_keybindings = true;
user = {
name = "MYNAME";
phone_number = "MYNUMBER";
};
keybindings = { };
};
};
nmt.script =
let
configFile =
if pkgs.stdenv.isDarwin then
"home-files/Library/Application\\ Support/gurk/gurk.toml"
else
"home-files/.config/gurk/gurk.toml";
in
''
assertFileExists ${configFile}
assertFileContent ${configFile} \
${pkgs.writeText "settings-expected" ''
bell = true
colored_messages = false
default_keybindings = true
first_name_only = false
notifications = true
show_receipts = true
[keybindings]
[user]
name = "MYNAME"
phone_number = "MYNUMBER"
''}
'';
}

View File

@@ -0,0 +1,3 @@
{
gurk-rs-basic-config = ./basic-config.nix;
}