mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-22 08:33:55 -05:00
nixos/containers/navidrome: cleanup
This commit is contained in:
parent
6be75be909
commit
1d4ec0ff6c
|
@ -1,9 +1,7 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
inputs,
|
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
self,
|
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
config = lib.mkIf config.ar.containers.nixos.navidrome.enable {
|
config = lib.mkIf config.ar.containers.nixos.navidrome.enable {
|
||||||
|
@ -29,6 +27,7 @@
|
||||||
});
|
});
|
||||||
in {
|
in {
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
|
|
||||||
bindMounts = {
|
bindMounts = {
|
||||||
"/Music".hostPath = config.ar.containers.nixos.navidrome.musicDirectory;
|
"/Music".hostPath = config.ar.containers.nixos.navidrome.musicDirectory;
|
||||||
"/var/lib/navidrome/rawNavidrome.json".hostPath = navidromeConfig;
|
"/var/lib/navidrome/rawNavidrome.json".hostPath = navidromeConfig;
|
||||||
|
@ -37,6 +36,7 @@
|
||||||
"${config.age.secrets.spotifyClientId.path}".isReadOnly = true;
|
"${config.age.secrets.spotifyClientId.path}".isReadOnly = true;
|
||||||
"${config.age.secrets.spotifyClientSecret.path}".isReadOnly = true;
|
"${config.age.secrets.spotifyClientSecret.path}".isReadOnly = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config = let
|
||||||
lastFMApiKey = config.age.secrets.lastFMApiKey.path;
|
lastFMApiKey = config.age.secrets.lastFMApiKey.path;
|
||||||
lastFMSecret = config.age.secrets.lastFMSecret.path;
|
lastFMSecret = config.age.secrets.lastFMSecret.path;
|
||||||
|
@ -49,24 +49,29 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
system.stateVersion = "24.05";
|
system = {
|
||||||
system.activationScripts."navidrome-secrets" = ''
|
activationScripts."navidrome-secrets" = ''
|
||||||
lastFMApiKey=$(cat "${lastFMApiKey}")
|
lastFMApiKey=$(cat "${lastFMApiKey}")
|
||||||
lastFMSecret=$(cat "${lastFMSecret}")
|
lastFMSecret=$(cat "${lastFMSecret}")
|
||||||
spotifyClientId=$(cat "${spotifyClientId}")
|
spotifyClientId=$(cat "${spotifyClientId}")
|
||||||
spotifyClientSecret=$(cat "${spotifyClientSecret}")
|
spotifyClientSecret=$(cat "${spotifyClientSecret}")
|
||||||
${pkgs.gnused}/bin/sed -e "s/@lastFMApiKey@/$lastFMApiKey/" -e "s/@lastFMSecret@/$lastFMSecret/" \
|
${pkgs.gnused}/bin/sed -e "s/@lastFMApiKey@/$lastFMApiKey/" -e "s/@lastFMSecret@/$lastFMSecret/" \
|
||||||
-e "s/@spotifyClientId@/$spotifyClientId/" -e "s/@spotifyClientSecret@/$spotifyClientSecret/" \
|
-e "s/@spotifyClientId@/$spotifyClientId/" -e "s/@spotifyClientSecret@/$spotifyClientSecret/" \
|
||||||
/var/lib/navidrome/rawNavidrome.json > /var/lib/navidrome/navidrome.json
|
/var/lib/navidrome/rawNavidrome.json > /var/lib/navidrome/navidrome.json
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
stateVersion = "24.05";
|
||||||
|
};
|
||||||
|
|
||||||
systemd.services.navidrome.serviceConfig = {
|
systemd.services.navidrome.serviceConfig = {
|
||||||
|
BindReadOnlyPaths = "/Music";
|
||||||
|
|
||||||
ExecStart = lib.mkForce ''
|
ExecStart = lib.mkForce ''
|
||||||
${config.services.navidrome.package}/bin/navidrome --configfile /var/lib/navidrome/navidrome.json \
|
${config.services.navidrome.package}/bin/navidrome --configfile /var/lib/navidrome/navidrome.json \
|
||||||
--datafolder /var/lib/navidrome/
|
--datafolder /var/lib/navidrome/
|
||||||
'';
|
'';
|
||||||
BindReadOnlyPaths = "/Music";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
services.navidrome = {
|
services.navidrome = {
|
||||||
enable = true;
|
enable = true;
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
|
|
Loading…
Reference in a new issue