mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-12 00:18:59 +00:00
users/foo-dogsquared/setups/music: add Spotify subsection of the module
This commit is contained in:
parent
35548a428a
commit
316df74307
@ -74,6 +74,7 @@ in
|
|||||||
fonts.enable = true;
|
fonts.enable = true;
|
||||||
music.enable = true;
|
music.enable = true;
|
||||||
music.mpd.enable = true;
|
music.mpd.enable = true;
|
||||||
|
music.spotify.enable = true;
|
||||||
research.enable = true;
|
research.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
{ config, lib, pkgs, ... }@attrs:
|
{ config, lib, pkgs, foodogsquaredLib, ... }@attrs:
|
||||||
|
|
||||||
let
|
let
|
||||||
userCfg = config.users.foo-dogsquared;
|
userCfg = config.users.foo-dogsquared;
|
||||||
cfg = userCfg.setups.music;
|
cfg = userCfg.setups.music;
|
||||||
|
|
||||||
|
isFilesystemSet = setupName:
|
||||||
|
attrs.nixosConfig.suites.filesystem.setups.${setupName}.enable or false;
|
||||||
|
|
||||||
musicDir = config.xdg.userDirs.music;
|
musicDir = config.xdg.userDirs.music;
|
||||||
playlistsDir = "${musicDir}/playlists";
|
playlistsDir = "${musicDir}/playlists";
|
||||||
in
|
in
|
||||||
@ -11,6 +14,7 @@ in
|
|||||||
options.users.foo-dogsquared.setups.music = {
|
options.users.foo-dogsquared.setups.music = {
|
||||||
enable = lib.mkEnableOption "foo-dogsquared's music setup";
|
enable = lib.mkEnableOption "foo-dogsquared's music setup";
|
||||||
mpd.enable = lib.mkEnableOption "foo-dogsquared's MPD server setup";
|
mpd.enable = lib.mkEnableOption "foo-dogsquared's MPD server setup";
|
||||||
|
spotify.enable = lib.mkEnableOption "music streaming setup with Spotify";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable (lib.mkMerge [
|
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||||
@ -112,6 +116,25 @@ in
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(lib.mkIf cfg.spotify.enable {
|
||||||
|
home.packages = with pkgs; [ spotify ];
|
||||||
|
|
||||||
|
state.ports.spotifyd.value = 9009;
|
||||||
|
|
||||||
|
services.spotifyd = {
|
||||||
|
enable = true;
|
||||||
|
settings.global = {
|
||||||
|
use_mpris = true;
|
||||||
|
device_name = "My laptop";
|
||||||
|
bitrate = 320;
|
||||||
|
device_type = "computer";
|
||||||
|
zeroconf_port = config.state.ports.spotifyd.value;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.mopidy.extensionPackages = [ pkgs.mopidy-spotify ];
|
||||||
|
})
|
||||||
|
|
||||||
(lib.mkIf cfg.mpd.enable {
|
(lib.mkIf cfg.mpd.enable {
|
||||||
state.ports.mopidy.value = 6680;
|
state.ports.mopidy.value = 6680;
|
||||||
|
|
||||||
@ -140,10 +163,10 @@ in
|
|||||||
"$XDG_MUSIC_DIR|Music"
|
"$XDG_MUSIC_DIR|Music"
|
||||||
"~/library/music|Library"
|
"~/library/music|Library"
|
||||||
]
|
]
|
||||||
++ lib.optional (attrs.nixosConfig.suites.filesystem.setups.external-hdd.enable or false)
|
++ lib.optional (isFilesystemSet "external-hdd")
|
||||||
"/mnt/external-storage/Music|External storage"
|
"${attrs.nixosConfig.state.paths.external-hdd}/Music|External storage"
|
||||||
++ lib.optional (attrs.nixosConfig.suites.filesystem.setups.archive.enable or false)
|
++ lib.optional (isFilesystemSet "archive")
|
||||||
"/mnt/archives/Music|Archive";
|
"${attrs.nixosConfig.state.paths.archive}/Music|Archive";
|
||||||
};
|
};
|
||||||
|
|
||||||
internetarchive = {
|
internetarchive = {
|
||||||
|
Loading…
Reference in New Issue
Block a user