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

View file

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

View file

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