Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions pkgs/by-name/ti/tidal-hifi/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ let
vulkan-loader
];
in
buildNpmPackage {
buildNpmPackage (self: {
pname = "tidal-hifi";
inherit version;

Expand Down Expand Up @@ -125,24 +125,23 @@ buildNpmPackage {

desktopItems = [
(makeDesktopItem {
exec = "tidal-hifi";
name = "TIDAL Hi-Fi";
desktopName = "tidal-hifi";
genericName = "TIDAL Hi-Fi";
comment = "The web version of listen.tidal.com running in electron with hifi support thanks to widevine.";
name = self.pname;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken, it is discouraged to re-use pname in the derivation. Please, keep the hard-coded name here.

Copy link
Contributor Author

@spikespaz spikespaz Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid I need to ask you to cite a source (or reason it out). I'm not sure I recall seeing that advice anywhere.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That comment you linked covers a very specific circumstance. That is not this circumstance. In this case, that's the reason to use self.pname recursively, where it is not a footgun.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name (String)

The name of the desktop file in the Nix store.

Seems like a match.
It is not the Name field of the desktop entry, so it seems quite inconsequential.
LGTM.

desktopName = "TIDAL Hi-Fi";
genericName = "Music Player";
comment = self.meta.description;
icon = "tidal-hifi";
startupNotify = true;
exec = self.meta.mainProgram;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I'm less sure... Maybe it's better to switch to meta.mainProgram indeed... Not sure though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the advice you recall is that using attributes via rec is bad, given the wide scope that is a package definition? Certainly, if someone overrides this package and changes the meta.mainProgram because the package's executable has been renamed, they'd appreciate the recursion.

Same goes for pname in fact, if this definition is used as the base for a fork, and pname is changed via overrideAttrs, you'd want the desktop entry's filename to not conflict with the upstream one. Doing the same thing with a let binding only accomplishes the second purpose, the single source of truth. For overrides, that benefit would be lost.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very hypothetical, but LGTM.

terminal = false;
type = "Application";
mimeTypes = [ "x-scheme-handler/tidal" ];
categories = [
"Audio"
"Music"
"Player"
"Network"
"Application"
"AudioVideo"
"Audio"
"Video"
];
startupNotify = true;
startupWMClass = "tidal-hifi";
mimeTypes = [ "x-scheme-handler/tidal" ];
extraConfig.X-PulseAudio-Properties = "media.role=music";
})
];
Expand Down Expand Up @@ -190,7 +189,7 @@ buildNpmPackage {

meta = {
changelog = "https://github.com/Mastermindzh/tidal-hifi/releases/tag/${version}";
description = "Web version of Tidal running in electron with hifi support thanks to widevine";
description = "Web version of Tidal running in Electron with Hi-Fi support thanks to Widevine";
homepage = "https://github.com/Mastermindzh/tidal-hifi";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
Expand All @@ -201,4 +200,4 @@ buildNpmPackage {
platforms = lib.platforms.linux;
mainProgram = "tidal-hifi";
};
}
})
Loading