From d69c795c78f2beda1d97068067943516f0921a62 Mon Sep 17 00:00:00 2001 From: Luna B Date: Wed, 8 Jan 2025 16:52:00 +0100 Subject: [PATCH] inori: init module --- modules/lib/maintainers.nix | 6 +++ modules/misc/news.nix | 10 ++++ modules/modules.nix | 1 + modules/programs/inori.nix | 47 +++++++++++++++++++ tests/default.nix | 1 + .../modules/programs/inori/default-config.nix | 11 +++++ tests/modules/programs/inori/default.nix | 4 ++ tests/modules/programs/inori/full-config.nix | 46 ++++++++++++++++++ tests/modules/programs/inori/full-config.toml | 31 ++++++++++++ 9 files changed, 157 insertions(+) create mode 100644 modules/programs/inori.nix create mode 100644 tests/modules/programs/inori/default-config.nix create mode 100644 tests/modules/programs/inori/default.nix create mode 100644 tests/modules/programs/inori/full-config.nix create mode 100644 tests/modules/programs/inori/full-config.toml diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 7ee9e1df9c1b..e3d763ef546f 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -628,4 +628,10 @@ github = "ALameLlama"; githubId = 55490546; }; + lunahd = { + name = "Miku B"; + email = "lunab08@proton.me"; + github = "miku4k"; + githubId = 89653242; + }; } diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 7a3604be91fe..4d3ba11751b2 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1946,6 +1946,7 @@ in { speed, features, or native UIs. Ghostty provides all three. ''; } + { time = "2025-01-04T15:00:00+00:00"; condition = hostPlatform.isLinux; @@ -1960,6 +1961,15 @@ in { as well as wf-shell. ''; } + + { + time = "2025-01-08T15:43:53+00:00"; + message = '' + A new module is available: 'programs.inori'. + + inori is a client for the Music Player Daemon (MPD) + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 2aae09eb12d6..223a288e684d 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -129,6 +129,7 @@ let ./programs/i3status.nix ./programs/imv.nix ./programs/info.nix + ./programs/inori.nix ./programs/ion.nix ./programs/irssi.nix ./programs/java.nix diff --git a/modules/programs/inori.nix b/modules/programs/inori.nix new file mode 100644 index 000000000000..812d546621e7 --- /dev/null +++ b/modules/programs/inori.nix @@ -0,0 +1,47 @@ +{ lib, config, pkgs, ... }: + +with lib; + +let + cfg = config.programs.inori; + + tomlFormat = pkgs.formats.toml { }; +in { + meta.mointoiners = [ hm.maintainers.lunahd ]; + + options.programs.inori = { + enable = mkEnableOption "inori"; + + package = mkOption { + type = types.package; + default = pkgs.inori; + defaultText = literalExpression "pkgs.inori"; + description = "The inori package to use."; + }; + + settings = mkOption { + type = tomlFormat.type; + default = { }; + example = literalExpression '' + { + seek_seconds = 10; + dvorak_keybindings = true; + } + ''; + description = '' + Configuration written to {file}`$XDG_CONFIG_HOME/inori/config.toml`. + + See for available options. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + xdg.configFile."inori/config.toml" = mkIf (cfg.settings != { }) { + source = tomlFormat.generate "config.toml" cfg.settings; + }; + }; +} + diff --git a/tests/default.nix b/tests/default.nix index b95cd16a1c6f..84008a2e001f 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -91,6 +91,7 @@ in import nmtSrc { ./modules/programs/htop ./modules/programs/hyfetch ./modules/programs/i3status + ./modules/programs/inori ./modules/programs/irssi ./modules/programs/jujutsu ./modules/programs/joplin-desktop diff --git a/tests/modules/programs/inori/default-config.nix b/tests/modules/programs/inori/default-config.nix new file mode 100644 index 000000000000..987a3ec55553 --- /dev/null +++ b/tests/modules/programs/inori/default-config.nix @@ -0,0 +1,11 @@ +{ config, ... }: + +{ + config = { + programs.inori.enable = true; + + nmt.script = '' + assertPathNotExist ${config.xdg.configHome}/inori/config.toml + ''; + }; +} diff --git a/tests/modules/programs/inori/default.nix b/tests/modules/programs/inori/default.nix new file mode 100644 index 000000000000..1d03da8bac90 --- /dev/null +++ b/tests/modules/programs/inori/default.nix @@ -0,0 +1,4 @@ +{ + inori-default-config = ./default-config.nix; + inori-full-config = ./full-config.nix; +} diff --git a/tests/modules/programs/inori/full-config.nix b/tests/modules/programs/inori/full-config.nix new file mode 100644 index 000000000000..3cef86049206 --- /dev/null +++ b/tests/modules/programs/inori/full-config.nix @@ -0,0 +1,46 @@ +{ config, ... }: + +{ + config = { + programs.inori = { + enable = true; + patch_array_keybindings = true; + settings = { + seek_seconds = 10; + dvorak_keybindings = true; + keybindings = { + toggle_playpause = [ "p" "" ]; + next_song = [ ">" "C-n" ]; + previous_song = [ "<" "C-p" ]; + seek = ""; + seek_backwards = ""; + + up = "k"; + down = "j"; + left = "h"; + right = "l"; + top = [ "g g" "" ]; + bottom = [ "G" "" ]; + quit = [ "" "q" ]; + }; + theme = { + status_artist.fg = "#fab387"; + status_album.fg = "#89b4fa"; + status_title = { + fg = "#cba6f7"; + add_modifier = "BOLD"; + }; + album.fg = "#89b4fa"; + playing.fg = "#a6e3a1"; + }; + }; + }; + + nmt.script = '' + assertFileExists ${config.xdg.configHome}/inori/config.toml + assertFileContent ${config.xdg.configHome}/inori/config.toml ${ + ./full-config.toml + } + ''; + }; +} diff --git a/tests/modules/programs/inori/full-config.toml b/tests/modules/programs/inori/full-config.toml new file mode 100644 index 000000000000..dffdbff33f53 --- /dev/null +++ b/tests/modules/programs/inori/full-config.toml @@ -0,0 +1,31 @@ +seek_seconds = 10 +dvorak_keybindings = true +[keybindings] +bottom = ["G", ""] +down = "j" +left = "h" +next_song = [">", "C-n"] +previous_song = ["<", "C-p"] +quit = ["", "q"] +right = "l" +seek = "" +seek_backwards = "" +toggle_playpause = ["s p", "s "] +top = ["g g", ""] +up = "k" + +[theme.album] +fg = "#89b4fa" + +[theme.playing] +fg = "#a6e3a1" + +[theme.status_album] +fg = "#89b4fa" + +[theme.status_artist] +fg = "#fab387" + +[theme.status_title] +add_modifier = "BOLD" +fg = "#cba6f7"