git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #98350 from 9999years/spotify-device-scale-factor

spotify: support --force-device-scale-factor for high-DPI displays

commit2e98177bd79ba132e453aae7cf9f05e6339575ec authorMaximilian Bosch <maximilian@mbosch.me> dateMon 21 Sep 2020, 23:00 (6 years ago) parent4e1f8e44f03644
3 files changed+35−2
pkgs/applications/audio/spotify/default.nix+1−1 pkgs/applications/audio/spotify/wrapper.nix+31 pkgs/top-level/all-packages.nix+3−1
pkgs/applications/audio/spotify/default.nix+1−1
@@ -64,7 +64,7 @@ let
6464in
6565
6666stdenv.mkDerivation {
67− pname = "spotify";
67+ pname = "spotify-unwrapped";
6868 inherit version;
6969
7070 # fetch from snapcraft instead of the debian repository most repos fetch from.
pkgs/applications/audio/spotify/wrapper.nixnew file+31
@@ -0,0 +1,31 @@
1+{ symlinkJoin
2+, lib
3+, spotify-unwrapped
4+, makeWrapper
5+
6+ # High-DPI support: Spotify's --force-device-scale-factor argument; not added
7+ # if `null`, otherwise, should be a number.
8+, deviceScaleFactor ? null
9+}:
10+
11+symlinkJoin {
12+ name = "spotify-${spotify-unwrapped.version}";
13+
14+ paths = [ spotify-unwrapped.out ];
15+
16+ nativeBuildInputs = [ makeWrapper ];
17+ preferLocalBuild = true;
18+ passthru.unwrapped = spotify-unwrapped;
19+ postBuild = ''
20+ wrapProgram $out/bin/spotify \
21+ ${lib.optionalString (deviceScaleFactor != null) ''
22+ --add-flags ${lib.escapeShellArg "--force-device-scale-factor=${
23+ builtins.toString deviceScaleFactor
24+ }"}
25+ ''}
26+ '';
27+
28+ meta = spotify-unwrapped.meta // {
29+ priority = (spotify-unwrapped.meta.priority or 0) - 1;
30+ };
31+}
pkgs/top-level/all-packages.nix+3−1
@@ -23330,7 +23330,7 @@ in
2333023330
2333123331 spek = callPackage ../applications/audio/spek { };
2333223332
23333− spotify = callPackage ../applications/audio/spotify {
23333+ spotify-unwrapped = callPackage ../applications/audio/spotify {
2333423334 libgcrypt = libgcrypt_1_5;
2333523335 libpng = libpng12;
2333623336 curl = curl.override {
@@ -23338,6 +23338,8 @@ in
2333823338 };
2333923339 };
2334023340
23341+ spotify = callPackage ../applications/audio/spotify/wrapper.nix { };
23342+
2334123343 libspotify = callPackage ../development/libraries/libspotify (config.libspotify or {});
2334223344
2334323345 sourcetrail = callPackage ../development/tools/sourcetrail { };