summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/home/metube.nix
blob: 50646d210ca118cca66e5e0cafd1b10fce3fc799 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ pkgs, lib, ...}:
# docker run -d -p 8081:8081 -v /path/to/downloads:/downloads --user 1001:1001 alexta69/metube
with import <stockholm/lib>;
let
  port = "2348";
  dl-dir = "/media/cryptX/youtube/music";
  uid = 20421;
  internal-ip = "192.168.111.11";
in
  {
  systemd.tmpfiles.rules = [
    "d ${dl-dir} metube nogroup - -"
  ];
  virtualisation.oci-containers.backend = "docker";

  services.nginx.virtualHosts."tube" = {
    serverAliases = [ "tube.lan" ];
    locations."/".proxyPass = "http://localhost:${port}";
  };

  virtualisation.oci-containers.containers.metube = {
    image = "alexta69/metube:latest";
    ports = [ "${port}:8081" ];
    volumes = [
      "${dl-dir}:/downloads"
    ];
    user = "metube";
  };
  users.users.metube.uid = uid;

  systemd.services.docker-metube.serviceConfig = {
    StandardOutput = lib.mkForce "journal";
    StandardError = lib.mkForce "journal";
  };
}