From a0e3e71498d63a0905df9c83f4f56b80a42f2987 Mon Sep 17 00:00:00 2001 From: macronova Date: Fri, 3 Oct 2025 20:22:24 -0500 Subject: [PATCH] Update flake --- flake.lock | 39 ++++++++++---- flake.nix | 4 ++ packages/feishin-latest.nix | 100 ++++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+), 11 deletions(-) create mode 100644 packages/feishin-latest.nix diff --git a/flake.lock b/flake.lock index 6b21713..9cf8bb6 100644 --- a/flake.lock +++ b/flake.lock @@ -16,6 +16,22 @@ "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" @@ -36,11 +52,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1757347588, - "narHash": "sha256-tLdkkC6XnsY9EOZW9TlpesTclELy8W7lL2ClL+nma8o=", + "lastModified": 1759381078, + "narHash": "sha256-gTrEEp5gEspIcCOx9PD8kMaF1iEmfBcTbO0Jag2QhQs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b599843bad24621dcaa5ab60dac98f9b0eb1cabe", + "rev": "7df7ff7d8e00218376575f0acdcc5d66741351ee", "type": "github" }, "original": { @@ -53,6 +69,7 @@ "root": { "inputs": { "candy-icons": "candy-icons", + "feishin-latest": "feishin-latest", "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", "sweet-ambar-blue": "sweet-ambar-blue", @@ -66,11 +83,11 @@ "sweet-ambar-blue": { "flake": false, "locked": { - "lastModified": 1756764749, - "narHash": "sha256-L3rdeRZs5kLZv/2nN9MpG3ke66Prq2fO3r6mncpwHLU=", + "lastModified": 1758309482, + "narHash": "sha256-0wlq+qJAL1xu70n/X/xXdhFUlPgwDIvyC6S0zx/IiVE=", "ref": "Ambar-Blue", - "rev": "6ae785f32ce9de14abc61cb2c0700eba1263ce29", - "revCount": 340, + "rev": "24b6235aefe3ac44ebac7c0a5562d7930dff318a", + "revCount": 343, "type": "git", "url": "https://github.com/EliverLara/Sweet" }, @@ -83,11 +100,11 @@ "sweet-ambar-blue-dark": { "flake": false, "locked": { - "lastModified": 1756765118, - "narHash": "sha256-wsspXkF7kR3VRtKfABGyC0mEMzyCXG0bsoIZ75RzTaU=", + "lastModified": 1758309597, + "narHash": "sha256-zFpUDXUZ3zv8/5CIW/acl+SuMEGNZWHWKCuqlUtnCf8=", "ref": "Ambar-Blue-Dark", - "rev": "f146fcc2cf4ac717bd0fed9706ccd380874d2bf4", - "revCount": 423, + "rev": "270ec6c58e073a6315ea4423d5e655c55e418020", + "revCount": 426, "type": "git", "url": "https://github.com/EliverLara/Sweet" }, diff --git a/flake.nix b/flake.nix index fc27d0e..9fd4552 100644 --- a/flake.nix +++ b/flake.nix @@ -8,6 +8,10 @@ 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"; diff --git a/packages/feishin-latest.nix b/packages/feishin-latest.nix new file mode 100644 index 0000000..56a2b05 --- /dev/null +++ b/packages/feishin-latest.nix @@ -0,0 +1,100 @@ +{ + 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="; + }; + + env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; + + nativeBuildInputs = [ copyDesktopItems ]; + + postPatch = '' + # release/app dependencies are installed on preConfigure + substituteInPlace package.json \ + --replace-fail '"postinstall": "electron-builder install-app-deps",' "" + + # Don't check for updates. + substituteInPlace src/main/index.ts \ + --replace-fail "autoUpdater.checkForUpdatesAndNotify();" "" + + # https://github.com/electron/electron/issues/31121 + substituteInPlace src/main/index.ts \ + --replace-fail "process.resourcesPath" "'$out/share/feishin/resources'" + ''; + + preBuild = '' + rm -r node_modules/.pnpm/sass-embedded-* + + 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 + ''; + + postBuild = '' + npm exec electron-builder -- \ + --dir \ + -c.electronDist=${if stdenv.hostPlatform.isDarwin then "./" else electron.dist} \ + -c.electronVersion=${electron.version} \ + -c.npmRebuild=false + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/feishin + + pushd dist/*-unpacked/ + cp -r locales resources{,.pak} $out/share/feishin + popd + + # 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" ]; + }) + ]; +}