refactor!: switch to dendritic pattern
BREAKING CHANGE: complete reorganization of the repository
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
{config, ...}: let
|
||||
m = config.flake.modules.homeManager;
|
||||
in {
|
||||
flake.modules.homeManager.media = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.media;
|
||||
in {
|
||||
imports = [
|
||||
m.mopidy
|
||||
m.mpd
|
||||
m.mpd-mpris
|
||||
m.mpv
|
||||
m.ncmpcpp
|
||||
m.streamlink
|
||||
];
|
||||
|
||||
options.home.media.fullDesktop = mkEnableOption "Enables everything";
|
||||
config.home.media = {
|
||||
mopidy.enable = mkDefault cfg.fullDesktop;
|
||||
mpd.enable = mkDefault (cfg.fullDesktop or cfg.mpd-mpris.enable);
|
||||
mpv.enable = mkDefault cfg.fullDesktop;
|
||||
ncmpcpp.enable = mkDefault config.home.media.mpd.enable;
|
||||
streamlink.enable = mkDefault config.home.media.mpv.enable;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
{
|
||||
flake.modules.homeManager.mopidy = {
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.media.mopidy;
|
||||
in {
|
||||
options.home.media.mopidy = {
|
||||
enable = mkEnableOption "Enables Mopidy.";
|
||||
};
|
||||
|
||||
config.services.mopidy = mkIf cfg.enable {
|
||||
inherit (cfg) enable;
|
||||
extensionPackages = with pkgs; [
|
||||
mopidy-bandcamp
|
||||
mopidy-mpd
|
||||
mopidy-mpris
|
||||
mopidy-muse
|
||||
mopidy-notify
|
||||
mopidy-spotify
|
||||
];
|
||||
extraConfigFiles = [
|
||||
config.sops.secrets."mopidy/bandcamp".path
|
||||
config.sops.secrets."mopidy/spotify".path
|
||||
];
|
||||
settings = {
|
||||
mpd = {
|
||||
enabled = true;
|
||||
hostname = "::";
|
||||
port = 6600;
|
||||
};
|
||||
mpris.enabled = true;
|
||||
muse = {
|
||||
enabled = true;
|
||||
mopidy_host = "localhost";
|
||||
mopidy_port = 6690;
|
||||
mopidy_ssl = false;
|
||||
snapcast_host = "localhost";
|
||||
snapcast_port = 1780;
|
||||
snapcast_ssl = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
flake.modules.homeManager.mpd-mpris = {
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.media.mpd-mpris;
|
||||
cfgMpd = config.home.media.mpd;
|
||||
in {
|
||||
options.home.media.mpd-mpris.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = cfgMpd.enable;
|
||||
example = false;
|
||||
};
|
||||
config.services.mpd-mpris.enable = cfg.enable;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
flake.modules.homeManager.mpd = {
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.media.mpd;
|
||||
in {
|
||||
options.home.media.mpd.enable = mkEnableOption "Enables MPD";
|
||||
config.services.mpd = mkIf cfg.enable {
|
||||
inherit (cfg) enable;
|
||||
musicDirectory = "${config.home.homeDirectory}/Music";
|
||||
playlistDirectory = "${config.home.homeDirectory}/Music/playlists";
|
||||
network.startWhenNeeded = true;
|
||||
extraConfig = ''
|
||||
follow_outside_symlinks "yes"
|
||||
follow_inside_symlinks "yes"
|
||||
|
||||
bind_to_address "localhost"
|
||||
auto_update "yes"
|
||||
|
||||
audio_output {
|
||||
type "pipewire"
|
||||
name "PipeWire"
|
||||
}
|
||||
|
||||
audio_output {
|
||||
type "fifo"
|
||||
name "my_fifo"
|
||||
path "/tmp/mpd.fifo"
|
||||
format "44100:16:2"
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
{
|
||||
flake.modules.homeManager.mpv = {
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.media.mpv;
|
||||
in {
|
||||
options.home.media.mpv.enable = mkEnableOption "Enable MPV";
|
||||
config.programs.mpv = mkIf cfg.enable {
|
||||
inherit (cfg) enable;
|
||||
config = {
|
||||
force-window = "immediate";
|
||||
force-seekable = true; # force streams to be seekable
|
||||
slang = "jpn,jp,eng,en,fra,fr";
|
||||
alang = "eng,en,fra,fr";
|
||||
gpu-api = "auto";
|
||||
osc = true;
|
||||
profile = "gpu-hq";
|
||||
# geometry = "50%x50%";
|
||||
# autofit-larger = "90%x90%";
|
||||
|
||||
# Screenshots
|
||||
screenshot-format = "png";
|
||||
screenshot-high-bit-depth = true;
|
||||
screenshot-png-compression = 6;
|
||||
screenshot-directory = "${config.home.homeDirectory}/Pictures/Screenshots/mpv";
|
||||
|
||||
deband = true;
|
||||
deband-iterations = 2;
|
||||
deband-threshold = 35;
|
||||
deband-range = 20;
|
||||
|
||||
dither-depth = "auto";
|
||||
|
||||
sub-auto = "fuzzy";
|
||||
|
||||
scale = "ewa_lanczossharp";
|
||||
cscale = "ewa_lanczossharp";
|
||||
};
|
||||
scripts = with pkgs.mpvScripts; [
|
||||
crop
|
||||
encode
|
||||
inhibit-gnome
|
||||
mpris
|
||||
mpv-cheatsheet-ng
|
||||
quality-menu
|
||||
sponsorblock
|
||||
thumbfast
|
||||
twitch-chat
|
||||
youtube-chat
|
||||
youtube-upnext
|
||||
];
|
||||
bindings = {
|
||||
Q = "quit-watch-later";
|
||||
P = "show-progress";
|
||||
"/" = "add volume -2";
|
||||
"*" = "add volume 2";
|
||||
m = "cycle mute";
|
||||
M = "vf toggle hflip";
|
||||
"Ctrl+r" = "cycle_values video-rotate \"90\" \"180\" \"270\" \"0\"";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
{
|
||||
flake.modules.homeManager.ncmpcpp = {
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.media.ncmpcpp;
|
||||
in {
|
||||
options.home.media.ncmpcpp.enable = mkEnableOption "Enable ncmpcpp";
|
||||
config.programs.ncmpcpp = let
|
||||
musicDir = config.services.mpd.musicDirectory;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
inherit (cfg) enable;
|
||||
mpdMusicDir = musicDir;
|
||||
settings = {
|
||||
# directories
|
||||
ncmpcpp_directory = "${config.home.homeDirectory}/.config/ncmpcpp";
|
||||
lyrics_directory = "${musicDir}/.lyrics";
|
||||
|
||||
# MPD
|
||||
mpd_host = "localhost";
|
||||
mpd_port = 6600;
|
||||
mpd_connection_timeout = 5;
|
||||
mpd_crossfade_time = 0;
|
||||
|
||||
# music visualizer
|
||||
visualizer_output_name = "my_fifo";
|
||||
visualizer_in_stereo = "yes";
|
||||
# visualizer_type = "spectrum";
|
||||
visualizer_look = "+|";
|
||||
visualizer_color = "blue, cyan, green, yellow, magenta, red";
|
||||
|
||||
system_encoding = "UTF-8";
|
||||
|
||||
# song format
|
||||
song_list_format = "(6)[]{} (23)[red]{a} (26)[yellow]{t|f} (40)[green]{b} (4)[blue]{l}";
|
||||
now_playing_prefix = "$b";
|
||||
now_playing_suffix = "$8$/b";
|
||||
|
||||
# columns settings
|
||||
song_columns_list_format = "(6)[]{} (23)[red]{a} (26)[yellow]{t|f} (40)[green]{b} (4)[blue]{l}";
|
||||
|
||||
playlist_shorten_total_times = "yes";
|
||||
playlist_display_mode = "columns";
|
||||
browser_display_mode = "columns";
|
||||
search_engine_display_mode = "columns";
|
||||
playlist_editor_display_mode = "columns";
|
||||
autocenter_mode = "yes";
|
||||
centered_cursor = "yes";
|
||||
|
||||
progressbar_look = "─> ";
|
||||
header_visibility = "no";
|
||||
statusbar_visibility = "no";
|
||||
titles_visibility = "no";
|
||||
allow_for_physical_item_deletion = "yes";
|
||||
|
||||
lastfm_preferred_language = "en";
|
||||
space_add_mode = "add_remove";
|
||||
|
||||
locked_screen_width_part = "50";
|
||||
ask_for_locked_screen_width_part = "yes";
|
||||
jump_to_now_playing_song_at_start = "yes";
|
||||
ask_before_clearing_playlists = "yes";
|
||||
clock_display_seconds = "no";
|
||||
display_volume_level = "yes";
|
||||
display_bitrate = "no";
|
||||
display_remaining_time = "yes";
|
||||
regular_expressions = "extended";
|
||||
ignore_leading_the = "yes";
|
||||
ignore_diacritics = "yes";
|
||||
mouse_support = "no";
|
||||
tags_separator = ";";
|
||||
enable_window_title = "yes";
|
||||
search_engine_default_search_mode = 1;
|
||||
external_editor = "emacsclient -c";
|
||||
use_console_editor = "yes";
|
||||
|
||||
# colours
|
||||
colors_enabled = "yes";
|
||||
volume_color = "default";
|
||||
progressbar_color = "black";
|
||||
progressbar_elapsed_color = "white";
|
||||
statusbar_color = "white";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
flake.modules.homeManager.streamlink = {
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.media.streamlink;
|
||||
in {
|
||||
options.home.media.streamlink.enable = mkEnableOption "Enable Streamlink";
|
||||
config.programs.streamlink = mkIf cfg.enable {
|
||||
enable = true;
|
||||
settings = {
|
||||
player = "${pkgs.mpv}/bin/mpv";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user