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

Merged
merged 2 commits into from Apr 17, 2020
Merged

Conversation

adisbladis
Copy link
Member

@adisbladis 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

@FRidh
Copy link
Member

FRidh commented Mar 15, 2020

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

@FRidh
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
Copy link
Member

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
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
Copy link
Member Author

@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
Copy link
Member

@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
Copy link
Member

@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
10 tasks
This is in anticipation of a mopidyPackages set
This is to avoid mixing python versions in the same plugin closure.
@adisbladis adisbladis merged commit 98be297 into NixOS:master Apr 17, 2020
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

4 participants