93 lines
2.6 KiB
Nix
93 lines
2.6 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
{
|
|
options.modules.services.navidrome = {
|
|
enable = lib.mkEnableOption "Navidrome";
|
|
|
|
package = lib.mkPackageOption pkgs "navidrome" { };
|
|
|
|
port = lib.mkOption {
|
|
type = lib.types.port;
|
|
default = 4533;
|
|
description = "Port Navidrome listens on.";
|
|
};
|
|
|
|
dataDir = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "/var/lib/navidrome";
|
|
description = "Directory where Navidrome stores state.";
|
|
};
|
|
|
|
musicDir = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "/music";
|
|
description = "Directory where Navidrome reads the music library.";
|
|
};
|
|
|
|
user = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "navidrome";
|
|
description = "User account that runs Navidrome.";
|
|
};
|
|
|
|
group = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "storage";
|
|
description = "Group account that owns Navidrome state and media access.";
|
|
};
|
|
|
|
enableSharing = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = true;
|
|
description = "Enables Navidrome sharing support.";
|
|
};
|
|
|
|
settings = lib.mkOption {
|
|
type = lib.types.attrs;
|
|
default = { };
|
|
description = "Additional non-secret Navidrome settings.";
|
|
};
|
|
|
|
environmentFile = lib.mkOption {
|
|
type = lib.types.nullOr lib.types.path;
|
|
default = null;
|
|
description = "File containing secret Navidrome environment variables.";
|
|
};
|
|
};
|
|
|
|
config = lib.mkMerge [
|
|
{
|
|
registry."stable-uid".${config.networking.hostName}.navidrome = 20004;
|
|
}
|
|
|
|
(lib.mkIf config.modules.services.navidrome.enable {
|
|
users.users.${config.modules.services.navidrome.user} = {
|
|
isSystemUser = true;
|
|
uid = config.registry."stable-uid".${config.networking.hostName}.navidrome;
|
|
group = config.modules.services.navidrome.group;
|
|
home = config.modules.services.navidrome.dataDir;
|
|
};
|
|
|
|
services.navidrome = {
|
|
enable = true;
|
|
package = config.modules.services.navidrome.package;
|
|
user = config.modules.services.navidrome.user;
|
|
group = config.modules.services.navidrome.group;
|
|
environmentFile = config.modules.services.navidrome.environmentFile;
|
|
openFirewall = true;
|
|
settings = config.modules.services.navidrome.settings // {
|
|
Address = "0.0.0.0";
|
|
Port = config.modules.services.navidrome.port;
|
|
DataFolder = config.modules.services.navidrome.dataDir;
|
|
MusicFolder = config.modules.services.navidrome.musicDir;
|
|
EnableSharing = config.modules.services.navidrome.enableSharing;
|
|
};
|
|
};
|
|
})
|
|
];
|
|
}
|