Browse Source

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

storage-ng
Emery Hemingway 2 months ago
parent
commit
6033155062

+ 1
- 0
host-registry.nix View File

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

+ 0
- 61
hosts/containers/mpd-index/configuration.nix View File

@@ -1,61 +0,0 @@
1
-# Edit this configuration file to define what should be installed on
2
-# your system.  Help is available in the configuration.nix(5) man page
3
-# and in the NixOS manual (accessible by running ‘nixos-help’).
4
-
5
-{ config, pkgs, lib, ... }:
6
-
7
-{
8
-  imports = [
9
-    ../../../lib/lxc-container.nix
10
-    ../../../lib/shared.nix
11
-    ../../../lib/admins.nix
12
-    ../../../lib
13
-  ];
14
-
15
-  c3d2 = {
16
-    isInHq = true;
17
-    enableHail = true;
18
-  };
19
-
20
-  environment.systemPackages = with pkgs; [ ncmpcpp ];
21
-
22
-  fileSystems."/mnt/music" = {
23
-    fsType = "nfs";
24
-    device = "172.22.99.10:/mnt/zroot/storage/rpool/Music";
25
-  };
26
-
27
-  networking.hostName = "mpd-index";
28
-
29
-  services.openssh = {
30
-    enable = true;
31
-    permitRootLogin = "yes";
32
-  };
33
-
34
-  services.mpd = {
35
-    enable = true;
36
-    user = "mpd";
37
-    group = "audio";
38
-    network = {
39
-      listenAddress = "any";
40
-      port = 6600;
41
-    };
42
-    musicDirectory  = "/mnt/music";
43
-    extraConfig = ''
44
-      default_permissions "read,add,control,admin"
45
-
46
-      input {
47
-        plugin "curl"
48
-      }
49
-
50
-      audio_output {
51
-        type "null"
52
-        name "My Null Output"
53
-      }
54
-
55
-      filesystem_charset "UTF-8"
56
-    '';
57
-  };
58
-
59
-  system.stateVersion = "18.09"; # Did you read the comment?
60
-
61
-}

+ 27
- 18
hosts/pulsebert/configuration.nix View File

@@ -23,7 +23,10 @@ in {
23 23
   c3d2 = {
24 24
     isInHq = true;
25 25
     mapHqHosts = true;
26
-    hq.interface = "eno1";
26
+    hq = {
27
+      interface = "eno1";
28
+      enableMpdProxy = true;
29
+    };
27 30
     enableHail = true;
28 31
   };
29 32
 
@@ -192,40 +195,46 @@ in {
192 195
   # should.
193 196
   system.stateVersion = "18.09"; # Did you read the comment?
194 197
 
195
-
196 198
   # vater hoerte, dass menschen im space gern mpd fuer das abspielen von musik erwarten wuerden
197 199
   ####	https://nixos.org/nixos/options.html#services.mpd.enable
198 200
   # See ../../mpd.nix
199
-  services.mpd.extraConfig =
200
-    ''
201
-	audio_output {
202
-		type "pulse"
203
-		name "/proc"
204
-	}
205
-    '';
201
+  services.mpd.extraConfig = ''
202
+    audio_output {
203
+    	type "pulse"
204
+    	name "/proc"
205
+    }
206
+  '';
206 207
 
207 208
   services.caddy = {
208 209
     enable = true;
209 210
     agree = true;
210 211
     # TODO: add auth?
211 212
     config = ''
212
-        ${mpdVhost} {
213
-          proxy / localhost:${toString ympdPort}
214
-        }
213
+      ${mpdVhost} {
214
+        proxy / localhost:${toString ympdPort}
215
+      }
215 216
 
216
-        :80 {
217
-          redir https://${mpdVhost}{uri}
218
-        }
217
+      :80 {
218
+        redir https://${mpdVhost}{uri}
219
+      }
219 220
     '';
220 221
   };
221 222
 
222
-
223 223
   fileSystems."/mnt/storage" = {
224 224
     #device = "storage-ng.hq.c3d2.de:/mnt/zroot/storage/rpool";
225 225
     #device = "storage-ng.hq.c3d2.de:/c3d2/rpool";
226
-    device = "172.22.99.13:6789,172.22.99.15:6789,172.22.99.16:6789:/c3d2/rpool";
226
+    device =
227
+      "172.22.99.13:6789,172.22.99.15:6789,172.22.99.16:6789:/c3d2/rpool";
227 228
     fsType = "ceph";
228
-    options = [ "rw" "relatime" "name=public" "secret=AQDgER1chJcMORAAK1ysRTN59B5x/MyniwVXFQ==" "acl" "wsize=16777216" "_netdev" ];
229
+    options = [
230
+      "rw"
231
+      "relatime"
232
+      "name=public"
233
+      "secret=AQDgER1chJcMORAAK1ysRTN59B5x/MyniwVXFQ=="
234
+      "acl"
235
+      "wsize=16777216"
236
+      "_netdev"
237
+    ];
229 238
   };
230 239
 
231 240
   # MPD music playing daemon with webinterface

+ 1
- 1
hosts/server7/containers/adc/default.nix View File

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

+ 33
- 0
hosts/server7/containers/mpd-index/default.nix View File

@@ -0,0 +1,33 @@
1
+name:
2
+
3
+(import ../outer-defaults.nix name) // {
4
+
5
+  bindMounts."/mnt/music" = {
6
+    hostPath = "/srv/ceph/c3d2/rpool/Music";
7
+    isReadOnly = true;
8
+  };
9
+
10
+  config = { config, pkgs, lib, ... }:
11
+
12
+    {
13
+      imports = [ ../inner-defaults.nix ];
14
+
15
+      services.mpd = {
16
+        enable = true;
17
+        network.listenAddress = "any";
18
+        musicDirectory = "/mnt/music";
19
+        extraConfig = ''
20
+          default_permissions "read,add,control,admin"
21
+
22
+          audio_output {
23
+            type "null"
24
+            name "My Null Output"
25
+          }
26
+
27
+          filesystem_charset "UTF-8"
28
+        '';
29
+      };
30
+
31
+    };
32
+
33
+}

+ 0
- 1
hosts/storage-ng/configuration.nix View File

@@ -13,7 +13,6 @@ in {
13 13
     ../../lib/shared.nix
14 14
     ../../lib/users.nix
15 15
     ./ncdc.nix
16
-    ../../lib/mpd.nix
17 16
     ../../lib/default-gateway.nix
18 17
     ../../lib/emery.nix
19 18
   ];

+ 16
- 0
lib/default.nix View File

@@ -98,6 +98,11 @@ in {
98 98
           description = "Whether to enable the local Nix binary cache";
99 99
         };
100 100
 
101
+        enableMpdProxy = mkOption {
102
+          type = bool;
103
+          default = false;
104
+          description = "Whether to proxy the local MPD database";
105
+        };
101 106
 
102 107
       };
103 108
 
@@ -123,6 +128,10 @@ in {
123 128
         assertion = cfg.hq.enableBinaryCache -> cfg.mapHqHosts;
124 129
         message = "mapHqHosts must be enabled for enableBinaryCache";
125 130
       }
131
+      {
132
+        assertion = cfg.hq.enableMpdProxy -> cfg.mapHqHosts;
133
+        message = "mapHqHosts must be enabled for enableMpdProxy";
134
+      }
126 135
     ];
127 136
 
128 137
     networking.defaultGateway = mkIfIsInHq "172.22.99.4";
@@ -247,6 +256,13 @@ in {
247 256
         ];
248 257
       };
249 258
 
259
+    services.mpd.extraConfig = lib.mkIf cfg.hq.enableMpdProxy ''
260
+      database {
261
+        plugin "proxy"
262
+        host "mpd-index.hq"
263
+      }
264
+    '';
265
+
250 266
   };
251 267
 
252 268
   meta.maintainers = with lib.maintainers; [ ehmry ];

+ 1
- 6
lib/mpd.nix View File

@@ -13,14 +13,9 @@ let
13 13
     dbFile = null;
14 14
     musicDirectory = "/mnt/storage/Music";
15 15
     playlistDirectory = "/home/k-ot/Playlists";
16
-    extraConfig = ''
17
-      database {
18
-        plugin "proxy"
19
-        host "storage-ng.hq.c3d2.de"
20
-      }
21
-    '';
22 16
   };
23 17
 in {
18
+  c3d2.hq.enableMpdProxy = true;
24 19
   services.mpd = (hostMpd // {
25 20
     enable = true;
26 21
     network.listenAddress = "any";

Loading…
Cancel
Save