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

Mpdscheduler #96838

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Mpdscheduler #96838

wants to merge 4 commits into from

Conversation

AberDerBart
Copy link

Motivation for this change

Introduces the tool mpdscheduler which allows setting alarms and sleep timers for mpd.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

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

A few minor points. I don't review go packages because I'm not familiar with it, so I just focused on the module.

nixos/modules/services/audio/mpdscheduler.nix Outdated Show resolved Hide resolved
nixos/modules/services/audio/mpdscheduler.nix Outdated Show resolved Hide resolved
nixos/modules/services/audio/mpdscheduler.nix Outdated Show resolved Hide resolved
pkgs/applications/audio/mpdscheduler/default.nix Outdated Show resolved Hide resolved
nixos/modules/services/audio/mpdscheduler.nix Show resolved Hide resolved
maintainers/maintainer-list.nix Show resolved Hide resolved
nixos/modules/services/audio/mpdscheduler.nix Show resolved Hide resolved
nixos/modules/services/audio/mpdscheduler.nix Show resolved Hide resolved
@AberDerBart AberDerBart force-pushed the mpdscheduler branch 2 times, most recently from d714aa8 to c4c021a Compare September 1, 2020 07:21
Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

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

Good job 👍 Really nice work, especially for a first module.

nixos/modules/services/audio/mpdscheduler.nix Outdated Show resolved Hide resolved
Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

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

I approve of this module 👍 You did a great job! Unfortunately I do not review go packages, so we'll have to wait for someone (maybe @kalbasit?) to review the package portion of this PR before merging.

BTW if you're interested in writing a NixOS test for this module you are highly encouraged to do so and will be awarded full bonus points 🎉

@AberDerBart
Copy link
Author

@aanderse I added a test as you suggested (and found a bug on the way - mpdscheduler was trying to connect to another host before network.target was ready if it was not running on localhost (and thus waiting for mpd)).

Would you mind to have a look at it (see fa8a642)?

Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

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

I'm really glad you decided to do a NixOS test! This looks good. I have a small suggestion, but haven't really used the testing framework much since it was ported to python. Maybe @tfc can review the test as they are right up on the latest and greatest trends in writing NixOS tests.

log_level "verbose"
'';
};
systemd.services.musicService = musicService {};
Copy link
Member

Choose a reason for hiding this comment

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

You may be able to replace this with a single line, something more simple like...

systemd.tmpfiles.rules = [ "C /var/lib/music/Blue_Wave_Theory_-_04_-_Skyhawk_Beach.mp3 - - - - ${track}" ];

Untested, but should work.

Copy link
Author

Choose a reason for hiding this comment

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

It didn't work:

systemd-tmpfiles[584]: Detected unsafe path transition /var/lib/mpd → /var/lib/mpd/music during canonicalization of /var/lib/mpd/music.

as /var/lib/mpd/ belongs to user mpd, not root.
However,

systemd.tmpfiles.rules = [ "L /var/lib/music/Blue_Wave_Theory_-_04_-_Skyhawk_Beach.mp3 - - - - ${track}" ];

did (with setting follow_outside_symlinks "yes" in mpd.extraConfig)

Copy link
Member

Choose a reason for hiding this comment

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

I specifically set the folder to something other than /var/lib/mpd/music to avoid the unsafe transition. If you want to use /var/lib/mpd/music you can set the owner to mpd, as you noticed:

systemd.tmpfiles.rules = [ "C /var/lib/music/Blue_Wave_Theory_-_04_-_Skyhawk_Beach.mp3 - mpd mpd - ${track}" ];

@AberDerBart
Copy link
Author

@ofborg test mpdscheduler

@SuperSandro2000
Copy link
Member

@AberDerBart Please fix the merge conflict.

Comment on lines +7 to +15
rev = "v${version}";
name = "${pname}-${rev}";

src = fetchFromGitHub {
inherit rev;
owner = "AberDerBart";
repo = "mpdscheduler";
sha256 = "1fxc416h1hisf3rdnk3h488hbapkmdpxhladbc0v6spgp6ck9y6s";
};
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
rev = "v${version}";
name = "${pname}-${rev}";
src = fetchFromGitHub {
inherit rev;
owner = "AberDerBart";
repo = "mpdscheduler";
sha256 = "1fxc416h1hisf3rdnk3h488hbapkmdpxhladbc0v6spgp6ck9y6s";
};
src = fetchFromGitHub {
owner = "AberDerBart";
repo = "mpdscheduler";#
rev = "v${version}";
sha256 = "1fxc416h1hisf3rdnk3h488hbapkmdpxhladbc0v6spgp6ck9y6s";
};

@stale
Copy link

stale bot commented Jun 28, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 28, 2021
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 12, 2023
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 19, 2024
@wegank wegank marked this pull request as draft March 20, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants