Unverified Commit 2f665c34 authored by github-actions[bot]'s avatar github-actions[bot] Committed by GitHub
Browse files

Merge master into staging-next

parents 206417b7 15f699fb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ This manual describes how to install, use and extend NixOS, a Linux distribution

Additional information regarding the Nix package manager and the Nixpkgs project can be found in respectively the [Nix manual](https://nixos.org/nix/manual) and the [Nixpkgs manual](https://nixos.org/nixpkgs/manual).

If you encounter problems, please report them on the [`Discourse`](https://discourse.nixos.org), the [Matrix room](https://matrix.to/#nix:nixos.org), or on the [`#nixos` channel on Libera.Chat](irc://irc.libera.chat/#nixos). Alternatively, consider [contributing to this manual](#chap-contributing). Bugs should be reported in [NixOS’ GitHub issue tracker](https://github.com/NixOS/nixpkgs/issues).
If you encounter problems, please report them on the [`Discourse`](https://discourse.nixos.org), the [Matrix room](https://matrix.to/#/%23nix:nixos.org), or on the [`#nixos` channel on Libera.Chat](irc://irc.libera.chat/#nixos). Alternatively, consider [contributing to this manual](#chap-contributing). Bugs should be reported in [NixOS’ GitHub issue tracker](https://github.com/NixOS/nixpkgs/issues).

::: {.note}
Commands prefixed with `#` have to be run as root, either requiring to login as root user or temporarily switching to it using `sudo` for example.
+2704 −0

File added.

Preview size limit exceeded, changes collapsed.

+0 −11
Original line number Diff line number Diff line
--- a/Cargo.lock	2022-04-27 17:25:49.017415644 +0300
+++ b/Cargo.lock	2022-04-27 17:25:51.307433984 +0300
@@ -1722,8 +1722,6 @@
 [[package]]
 name = "rspotify"
 version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eefd7bb58b714606b30a490f751d7926942e2874eef5e82934d60d7a4a68dca4"
 dependencies = [
  "base64 0.10.1",
  "chrono",
+0 −12
Original line number Diff line number Diff line
--- a/Cargo.toml	2022-04-25 18:20:04.329712912 +0200
+++ b/Cargo.toml	2022-04-25 18:20:44.296429608 +0200
@@ -29,6 +29,9 @@
 rand = "0.8.3"
 anyhow = "1.0.43"
 
+[patch.crates-io]
+rspotify = { path = "./rspotify-0.10.0" }
+
 [[bin]]
 bench = false
 path = "src/main.rs"
+16 −55
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, fetchCrate
, fetchpatch
, rustPlatform
, fetchFromGitHub
, stdenv
, installShellFiles
, pkg-config
, openssl
@@ -24,62 +22,25 @@ rustPlatform.buildRustPackage rec {
    hash = "sha256-L5gg6tjQuYoAC89XfKE38KCFONwSAwfNoFEUPH4jNAI=";
  };

  cargoPatches = [
    # Use patched rspotify
    ./Cargo.lock.patch

    # Needed so that the patch below it applies.
    (fetchpatch {
      name = "update-dirs.patch";
      url = "https://github.com/Rigellute/spotify-tui/commit/3881defc1ed0bcf79df1aef4836b857f64be657c.patch";
      hash = "sha256-OGqiYLFojMwR3RgKbddXxPDiAdzPySnscVVsVmTT7t4=";
    })

    # https://github.com/Rigellute/spotify-tui/pull/990
    (fetchpatch {
      name = "update-socket2-for-rust-1.64.patch";
      url = "https://github.com/Rigellute/spotify-tui/commit/14df9419cf72da13f3b55654686a95647ea9dfea.patch";
      hash = "sha256-craY6UwmHDdxih3nZBdPkNJtQ6wvVgf09Ovqdxi0JZo=";
    })
  ];

  patches = [
    # Use patched rspotify
    ./Cargo.toml.patch
  ];

  preBuild = let
    rspotify = stdenv.mkDerivation rec {
      pname = "rspotify";
      version = "0.10.0";

      src = fetchCrate {
        inherit pname version;
        sha256 = "sha256-KDtqjVQlMHlhL1xXP3W1YG/YuX9pdCjwW/7g18469Ts=";
      };

      dontBuild = true;
      installPhase = ''
        mkdir $out
        cp -R . $out
      '';

      patches = [
        # add `collection` variant
        ./0001-Add-Collection-SearchType.patch
      ];
  cargoLock = {
    lockFile = ./Cargo.lock;
  };
  in ''
    ln -s ${rspotify} ./rspotify-${rspotify.version}
  '';

  cargoHash = "sha256-aZJ6Q/rvqrv+wvQw2eKFPnSROhI5vXPvr5pu1hwtZKA=";

  nativeBuildInputs = [ installShellFiles ] ++ lib.optionals stdenv.isLinux [ pkg-config python3 ];
  buildInputs = [ ]
    ++ lib.optionals stdenv.isLinux [ openssl libxcb ]
    ++ lib.optionals stdenv.isDarwin [ AppKit Security ];

  postPatch = ''
    # update Cargo.lock to fix build
    ln -sf ${./Cargo.lock} Cargo.lock

    # Add patch adding the collection variant to rspotify used by spotify-tu
    # This fixes the issue of getting an error when playing liked songs
    # see https://github.com/NixOS/nixpkgs/pull/170915
    patch -p1 -d $cargoDepsCopy/rspotify-0.10.0 < ${./0001-Add-Collection-SearchType.patch}
  '';

  postInstall = ''
    for shell in bash fish zsh; do
      $out/bin/spt --completions $shell > spt.$shell
@@ -91,7 +52,7 @@ rustPlatform.buildRustPackage rec {
    description = "Spotify for the terminal written in Rust";
    homepage = "https://github.com/Rigellute/spotify-tui";
    changelog = "https://github.com/Rigellute/spotify-tui/blob/v${version}/CHANGELOG.md";
    license = licenses.mit;
    license = with licenses; [ mit /* or */ asl20 ];
    maintainers = with maintainers; [ jwijenbergh ];
    mainProgram = "spt";
  };
Loading