Navidrome: Make Navidrome available in the AUR

Created on 7 Apr 2020  路  21Comments  路  Source: deluan/navidrome

I think it would be a great idea to have Navidrome available in the AUR as navidrome-bin.
This is an example of an AUR package that provides pre-built binaries for many architectures.

new platform

Most helpful comment

I've packaged this for the AUR in both binary form (from releases) and a -git version for installing the latest master.

All 21 comments

Thanks for the suggestion. I'll take a look at this when I work on the release pipeline for issues #92 and #142

I've packaged this for the AUR in both binary form (from releases) and a -git version for installing the latest master.

Great!! Thanks! I'll reach out to you to learn how to automate this.

I've not really been able to figure out a good way of fully automating this for my projects. You basically just push to the repo to update the package in the AUR.

I have update.sh scripts in each of the repositories (https://aur.archlinux.org/cgit/aur.git/tree/update.sh?h=navidrome-bin and https://aur.archlinux.org/cgit/aur.git/tree/update.sh?h=navidrome-git) which I run whenever a new version is made, and I can add you as a maintainer on the package so that you can run that script and push to the AUR repo.

Please do. My plan is to try to use goreleaser (used for generating the other binaries) to generate and publish the AUR package

@sumnerevans thank you, hower I would add two features:

  • create a system user named navidrome, with home in /var/lib/navidrome
  • add a navidrome.service unit like this one:
[Unit]
Description=Navidrome Music Streamer
After=network.target

[Service]
Type=simple
User=navidrome
Group=navidrome
WorkingDirectory=/var/lib/navidrome
ExecStart=/usr/bin/navidrome -port 4533

[Install]
WantedBy=multi-user.target

@deluan is it possible to add a flag to Navidrome to make it parse a certain configuration file (E.G. /etc/navidrome.conf)? In this way one could write his configurations there and launch it as a daemon from systemd with

ExecStart=/usr/bin/navidrome -c /etc/navidrome.conf

There is already a systemd unit in the contrib folder :)

As for the configuration file, put a navidrome.toml/navidrome.json/navidrome.ini in your "datafolder" and it'll be loaded

It already does something similar! It search for a navidrome.toml file at the current folder, you have to add the options in it using the TOML format, like this:

LogLevel = "INFO"
BaseURL = "/music"
ScanInterval = "10s"
TranscodingCacheSize = "15MB"
ImageCacheSize = "10MB"
SessionTimeout = "30m"
MusicFolder = "/Users/deluan/Music/iTunes/iTunes Media/Music"

You can also pass these options to the executable itself, like:

$ navidrome --baseurl="/music" --loglevel="info"

I didn't document this yet because I'm planning to change it, but feel free to use it. If I ever change this I'll add a warning in the release notes

@AlphaJack I don't know of any existing Arch Linux packages that create users automatically. That seems very anti the Arch Philosophy. Can you point me to an example?

Not sure about creating users, but seems that adding a serviced unit is common practice. Ex: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=sonarr

@sumnerevans AirSonic comes to mind (see airsonic.sysusers), but also netdata, matrix-synapse and others in the official repo.
Given the feature of searching for navidrome.toml in the working directory, is it possible (or at least common practive) to put that file in /etc/ during the installation process and symlinking it to the /var/lib/navidrome folder? This is widely used with PHP webapps such as nextcloud, moodle and privatebin which read their configuration files from /usr/share/webapps/xxx/config/config.php that is a symlink to /etc/webapps/xxx/config.php

@sumnerevans Thank you, it works fine. However the environmental file can't be sourced because the folder /etc/sysconfig doesn't exist, at least on both on Arch ARM and Manjaro x64.
Also, no default configuration file is provided from the AUR, but it's not a major issue.

@AlphaJack Hmm... I'm not sure what do to do there. Maybe I should remove the EnvironmentFile parameter in the config? Or I could just make it blank.

@AlphaJack I added a default, blank, file in /etc/sysconfig/navidrome. Does that work?

E.G. Jellyfin provides its configuration file and copies it in /etc/conf.d/ adding

install -Dm 644 jellyfin.conf "$pkgdir"/etc/conf.d/jellyfin

to the package() function of the PKGBUILD.

For Navidrome a sample configuration file could be navidrome.toml, provided by deluan in a comment above.


I just read your last comment. Yes, the blank file is created correctly. Is there a particular reason to use /etc/sysconfig instead of /etc/?

So, I'll switch it to /etc instead of /etc/sysconfig.

@deluan Is there a way to point Navidrome at a specific config file? The working directory for the service is /var/lib/navidrome, but I want it to use the config in /etc/navidrome/navidrome.toml.

Not ATM, but I'll try to add something for the next release

Hey @sumnerevans , I added the --configfile option to the command line (and env var): https://www.navidrome.org/docs/usage/configuration-options/#configuration-file

After this is added to the AUR, is there anything else preventing us to close this issue? (cc @AlphaJack)

Just a curiosity, why navidrome is the only program which returns static if I run systemctl is-enabled navidrome? Other services return enabled|disabled

This is my unit file:

[Unit]
Description=Navidrome Music Server
After=remote-fs.target network.target
AssertPathExists=/var/lib/navidrome

[Service]
User=navidrome
Group=navidrome
Type=simple
ExecStart=/usr/bin/navidrome
WorkingDirectory=/var/lib/navidrome
TimeoutStopSec=20
KillMode=process
Restart=on-failure
EnvironmentFile=-/etc/sysconfig/navidrome

DevicePolicy=closed
NoNewPrivileges=yes
PrivateTmp=yes
PrivateUsers=yes
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
RestrictNamespaces=yes
RestrictRealtime=yes
SystemCallFilter=~@clock @debug @module @mount @obsolete @privileged @reboot @setuid @swap
ReadWritePaths=/var/lib/navidrome
ProtectSystem=full
ProtectHome=true

Got this comment on the AUR package: https://aur.archlinux.org/packages/navidrome-bin/#comment-746589

I'm probably going to have to refactor some things with the configuration. This is kinda why I was not so keen on adding any configuration in the first place.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

r0arkin picture r0arkin  路  5Comments

yarg-kane picture yarg-kane  路  5Comments

ElleshaHackett picture ElleshaHackett  路  6Comments

pagdot picture pagdot  路  4Comments

delucks picture delucks  路  3Comments