summary refs log tree commit diff
path: root/pkgs/applications/audio/spotify/wrapper.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/audio/spotify/wrapper.nix')
-rw-r--r--pkgs/applications/audio/spotify/wrapper.nix31
1 files changed, 31 insertions, 0 deletions
diff --git a/pkgs/applications/audio/spotify/wrapper.nix b/pkgs/applications/audio/spotify/wrapper.nix
new file mode 100644
index 00000000000..418ef3cbc03
--- /dev/null
+++ b/pkgs/applications/audio/spotify/wrapper.nix
@@ -0,0 +1,31 @@
+{ symlinkJoin
+, lib
+, spotify-unwrapped
+, makeWrapper
+
+  # High-DPI support: Spotify's --force-device-scale-factor argument; not added
+  # if `null`, otherwise, should be a number.
+, deviceScaleFactor ? null
+}:
+
+symlinkJoin {
+  name = "spotify-${spotify-unwrapped.version}";
+
+  paths = [ spotify-unwrapped.out ];
+
+  nativeBuildInputs = [ makeWrapper ];
+  preferLocalBuild = true;
+  passthru.unwrapped = spotify-unwrapped;
+  postBuild = ''
+    wrapProgram $out/bin/spotify \
+        ${lib.optionalString (deviceScaleFactor != null) ''
+            --add-flags ${lib.escapeShellArg "--force-device-scale-factor=${
+                builtins.toString deviceScaleFactor
+              }"}
+        ''}
+  '';
+
+  meta = spotify-unwrapped.meta // {
+    priority = (spotify-unwrapped.meta.priority or 0) - 1;
+  };
+}