Add spotify as an audio option
Adds a `config.pub-solar.audio.spotify` option that when enabled installs and configures `spotifyd` as a systemd daemon and `spotify-tui` as the terminal-based UI. After enabling, run `spt` in the terminal to open the UI.
This commit is contained in:
parent
fd50ecf445
commit
c2bc749beb
|
@ -9,10 +9,21 @@ in
|
||||||
options.pub-solar.audio = {
|
options.pub-solar.audio = {
|
||||||
enable = mkEnableOption "Life in highs and lows";
|
enable = mkEnableOption "Life in highs and lows";
|
||||||
mopidy.enable = mkEnableOption "Life with mopidy";
|
mopidy.enable = mkEnableOption "Life with mopidy";
|
||||||
|
spotify.enable = mkEnableOption "Life in DRM";
|
||||||
|
spotify.username = mkOption {
|
||||||
|
description = "Spotify login username or email";
|
||||||
|
type = types.str;
|
||||||
|
example = "yourname@example.com";
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
bluetooth.enable = mkEnableOption "Life with bluetooth";
|
bluetooth.enable = mkEnableOption "Life with bluetooth";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
users.users = pkgs.lib.setAttrByPath [ psCfg.user.name ] {
|
||||||
|
extraGroups = [ "audio" ];
|
||||||
|
};
|
||||||
|
|
||||||
home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] {
|
home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] {
|
||||||
home.packages = [
|
home.packages = [
|
||||||
# easyeffects, e.g. for microphone noise filtering
|
# easyeffects, e.g. for microphone noise filtering
|
||||||
|
@ -24,9 +35,23 @@ in
|
||||||
# Needed for pactl cmd, until pw-cli is more mature (vol up/down hotkeys?)
|
# Needed for pactl cmd, until pw-cli is more mature (vol up/down hotkeys?)
|
||||||
pulseaudio
|
pulseaudio
|
||||||
vimpc
|
vimpc
|
||||||
];
|
] ++ (if cfg.spotify.enable then [ pkgs.spotify-tui ] else [ ]);
|
||||||
xdg.configFile."vimpc/vimpcrc".source = ./.config/vimpc/vimpcrc;
|
xdg.configFile."vimpc/vimpcrc".source = ./.config/vimpc/vimpcrc;
|
||||||
systemd.user.services.easyeffects = import ./easyeffects.service.nix pkgs;
|
systemd.user.services.easyeffects = import ./easyeffects.service.nix pkgs;
|
||||||
|
|
||||||
|
services.spotifyd = mkIf cfg.spotify.enable {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
global = {
|
||||||
|
username = cfg.spotify.username;
|
||||||
|
password_cmd = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus ${pkgs.libsecret}/bin/secret-tool lookup spotify password";
|
||||||
|
bitrate = 320;
|
||||||
|
volume_normalisation = true;
|
||||||
|
no_audio_cache = false;
|
||||||
|
max_cache_size = 1000000000;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Enable sound using pipewire-pulse
|
# Enable sound using pipewire-pulse
|
||||||
|
|
|
@ -16,7 +16,13 @@ in
|
||||||
# home to /home/username, useDefaultShell to true, and isSystemUser to false.
|
# home to /home/username, useDefaultShell to true, and isSystemUser to false.
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
description = psCfg.user.description;
|
description = psCfg.user.description;
|
||||||
extraGroups = [ "wheel" "docker" "input" "audio" "networkmanager" "lp" "scanner" ];
|
extraGroups = [
|
||||||
|
"wheel"
|
||||||
|
"input"
|
||||||
|
"networkmanager"
|
||||||
|
"lp"
|
||||||
|
"scanner"
|
||||||
|
];
|
||||||
initialHashedPassword = if psCfg.user.password != null then psCfg.user.password else "";
|
initialHashedPassword = if psCfg.user.password != null then psCfg.user.password else "";
|
||||||
shell = pkgs.zsh;
|
shell = pkgs.zsh;
|
||||||
openssh.authorizedKeys.keyFiles = if psCfg.user.publicKeys != null then psCfg.user.publicKeys else [ ];
|
openssh.authorizedKeys.keyFiles = if psCfg.user.publicKeys != null then psCfg.user.publicKeys else [ ];
|
||||||
|
|
Loading…
Reference in a new issue