Update feishin

This commit is contained in:
Sicheng Pan 2025-10-15 23:30:12 -05:00
parent a0e3e71498
commit 97e696e37d
Signed by: macronova
GPG key ID: CE969670FB4B4A56
3 changed files with 108 additions and 117 deletions

47
flake.lock generated
View file

@ -3,11 +3,11 @@
"candy-icons": {
"flake": false,
"locked": {
"lastModified": 1755120597,
"narHash": "sha256-Kl8wTfEo+FBU5SE4ho0yLt7j2LHTJsAIfWor0hLdIlw=",
"lastModified": 1757455208,
"narHash": "sha256-wJ86TUjiVYT64QunDk85Jji5vo0Os+D9t/fsyKRM+P0=",
"ref": "refs/heads/master",
"rev": "278998cb51c68de9d590c84d8fd1625223772792",
"revCount": 1332,
"rev": "40cbbc8821db020e2668c309cd5a7bbfabd0be06",
"revCount": 1337,
"type": "git",
"url": "https://github.com/EliverLara/candy-icons"
},
@ -16,22 +16,6 @@
"url": "https://github.com/EliverLara/candy-icons"
}
},
"feishin-latest": {
"flake": false,
"locked": {
"lastModified": 1759244337,
"narHash": "sha256-Amz5Cm9L+GCpts2HRDm34KkcBzg1sPBA/0WKMOpwSoI=",
"ref": "refs/heads/development",
"rev": "f1a75d8e8123ccd6c32ded5ae960e767dfbab2a3",
"revCount": 1908,
"type": "git",
"url": "https://github.com/jeffvli/feishin"
},
"original": {
"type": "git",
"url": "https://github.com/jeffvli/feishin"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
@ -52,11 +36,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1759381078,
"narHash": "sha256-gTrEEp5gEspIcCOx9PD8kMaF1iEmfBcTbO0Jag2QhQs=",
"lastModified": 1760524057,
"narHash": "sha256-EVAqOteLBFmd7pKkb0+FIUyzTF61VKi7YmvP1tw4nEw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "7df7ff7d8e00218376575f0acdcc5d66741351ee",
"rev": "544961dfcce86422ba200ed9a0b00dd4b1486ec5",
"type": "github"
},
"original": {
@ -69,7 +53,6 @@
"root": {
"inputs": {
"candy-icons": "candy-icons",
"feishin-latest": "feishin-latest",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"sweet-ambar-blue": "sweet-ambar-blue",
@ -83,11 +66,11 @@
"sweet-ambar-blue": {
"flake": false,
"locked": {
"lastModified": 1758309482,
"narHash": "sha256-0wlq+qJAL1xu70n/X/xXdhFUlPgwDIvyC6S0zx/IiVE=",
"lastModified": 1759874534,
"narHash": "sha256-aA/wuj7Oc+4fkOrL8Qj/kTF2NzZrZ3/rNAmYs9nFxpw=",
"ref": "Ambar-Blue",
"rev": "24b6235aefe3ac44ebac7c0a5562d7930dff318a",
"revCount": 343,
"rev": "f2d784908d2737b40379c55c79e9b09f1c6e6b99",
"revCount": 344,
"type": "git",
"url": "https://github.com/EliverLara/Sweet"
},
@ -100,11 +83,11 @@
"sweet-ambar-blue-dark": {
"flake": false,
"locked": {
"lastModified": 1758309597,
"narHash": "sha256-zFpUDXUZ3zv8/5CIW/acl+SuMEGNZWHWKCuqlUtnCf8=",
"lastModified": 1759874277,
"narHash": "sha256-rULe52jTuZ+SFUkPEq0r91LML1z6fcMuXI+SDxWh7xI=",
"ref": "Ambar-Blue-Dark",
"rev": "270ec6c58e073a6315ea4423d5e655c55e418020",
"revCount": 426,
"rev": "9f4378087326b6b594af7f61ea8a0ddea7f50056",
"revCount": 427,
"type": "git",
"url": "https://github.com/EliverLara/Sweet"
},

View file

@ -8,10 +8,6 @@
flake = false;
url = "git+https://github.com/EliverLara/candy-icons";
};
feishin-latest = {
flake = false;
url = "git+https://github.com/jeffvli/feishin";
};
sweet-ambar-blue = {
flake = false;
url = "git+https://github.com/EliverLara/Sweet?ref=Ambar-Blue";

View file

@ -1,100 +1,112 @@
{
inputs,
name,
pkgs,
}:
with pkgs; buildNpmPackage {
pname = name;
version = "0.20.1";
src = inputs.${name};
npmConfigHook = pnpm.configHook;
npmDeps = null;
pnpmDeps = pnpm.fetchDeps {
pname = name;
version = "0.20.1";
src = inputs.${name};
fetcherVersion = 2;
hash = "sha256-k0/prH86iLrDsHzC9oWzJzyp1M3PQz27HXFG8t2pcv8=";
...
}: let
version = "0.21.2";
src = pkgs.fetchFromGitHub {
owner = "jeffvli";
repo = "feishin";
tag = "v${version}";
hash = "sha256-F5m0hsN1BLfiUcl2Go54bpFnN8ktn6Rqa/df1xxoCA4=";
};
in
with pkgs;
buildNpmPackage {
inherit src version;
pname = name;
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
npmConfigHook = pnpm.configHook;
nativeBuildInputs = [ copyDesktopItems ];
npmDeps = null;
pnpmDeps = pnpm.fetchDeps {
inherit src version;
pname = name;
fetcherVersion = 2;
hash = "sha256-5jEXdQMZ6a0JuhjPS1eZOIGsIGQHd6nKPI02eeR35pg=";
};
postPatch = ''
# release/app dependencies are installed on preConfigure
substituteInPlace package.json \
--replace-fail '"postinstall": "electron-builder install-app-deps",' ""
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
# Don't check for updates.
substituteInPlace src/main/index.ts \
--replace-fail "autoUpdater.checkForUpdatesAndNotify();" ""
nativeBuildInputs = [copyDesktopItems];
# https://github.com/electron/electron/issues/31121
substituteInPlace src/main/index.ts \
--replace-fail "process.resourcesPath" "'$out/share/feishin/resources'"
'';
postPatch = ''
# release/app dependencies are installed on preConfigure
substituteInPlace package.json \
--replace-fail '"postinstall": "electron-builder install-app-deps",' ""
preBuild = ''
rm -r node_modules/.pnpm/sass-embedded-*
# Don't check for updates.
substituteInPlace src/main/index.ts \
--replace-fail "autoUpdater.checkForUpdatesAndNotify();" ""
test -d node_modules/.pnpm/sass-embedded@*
dir="$(echo node_modules/.pnpm/sass-embedded@*)/node_modules/sass-embedded/dist/lib/src/vendor/dart-sass"
mkdir -p "$dir"
ln -s ${dart-sass}/bin/dart-sass "$dir"/sass
'';
# https://github.com/electron/electron/issues/31121
substituteInPlace src/main/index.ts \
--replace-fail "process.resourcesPath" "'$out/share/feishin/resources'"
'';
postBuild = ''
npm exec electron-builder -- \
--dir \
-c.electronDist=${if stdenv.hostPlatform.isDarwin then "./" else electron.dist} \
-c.electronVersion=${electron.version} \
-c.npmRebuild=false
'';
preBuild = ''
rm -r node_modules/.pnpm/sass-embedded-*
installPhase = ''
runHook preInstall
test -d node_modules/.pnpm/sass-embedded@*
dir="$(echo node_modules/.pnpm/sass-embedded@*)/node_modules/sass-embedded/dist/lib/src/vendor/dart-sass"
mkdir -p "$dir"
ln -s ${dart-sass}/bin/dart-sass "$dir"/sass
'';
mkdir -p $out/share/feishin
postBuild = ''
npm exec electron-builder -- \
--dir \
-c.electronDist=${
if stdenv.hostPlatform.isDarwin
then "./"
else electron.dist
} \
-c.electronVersion=${electron.version} \
-c.npmRebuild=false
'';
pushd dist/*-unpacked/
cp -r locales resources{,.pak} $out/share/feishin
popd
installPhase =
''
runHook preInstall
# Code relies on checking app.isPackaged, which returns false if the executable is electron.
# Set ELECTRON_FORCE_IS_PACKAGED=1.
# https://github.com/electron/electron/issues/35153#issuecomment-1202718531
makeWrapper ${lib.getExe electron} $out/bin/feishin \
--add-flags $out/share/feishin/resources/app.asar \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
--set ELECTRON_FORCE_IS_PACKAGED=1 \
--inherit-argv0
mkdir -p $out/share/feishin
for size in 32 64 128 256 512 1024; do
mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
ln -s \
$out/share/feishin/resources/assets/icons/"$size"x"$size".png \
$out/share/icons/hicolor/"$size"x"$size"/apps/feishin.png
done
''
+ ''
runHook postInstall
'';
pushd dist/*-unpacked/
cp -r locales resources{,.pak} $out/share/feishin
popd
desktopItems = [
(makeDesktopItem {
name = "feishin";
desktopName = "Feishin";
comment = "Full-featured Subsonic/Jellyfin compatible desktop music player";
icon = "feishin";
exec = "feishin %u";
categories = [
"Audio"
"AudioVideo"
# Code relies on checking app.isPackaged, which returns false if the executable is electron.
# Set ELECTRON_FORCE_IS_PACKAGED=1.
# https://github.com/electron/electron/issues/35153#issuecomment-1202718531
makeWrapper ${lib.getExe electron} $out/bin/feishin \
--add-flags $out/share/feishin/resources/app.asar \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
--set ELECTRON_FORCE_IS_PACKAGED=1 \
--inherit-argv0
for size in 32 64 128 256 512 1024; do
mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
ln -s \
$out/share/feishin/resources/assets/icons/"$size"x"$size".png \
$out/share/icons/hicolor/"$size"x"$size"/apps/feishin.png
done
''
+ ''
runHook postInstall
'';
desktopItems = [
(makeDesktopItem {
name = "feishin";
desktopName = "Feishin";
comment = "Full-featured Subsonic/Jellyfin compatible desktop music player";
icon = "feishin";
exec = "feishin %u";
categories = [
"Audio"
"AudioVideo"
];
mimeTypes = ["x-scheme-handler/feishin"];
})
];
mimeTypes = [ "x-scheme-handler/feishin" ];
})
];
}
}