System/home-manager/linux/programs/media.nix

87 lines
2.3 KiB
Nix

{ config, nixosConfig, lib, pkgs, inputs, ... }:
let
unstable = import inputs.nixpkgs-unstable {
config = { allowUnfree = true; };
system = pkgs.system;
};
in {
config = lib.mkMerge [
(lib.mkIf config.nathan.programs.media.enable {
# General Packages
home.packages = with pkgs; [
spotify
unstable.haruna
unstable.jellyfin-media-player
nicotine-plus
picard
mpc-cli
calibre
playerctl
ncmpcpp
ario
libsForQt5.kdenlive
mediainfo
glaxnimate
];
# Register haruna as the default video player
xdg.mimeApps.defaultApplications = {
"video/mp4" = [ "haruna.desktop" ];
"video/avi" = [ "haruna.desktop" ];
"video/AV1" = [ "haruna.desktop" ];
"video/H264" = [ "haruna.desktop" ];
"video/H265" = [ "haruna.desktop" ];
};
# Mopidy service
# TODO: Add scrobbling
services.mopidy = {
enable = true;
extensionPackages = with pkgs; [
mopidy-mpd
mopidy-iris
mopidy-scrobbler
mopidy-local
mopidy-mpris
];
# extraConfigFiles = config.nathan.programs.media.mopidyExtraConfig;
settings = {
file = { media_dirs = [ "~/Music" ]; };
local = {
enabled = true;
media_dir = "~/Music";
};
mpd = { enabled = true; };
mpris = { enabled = true; };
};
extraConfigFiles = [ nixosConfig.sops.secrets."last.fm".path ];
};
# Setup obs
programs.obs-studio = {
enable = true;
plugins = with pkgs.obs-studio-plugins; [
wlrobs
obs-vaapi
obs-gstreamer
input-overlay
looking-glass-obs
];
};
})
(lib.mkIf (config.nathan.programs.media.enable
&& config.nathan.programs.media.nicotineService) {
systemd.user.services.nicotine = {
Unit = {
Description = "Nicotine++";
After = [ "graphical-session.target" ];
};
Service = {
Type = "simple";
ExecStart = ''
${pkgs.nicotine-plus}/bin/nicotine -s
'';
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
})
];
}