Compare commits
2 commits
db070d2702
...
02e115937f
| Author | SHA1 | Date | |
|---|---|---|---|
| 02e115937f | |||
| aac10ac15d |
5 changed files with 111 additions and 0 deletions
|
|
@ -38,6 +38,10 @@ in {
|
||||||
++ [ mcentire-host ];
|
++ [ mcentire-host ];
|
||||||
"secrets/millironx-books-s3.age".publicKeys = system-administrators
|
"secrets/millironx-books-s3.age".publicKeys = system-administrators
|
||||||
++ [ mcentire-host ];
|
++ [ mcentire-host ];
|
||||||
|
"secrets/millironx-music-s3.age".publicKeys = system-administrators
|
||||||
|
++ [ mcentire-host ];
|
||||||
|
"secrets/navidrome.toml.age".publicKeys = system-administrators
|
||||||
|
++ [ mcentire-host ];
|
||||||
"secrets/network-information.age".publicKeys = system-administrators
|
"secrets/network-information.age".publicKeys = system-administrators
|
||||||
++ [ bosephus-host ];
|
++ [ bosephus-host ];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
secrets/millironx-music-s3.age
Normal file
BIN
secrets/millironx-music-s3.age
Normal file
Binary file not shown.
BIN
secrets/navidrome.toml.age
Normal file
BIN
secrets/navidrome.toml.age
Normal file
Binary file not shown.
|
|
@ -21,6 +21,9 @@ in {
|
||||||
"use_path_request_style"
|
"use_path_request_style"
|
||||||
"url=https://us-east-1.linodeobjects.com/"
|
"url=https://us-east-1.linodeobjects.com/"
|
||||||
"passwd_file=${config.age.secrets.millironx-books-s3-token.path}"
|
"passwd_file=${config.age.secrets.millironx-books-s3-token.path}"
|
||||||
|
"uid=${user}"
|
||||||
|
"gid=${user}"
|
||||||
|
"umask=0022"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
104
services/navidrome.nix
Normal file
104
services/navidrome.nix
Normal file
|
|
@ -0,0 +1,104 @@
|
||||||
|
{ config, pkgs, home-manager-quadlet-nix, ... }:
|
||||||
|
let
|
||||||
|
user = "navidrome";
|
||||||
|
port = "4533";
|
||||||
|
authentikPort = "9000";
|
||||||
|
stateDirectory = "/var/lib/${user}";
|
||||||
|
s3BucketName = "millironx-music";
|
||||||
|
s3MountDirectory = "/mount/s3/${s3BucketName}";
|
||||||
|
in {
|
||||||
|
age.secrets = {
|
||||||
|
millironx-music-s3-token.file = ./../secrets/millironx-music-s3.age;
|
||||||
|
"navidrome.toml" = {
|
||||||
|
file = ./../secrets/navidrome.toml.age;
|
||||||
|
owner = user;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
millironx.podman-secrets.navidrome = {
|
||||||
|
inherit user;
|
||||||
|
secrets-files = [ config.age.secrets."navidrome.toml".path ];
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = [ pkgs.s3fs ];
|
||||||
|
|
||||||
|
fileSystems."${s3BucketName}" = {
|
||||||
|
device = s3BucketName;
|
||||||
|
mountPoint = s3MountDirectory;
|
||||||
|
fsType = "fuse./run/current-system/sw/bin/s3fs";
|
||||||
|
noCheck = true;
|
||||||
|
options = [
|
||||||
|
"_netdev"
|
||||||
|
"allow_other"
|
||||||
|
"use_path_request_style"
|
||||||
|
"url=https://us-east-1.linodeobjects.com/"
|
||||||
|
"passwd_file=${config.age.secrets.millironx-music-s3-token.path}"
|
||||||
|
"uid=${user}"
|
||||||
|
"gid=${user}"
|
||||||
|
"umask=0022"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.tmpfiles.rules =
|
||||||
|
map (d: "d ${stateDirectory}/${d} 1775 ${user} ${user} -") [ "" "data" ];
|
||||||
|
|
||||||
|
services.borgmatic.configurations."${config.networking.hostName}" = {
|
||||||
|
source_directories = map (d: "${stateDirectory}/${d}") [ "data" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.caddy.virtualHosts."music.millironx.com".extraConfig = ''
|
||||||
|
# Authentik output endpoint
|
||||||
|
reverse_proxy /outpost.goauthentik.io/* http://127.0.0.1:${authentikPort}
|
||||||
|
|
||||||
|
# Protect everything except share and subsonic endpoints
|
||||||
|
@protected not path /share/* /rest/*
|
||||||
|
forward_auth @protected http://127.0.0.1:${authentikPort} {
|
||||||
|
uri /outpost.goauthentik.io/auth/caddy
|
||||||
|
copy_headers X-Authentik-Username>Remote-User
|
||||||
|
}
|
||||||
|
|
||||||
|
# Forward everything to Navidrome
|
||||||
|
reverse_proxy 127.0.0.1:${port}
|
||||||
|
'';
|
||||||
|
|
||||||
|
users.users."${user}" = {
|
||||||
|
group = "${user}";
|
||||||
|
isNormalUser = true;
|
||||||
|
home = stateDirectory;
|
||||||
|
createHome = true;
|
||||||
|
linger = true;
|
||||||
|
autoSubUidGidRange = true;
|
||||||
|
};
|
||||||
|
users.groups."${user}" = { };
|
||||||
|
|
||||||
|
home-manager.users."${user}" = { config, osConfig, ... }: {
|
||||||
|
imports = [ home-manager-quadlet-nix ];
|
||||||
|
|
||||||
|
home.stateVersion = "25.05";
|
||||||
|
|
||||||
|
virtualisation.quadlet = {
|
||||||
|
autoUpdate.enable = true;
|
||||||
|
containers.navidrome = {
|
||||||
|
autoStart = true;
|
||||||
|
containerConfig = {
|
||||||
|
image = "docker.io/deluan/navidrome:latest";
|
||||||
|
environments = {
|
||||||
|
ND_BASEURL = "https://music.millironx.com";
|
||||||
|
ND_EXTAUTH_TRUSTEDSOURCES = "10.0.0.0/8";
|
||||||
|
};
|
||||||
|
secrets =
|
||||||
|
map (s: "${s},type=env") [ "ND_LASTFM_APIKEY" "ND_LASTFM_SECRET" ];
|
||||||
|
volumes = [
|
||||||
|
"${s3MountDirectory}:/music:Uro"
|
||||||
|
"${stateDirectory}/data:/data:U"
|
||||||
|
];
|
||||||
|
publishPorts = [ "127.0.0.1:${port}:${port}" ];
|
||||||
|
unitConfig.Requires =
|
||||||
|
[ osConfig.millironx.podman-secrets.navidrome.ref ];
|
||||||
|
unitConfig.After =
|
||||||
|
[ osConfig.millironx.podman-secrets.navidrome.ref ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue