Move mpd-index to Server7, c3d2.hq.enableMpdProxy

This commit is contained in:
Emery Hemingway 2020-01-26 13:49:39 +01:00
джерело d17a7e01e9
коміт 6033155062
8 змінених файлів з 79 додано та 87 видалено

@ -11,6 +11,7 @@ rec {
hydra.publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDhurL/sxsXRglKdLfiWIcK+iqpyhGrGt/MoBODsgvig";
mpd-index = { };
pulsebert.publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAnEWn/8CKIiCtehh6Ha3XUQqjODj0ygyo3aGAsFWgfG";
storage-ng.publicKey =

@ -1,61 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, lib, ... }:
{
imports = [
../../../lib/lxc-container.nix
../../../lib/shared.nix
../../../lib/admins.nix
../../../lib
];
c3d2 = {
isInHq = true;
enableHail = true;
};
environment.systemPackages = with pkgs; [ ncmpcpp ];
fileSystems."/mnt/music" = {
fsType = "nfs";
device = "172.22.99.10:/mnt/zroot/storage/rpool/Music";
};
networking.hostName = "mpd-index";
services.openssh = {
enable = true;
permitRootLogin = "yes";
};
services.mpd = {
enable = true;
user = "mpd";
group = "audio";
network = {
listenAddress = "any";
port = 6600;
};
musicDirectory = "/mnt/music";
extraConfig = ''
default_permissions "read,add,control,admin"
input {
plugin "curl"
}
audio_output {
type "null"
name "My Null Output"
}
filesystem_charset "UTF-8"
'';
};
system.stateVersion = "18.09"; # Did you read the comment?
}

@ -23,7 +23,10 @@ in {
c3d2 = {
isInHq = true;
mapHqHosts = true;
hq.interface = "eno1";
hq = {
interface = "eno1";
enableMpdProxy = true;
};
enableHail = true;
};
@ -192,40 +195,46 @@ in {
# should.
system.stateVersion = "18.09"; # Did you read the comment?
# vater hoerte, dass menschen im space gern mpd fuer das abspielen von musik erwarten wuerden
#### https://nixos.org/nixos/options.html#services.mpd.enable
# See ../../mpd.nix
services.mpd.extraConfig =
''
audio_output {
type "pulse"
name "/proc"
}
'';
services.mpd.extraConfig = ''
audio_output {
type "pulse"
name "/proc"
}
'';
services.caddy = {
enable = true;
agree = true;
# TODO: add auth?
config = ''
${mpdVhost} {
proxy / localhost:${toString ympdPort}
}
${mpdVhost} {
proxy / localhost:${toString ympdPort}
}
:80 {
redir https://${mpdVhost}{uri}
}
:80 {
redir https://${mpdVhost}{uri}
}
'';
};
fileSystems."/mnt/storage" = {
#device = "storage-ng.hq.c3d2.de:/mnt/zroot/storage/rpool";
#device = "storage-ng.hq.c3d2.de:/c3d2/rpool";
device = "172.22.99.13:6789,172.22.99.15:6789,172.22.99.16:6789:/c3d2/rpool";
device =
"172.22.99.13:6789,172.22.99.15:6789,172.22.99.16:6789:/c3d2/rpool";
fsType = "ceph";
options = [ "rw" "relatime" "name=public" "secret=AQDgER1chJcMORAAK1ysRTN59B5x/MyniwVXFQ==" "acl" "wsize=16777216" "_netdev" ];
options = [
"rw"
"relatime"
"name=public"
"secret=AQDgER1chJcMORAAK1ysRTN59B5x/MyniwVXFQ=="
"acl"
"wsize=16777216"
"_netdev"
];
};
# MPD music playing daemon with webinterface

@ -2,7 +2,7 @@ name:
(import ../outer-defaults.nix name) // {
config = { config, pkgs, lib, ... }: {
imports = [ (../inner-defaults.nix) (../../../../lib/yggdrasil-hq.nix) ];
imports = [ ../inner-defaults.nix ../../../../lib/yggdrasil-hq.nix ];
services.uhub = {
enable = true;

@ -0,0 +1,33 @@
name:
(import ../outer-defaults.nix name) // {
bindMounts."/mnt/music" = {
hostPath = "/srv/ceph/c3d2/rpool/Music";
isReadOnly = true;
};
config = { config, pkgs, lib, ... }:
{
imports = [ ../inner-defaults.nix ];
services.mpd = {
enable = true;
network.listenAddress = "any";
musicDirectory = "/mnt/music";
extraConfig = ''
default_permissions "read,add,control,admin"
audio_output {
type "null"
name "My Null Output"
}
filesystem_charset "UTF-8"
'';
};
};
}

@ -13,7 +13,6 @@ in {
../../lib/shared.nix
../../lib/users.nix
./ncdc.nix
../../lib/mpd.nix
../../lib/default-gateway.nix
../../lib/emery.nix
];

@ -98,6 +98,11 @@ in {
description = "Whether to enable the local Nix binary cache";
};
enableMpdProxy = mkOption {
type = bool;
default = false;
description = "Whether to proxy the local MPD database";
};
};
@ -123,6 +128,10 @@ in {
assertion = cfg.hq.enableBinaryCache -> cfg.mapHqHosts;
message = "mapHqHosts must be enabled for enableBinaryCache";
}
{
assertion = cfg.hq.enableMpdProxy -> cfg.mapHqHosts;
message = "mapHqHosts must be enabled for enableMpdProxy";
}
];
networking.defaultGateway = mkIfIsInHq "172.22.99.4";
@ -247,6 +256,13 @@ in {
];
};
services.mpd.extraConfig = lib.mkIf cfg.hq.enableMpdProxy ''
database {
plugin "proxy"
host "mpd-index.hq"
}
'';
};
meta.maintainers = with lib.maintainers; [ ehmry ];

@ -13,14 +13,9 @@ let
dbFile = null;
musicDirectory = "/mnt/storage/Music";
playlistDirectory = "/home/k-ot/Playlists";
extraConfig = ''
database {
plugin "proxy"
host "storage-ng.hq.c3d2.de"
}
'';
};
in {
c3d2.hq.enableMpdProxy = true;
services.mpd = (hostMpd // {
enable = true;
network.listenAddress = "any";