mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-03-29 07:10:51 +01:00
77 lines
1.5 KiB
Nix
77 lines
1.5 KiB
Nix
{ lib, pkgs, config, ... }:
|
|
with lib;
|
|
let
|
|
cfg = config.luj.navidrome;
|
|
port = 4533;
|
|
settingsFormat = pkgs.formats.json {};
|
|
in
|
|
{
|
|
|
|
options.luj.navidrome = {
|
|
|
|
enable = mkEnableOption "activate navidrome service";
|
|
|
|
user = mkOption {
|
|
type = types.str;
|
|
default = "navidrome";
|
|
description = "User account under which Navidrome runs.";
|
|
};
|
|
|
|
group = mkOption {
|
|
type = types.str;
|
|
default = "navidrome";
|
|
description = "Group under which Navidrome runs.";
|
|
};
|
|
|
|
|
|
nginx.enable = mkEnableOption "activate nginx";
|
|
nginx.subdomain = mkOption {
|
|
type = types.str;
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable (
|
|
mkMerge [{
|
|
|
|
sops.secrets."navidrome.json" = {
|
|
owner = cfg.user;
|
|
format = "binary";
|
|
sopsFile = ../../secrets/navidrome-config;
|
|
};
|
|
|
|
|
|
|
|
systemd.services.navidrome = {
|
|
|
|
description = "Navidrome Media Server";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
User = cfg.user;
|
|
Group = cfg.group;
|
|
ExecStart = ''
|
|
${pkgs.navidrome}/bin/navidrome --configfile /run/secrets/navidrome.json
|
|
'';
|
|
StateDirectory = "navidrome";
|
|
WorkingDirectory = "/var/lib/navidrome";
|
|
};
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
({
|
|
services.nginx.virtualHosts."music.julienmalka.me" = {
|
|
forceSSL = true;
|
|
enableACME = true;
|
|
locations."/" = {
|
|
proxyPass = "http://localhost:${toString port}";
|
|
};
|
|
};
|
|
})
|
|
|
|
]);
|
|
|
|
|
|
}
|