Usermode spotifyd + spotify-tui

This commit is contained in:
Zuckerberg 2022-03-13 19:59:17 -04:00
parent 1fb16f8cd2
commit 504e4efad6
5 changed files with 101 additions and 2 deletions

View File

@ -12,6 +12,7 @@ in {
./audio.nix ./audio.nix
# ./torbrowser.nix # ./torbrowser.nix
./pithos.nix ./pithos.nix
./spotify.nix
./vscodium.nix ./vscodium.nix
./discord.nix ./discord.nix
./steam.nix ./steam.nix
@ -29,8 +30,19 @@ in {
# Applications # Applications
users.users.googlebot.packages = with pkgs; [ users.users.googlebot.packages = with pkgs; [
chromium keepassxc mumble tigervnc bluez-tools vscodium element-desktop mpv chromium
nextcloud-client signal-desktop minecraft sauerbraten gnome.file-roller spotify keepassxc
mumble
tigervnc
bluez-tools
vscodium
element-desktop
mpv
nextcloud-client
signal-desktop
minecraft
sauerbraten
gnome.file-roller
gparted gparted
]; ];

84
common/pc/spotify.nix Normal file
View File

@ -0,0 +1,84 @@
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.services.spotifyd;
toml = pkgs.formats.toml {};
spotifydConf = toml.generate "spotify.conf" cfg.settings;
in
{
disabledModules = [
"services/audio/spotifyd.nix"
];
options = {
services.spotifyd = {
enable = mkEnableOption "spotifyd, a Spotify playing daemon";
settings = mkOption {
default = {};
type = toml.type;
example = { global.bitrate = 320; };
description = ''
Configuration for Spotifyd. For syntax and directives, see
<link xlink:href="https://github.com/Spotifyd/spotifyd#Configuration"/>.
'';
};
users = mkOption {
type = with types; listOf str;
default = [];
description = ''
Usernames to be added to the "spotifyd" group, so that they
can start and interact with the userspace daemon.
'';
};
};
};
config = mkIf cfg.enable {
# username specific stuff because i'm lazy...
services.spotifyd.users = [ "googlebot" ];
users.users.googlebot.packages = with pkgs; [
spotify
spotify-tui
];
users.groups.spotifyd = {
members = cfg.users;
};
age.secrets.spotifyd = {
file = ../../secrets/spotifyd.age;
group = "spotifyd";
};
# spotifyd to read secrets and run as user service
services.spotifyd = {
settings.global = {
username_cmd = "sed '1q;d' /run/agenix/spotifyd";
password_cmd = "sed '2q;d' /run/agenix/spotifyd";
bitrate = 320;
backend = "pulseaudio";
device_name = config.networking.hostName;
device_type = "computer";
# on_song_change_hook = "command_to_run_on_playback_events"
autoplay = true;
};
};
systemd.user.services.spotifyd-daemon = {
wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" "sound.target" ];
description = "spotifyd, a Spotify playing daemon";
environment.SHELL = "/bin/sh";
serviceConfig = {
ExecStart = "${pkgs.spotifyd}/bin/spotifyd --no-daemon --config-path ${spotifydConf}";
Restart = "always";
CacheDirectory = "spotifyd";
};
};
};
}

View File

@ -54,6 +54,8 @@ in
publicCreateSnapshots = true; publicCreateSnapshots = true;
}; };
services.spotifyd.enable = true;
services.zerotierone.enable = true; services.zerotierone.enable = true;
de.enable = true; de.enable = true;

View File

@ -14,4 +14,5 @@ in
"email-pw.age".publicKeys = all; "email-pw.age".publicKeys = all;
"nextcloud-pw.age".publicKeys = all; "nextcloud-pw.age".publicKeys = all;
"iodine.age".publicKeys = all; "iodine.age".publicKeys = all;
"spotifyd.age".publicKeys = all;
} }

BIN
secrets/spotifyd.age Normal file

Binary file not shown.