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

mopidy: Create a mopidyPackages set #82651

Open
wants to merge 2 commits into
base: master
from

Conversation

@adisbladis
Copy link
Member

adisbladis commented Mar 15, 2020

Motivation for this change

Currently installing Mopidy plugin packages is using inconsistent python versions.
This may work just by chance in some cases but certainly not all.

This PR ensures a consistent python package is used across all Mopidy plugins.

Note: I'm not a Mopidy user myself so it would be great if someone who is can test these changes. I'm merely acting on an issue reported in IRC in #nixos.

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.

cc @fpletz @jgillich @rvolosatovs @spwhitt @jluttine

adisbladis added 2 commits Mar 15, 2020
This is in anticipation of a mopidyPackages set
This is to avoid mixing python versions in the same plugin closure.
@FRidh

This comment has been minimized.

Copy link
Member

FRidh commented Mar 15, 2020

Interesting, I was doing the same for octoprint. Let's sync the approaches.
#82392

@FRidh

This comment has been minimized.

Copy link
Member

FRidh commented Mar 15, 2020

I think creating a new scope with plugins is better than extending the Python packages set with plugins (like I did for octoprint). What is still needed however is a way to create a composition (mypackage.withPlugins).

@jluttine

This comment has been minimized.

Copy link
Member

jluttine commented Mar 17, 2020

Thanks for the pull request! I cherry picked these two commits. This fixed the original issue I was complaining about in IRC (incompatible Python versions) but now I'm getting the following failure:

FAILED (errors=14)
Test failed: <unittest.runner.TextTestResult run=14 errors=14 failures=0>
error: Test failed: <unittest.runner.TextTestResult run=14 errors=14 failures=0>
builder for '/nix/store/99gc95ysrwygjl3n422dp9mwy22bna8l-mopidy-local-sqlite-1.0.0.drv' failed with exit code 1
cannot build derivation '/nix/store/y9yzbaa8sjgk32s7qx7skk3wbn16kybl-mopidy-with-extensions-3.0.1.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/vyjfglydhsf1av6azrk6is9385i7xfhr-unit-mopidy-scan.service.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/sqdh210j5647zxfl8r8g5qnp9ifj9gmb-unit-mopidy.service.drv': 1 dependencies couldn't be built

To reproduce:

nix-build '<nixpkgs>' -A mopidy-local-sqlite

For reference/completeness, here's my mopidy config:

  config = let
    dataDir = config.services.mopidy.dataDir;
  in {

    services.mopidy = {
      enable = true;
      configuration = ''
      [mpd]
      hostname = 0.0.0.0
      [local]
      enabled = true
      library = sqlite
      media_dir = ${dataDir}/library
      scan_timeout = 1000
      scan_flush_threshold = 100
      scan_follow_symlinks = false
      excluded_file_extensions =
        .directory
        .html
        .jpeg
        .jpg
        .log
        .nfo
        .png
        .txt
      '';
      extensionPackages = [
        pkgs.mopidy-local-sqlite
      ];
    };

    # The default doesn't set permissions correctly
    systemd.services.mopidy.preStart = "mkdir -p ${dataDir} && chown -R mopidy:mopidy  ${dataDir} && chmod -R o-rwx ${dataDir}";

    networking.firewall.allowedTCPPorts = [
      6600 # MPD server
    ];
  }
@FRidh

This comment has been minimized.

Copy link
Member

FRidh commented Mar 17, 2020

as @gebner pointed out, the package set needs to be updated. I intend to merge this PR soon and leave it to the users (such as yourself) to update the plugins.

@adisbladis

This comment has been minimized.

Copy link
Member Author

adisbladis commented Mar 17, 2020

@jluttine The mopdy-local-* plugins have been deprecated upstream and rolled into a new plugin called https://github.com/mopidy/mopidy-local.

It would be much better if someone who is actually using these plugins update them than if I do it since I don't know what to test.

@jluttine

This comment has been minimized.

Copy link
Member

jluttine commented Mar 17, 2020

@FRidh Ok, so I shall not update those plugins now. I'll wait until this PR is merged and then open separate PRs for them. Is that what you meant?

@jluttine

This comment has been minimized.

Copy link
Member

jluttine commented Mar 17, 2020

@adisbladis I tested Mopidy quickly with a minimal setup and it seems to work, thanks!

Just for reference, here's my config:

    config.services.mopidy = let
      dataDir = config.services.mopidy.dataDir;
    in {
      enable = true;
      configuration = ''
      [mpd]
      hostname = 0.0.0.0
      [audio]
      output = pulsesink server=127.0.0.1
      '';
      extensionPackages = [
        pkgs.mopidy-iris
      ];
    };

    # Allow Mopidy to play sound via Pulseaudio that might be running under some
    # other user.
    hardware.pulseaudio.extraConfig = ''
      load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
    '';

    # The default doesn't set permissions correctly
    systemd.services.mopidy.preStart = "mkdir -p ${dataDir} && chown -R mopidy:mopidy  ${dataDir} && chmod -R o-rwx ${dataDir}";

I could then try to look into the extensions once this PR is merged.

@jonringer jonringer mentioned this pull request Mar 19, 2020
4 of 10 tasks complete
mopidy-soundcloud = callPackage ../applications/audio/mopidy/soundcloud.nix { };

mopidy-musicbox-webclient = callPackage ../applications/audio/mopidy/musicbox-webclient.nix { };
mopidyPackages = callPackage ../applications/audio/mopidy/default.nix {

This comment has been minimized.

Copy link
@orivej

orivej Mar 23, 2020

Contributor

This should be callPackages (see lib/customization.nix).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.