mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-12 01:59:37 +08:00
gurk-rs: add module (#7466)
This commit is contained in:
2
.github/labeler.yml
vendored
2
.github/labeler.yml
vendored
@@ -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
|
||||
|
||||
55
modules/programs/gurk-rs.nix
Normal file
55
modules/programs/gurk-rs.nix
Normal 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);
|
||||
};
|
||||
}
|
||||
46
tests/modules/programs/gurk-rs/basic-config.nix
Normal file
46
tests/modules/programs/gurk-rs/basic-config.nix
Normal 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"
|
||||
''}
|
||||
'';
|
||||
}
|
||||
3
tests/modules/programs/gurk-rs/default.nix
Normal file
3
tests/modules/programs/gurk-rs/default.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
gurk-rs-basic-config = ./basic-config.nix;
|
||||
}
|
||||
Reference in New Issue
Block a user