-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
94 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ _: { | |
./lldap | ||
./maddy | ||
./miniflux | ||
./navidrome | ||
./paperless-ngx | ||
./piped | ||
./redlib | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
config, | ||
lib, | ||
svc, | ||
... | ||
}: | ||
let | ||
cfg = config.mySystemApps.navidrome; | ||
in | ||
{ | ||
options.mySystemApps.navidrome = { | ||
enable = lib.mkEnableOption "navidrome container"; | ||
backup = lib.mkEnableOption "data backup" // { | ||
default = true; | ||
}; | ||
dataDir = lib.mkOption { | ||
type = lib.types.str; | ||
description = "Path to directory containing data."; | ||
default = "/var/lib/navidrome"; | ||
}; | ||
musicPath = lib.mkOption { | ||
type = lib.types.str; | ||
description = "Path to directory containing music."; | ||
}; | ||
}; | ||
|
||
config = lib.mkIf cfg.enable { | ||
warnings = [ (lib.mkIf (!cfg.backup) "WARNING: Backups for navidrome are disabled!") ]; | ||
|
||
virtualisation.oci-containers.containers.navidrome = svc.mkContainer { | ||
cfg = { | ||
image = "ghcr.io/deedee-ops/navidrome:0.53.3@sha256:9869852f68d4ed6b8dd9cfc751f3a3bd6b43b4d10fdbdeda2b44edc117c13434"; | ||
environment = { | ||
ND_BASEURL = "/"; | ||
ND_COVERARTPRIORITY = "folder.*, cover.*, front.*"; | ||
ND_DEFAULTLANGUAGE = "en"; | ||
ND_REVERSEPROXYUSERHEADER = "Remote-User"; | ||
ND_REVERSEPROXYWHITELIST = "172.16.0.0/12"; | ||
ND_SCANNER_GROUPALBUMRELEASES = "true"; | ||
}; | ||
volumes = [ | ||
"${cfg.dataDir}/config:/config" | ||
"${cfg.musicPath}:/data:ro" | ||
]; | ||
}; | ||
}; | ||
|
||
services = { | ||
nginx.virtualHosts.navidrome = svc.mkNginxVHost { | ||
host = "navidrome"; | ||
proxyPass = "http://navidrome.docker:3000"; | ||
}; | ||
restic.backups = lib.mkIf cfg.backup ( | ||
svc.mkRestic { | ||
name = "navidrome"; | ||
paths = [ cfg.dataDir ]; | ||
} | ||
); | ||
}; | ||
|
||
systemd.services.docker-navidrome = { | ||
preStart = lib.mkAfter '' | ||
mkdir -p "${cfg.dataDir}/config" | ||
chown -R 65000:65000 "${cfg.dataDir}/config" | ||
''; | ||
}; | ||
|
||
environment.persistence."${config.mySystem.impermanence.persistPath}" = | ||
lib.mkIf config.mySystem.impermanence.enable | ||
{ directories = [ cfg.dataDir ]; }; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters