1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

anup: add module

This commit is contained in:
Aguirre Matteo 2025-10-10 15:56:44 -03:00 committed by Austin Horstman
parent e4c7df3a95
commit 55091079d6
4 changed files with 81 additions and 0 deletions

39
modules/programs/anup.nix Normal file
View file

@ -0,0 +1,39 @@
{
lib,
pkgs,
config,
...
}:
let
inherit (lib)
types
mkIf
mkEnableOption
mkPackageOption
mkOption
;
cfg = config.programs.anup;
in
{
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
options.programs.anup = {
enable = mkEnableOption "anup";
package = mkPackageOption pkgs "anup" { nullable = true; };
config = mkOption {
type = with types; either str path;
default = "";
description = ''
Config file for anup in RON (Rusty Object Notation) format.
Available options can be found by looking at ~/.config/anup/config.ron.
'';
};
};
config = mkIf cfg.enable {
home.packages = mkIf (cfg.package != null) [ cfg.package ];
home.file.".config/anup/config.ron" = mkIf (cfg.config != "") {
source = if lib.isPath cfg.config then cfg.config else pkgs.writeText "anup-config.ron" cfg.config;
};
};
}

View file

@ -0,0 +1,14 @@
(
series_dir: "/home/matteo/anime",
reset_dates_on_rewatch: false,
episode: (
percent_watched_to_progress: (50.0),
player: "mpv",
player_args: [],
),
tui: (
keys: (
play_next_episode: "enter",
),
),
)

View file

@ -0,0 +1 @@
{ anup-settings = ./settings.nix; }

View file

@ -0,0 +1,27 @@
{
programs.anup = {
enable = true;
config = ''
(
series_dir: "/home/matteo/anime",
reset_dates_on_rewatch: false,
episode: (
percent_watched_to_progress: (50.0),
player: "mpv",
player_args: [],
),
tui: (
keys: (
play_next_episode: "enter",
),
),
)
'';
};
nmt.script = ''
assertFileExists home-files/.config/anup/config.ron
assertFileContent home-files/.config/anup/config.ron \
${./config.ron}
'';
}