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

78 lines
2.2 KiB
Nix

{ config, nixosConfig, lib, pkgs, inputs, ... }:
let
unstable = import inputs.nixpkgs-unstable {
config = { allowUnfree = true; };
system = pkgs.system;
};
irisDesktopItem = pkgs.makeDesktopItem {
name = "iris";
desktopName = "Iris";
exec =
''${pkgs.chromium}/bin/chromium "--app=http://localhost:6680/iris/"'';
terminal = false;
};
in {
config = lib.mkMerge [
(lib.mkIf config.nathan.programs.media.enable {
# General Packages
home.packages = with pkgs; [
spotify
unstable.haruna
unstable.jellyfin-media-player
unstable.obs-studio
nicotine-plus
irisDesktopItem
picard
mpc-cli
calibre
playerctl
];
# 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
];
# extraConfigFiles = config.nathan.programs.media.mopidyExtraConfig;
settings = {
file = { media_dirs = [ "~/Music" ]; };
local = {
enabled = true;
media_dir = "~/Music";
};
mpd = { enabled = true; };
};
extraConfigFiles = [ nixosConfig.sops.secrets."last.fm".path ];
};
})
(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" ]; };
};
})
];
}