Navidrome On NixOS With Docker
2022-10-05
There is no need for a long introduction here. This is the contents of my navidrome.nix
file. All of the data is saved on an external (encrypted) SSD, called /media
.
{ config, pkgs, ... }:
{
virtualisation.oci-containers.containers."navidrome" = {
autoStart = true;
image = "deluan/navidrome:latest";
#user: 1000:1000 # should be owner of volumes
ports = [ "4533:4533" ];
environment = {
# Optional: put your config options customization here. Examples:
ND_SCANSCHEDULE = "1h";
ND_LOGLEVEL = "info";
ND_SESSIONTIMEOUT = "24h";
ND_BASEURL = "";
};
volumes = [
"/media/Containers/Navidrome/data:/data"
"/media/Music:/music:ro"
];
};
}
Since that's in its own .nix
file, we need to add it to the imports
section of the /etc/nixos/configuration.nix
, like so:
imports = [
./hardware-configuration.nix
# Docker containers
./containers/navidrome.nix
];
That's it! Run sudo nixos-rebuild switch
and, once it downloads and starts, you should have a running Navidrome container on your NixOS box!