Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mpdscribble service #23660

Closed

Conversation

matthiasbeyer
Copy link
Contributor

Motivation for this change

I guess I did this before but failed. So here's a second try.

Would love to get some review on this before testing it.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@mention-bot
Copy link

@matthiasbeyer, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @offlinehacker and @bjornfor to be potential reviewers.

Copy link

@DerTim1 DerTim1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I detect some minor issues (missing ; and multiline strings)

description = ''
HTTP proxy URL.
'';
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing ; after }

description = ''
The location of the pid file. mpdscribble saves its process id there.
'';
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here again...

enable = mkOption {
default = false;
type = types.bool;
description = "
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better use '' (two single quotes for multiline string).
But this is only one line so you can reduce two "...." in one line.

description = ''
Change to this system user after daemonization.
'';
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...

};

journal = mkOption {
default = "/tmp/lastfm-journal.mpdscribble";
Copy link
Member

@Mic92 Mic92 Mar 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this journal persistent data? If yes, I would put into /var (for example /var/lib/mpdscribble). If no, I would put it in /run/ (if the amount of data stored is small).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The amount is variable. mpdscribble stores scrobble data (about 5 lines of text, in human readable format) for each track played when it is not able to reach out to the last.fm servers... normally during network outage or when without internet connection. I'd opt for /run then.

let
cfg = config.services.mpdscribble;

mkSection = cfg: optname: secname:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Options for each backend could be also reduced using a generic function, like you did for the configuration file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean...

wantedBy = "multi-user.target";
path = [ pkgs.mpdscribble ];
User = "mpdscribble";
Type = "oneshot";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a daemon, right? If yes, I would remove Type here (simple is the default value).


config = mkIf cfg.enable {
systemd.services.mpdscribble = {
after = [ "network.target" ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about:

after = [ "mpd.service", "network.target" ]; 

after = [ "network.target" ];
description = "mpdscribble mpd scrobble client";
wantedBy = "multi-user.target";
path = [ pkgs.mpdscribble ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be not necessary because you start mpdscribble with the full path.


config = mkIf cfg.enable {
systemd.services.mpdscribble = {
after = [ "mpd.service", "network.target" ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably just fail

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List syntax in Nix does not need comma here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, sure.

@matthiasbeyer
Copy link
Contributor Author

Updated ... this was stalled way to long. I'm sorry.

## http://mpd.wikia.com/wiki/Client:mpdscribble

# HTTP proxy URL.
${if isNull cfg.proxy then "" else "proxy = ${cfg.proxy}"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it deliberate that you do not use networking.proxy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean?

Also: This PR is stalled too long, but I can't get it finished... am starting mpdscribble after each boot by hand (which is ugly and sometimes I forget it)... so if someone wants to take this and finish it: feel free!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, you configure a proxy, but there is a system-wide proxy configuration variable.

I am not using mpd at all, I just hoped to merge a random sample of long-standing PRs.

@matthiasbeyer matthiasbeyer deleted the mpdscribble-service branch February 27, 2019 15:44
@Sohalt
Copy link
Contributor

Sohalt commented Mar 7, 2019

Any reason why you closed this @matthiasbeyer ?

@matthiasbeyer
Copy link
Contributor Author

Because I don't care anymore. Feel free to take the patches and continue the effort.

@Sohalt Sohalt mentioned this pull request Sep 9, 2020
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants