mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
anup: add module
This commit is contained in:
parent
e4c7df3a95
commit
55091079d6
4 changed files with 81 additions and 0 deletions
39
modules/programs/anup.nix
Normal file
39
modules/programs/anup.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
||||
14
tests/modules/programs/anup/config.ron
Normal file
14
tests/modules/programs/anup/config.ron
Normal 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",
|
||||
),
|
||||
),
|
||||
)
|
||||
1
tests/modules/programs/anup/default.nix
Normal file
1
tests/modules/programs/anup/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ anup-settings = ./settings.nix; }
|
||||
27
tests/modules/programs/anup/settings.nix
Normal file
27
tests/modules/programs/anup/settings.nix
Normal 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}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue