chore: refactor user modules

This commit is contained in:
2025-07-27 22:50:25 +02:00
parent af1a606c1a
commit d200079cdb
94 changed files with 832 additions and 665 deletions

View File

@@ -0,0 +1,22 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.home.media;
in {
imports = [
./mopidy.nix
./mpd.nix
./mpd-mpris.nix
./mpv.nix
];
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;
};
}

View File

@@ -0,0 +1,46 @@
{
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;
};
};
};
}

View File

@@ -0,0 +1,16 @@
{
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;
}

View File

@@ -0,0 +1,30 @@
{
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 "fifo"
name "my_fifo"
path "/tmp/mpd.fifo"
format "44100:16:2"
}
'';
};
}

View File

@@ -0,0 +1,65 @@
{
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 = "vulkan";
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
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\"";
};
};
}