diff --git a/pkgs/by-name/se/seanime/default-disable-update-check.patch b/pkgs/by-name/se/seanime/default-disable-update-check.patch new file mode 100644 index 000000000000..a7dbad448dd2 --- /dev/null +++ b/pkgs/by-name/se/seanime/default-disable-update-check.patch @@ -0,0 +1,13 @@ +diff --git a/src/lib/server/settings.ts b/src/lib/server/settings.ts +index c28f466..4555e90 100644 +--- a/src/lib/server/settings.ts ++++ b/src/lib/server/settings.ts +@@ -65,7 +65,7 @@ export const settingsSchema = z.object({ + transmissionPassword: z.string().optional().default(""), + hideAudienceScore: z.boolean().optional().default(false), + autoUpdateProgress: z.boolean().optional().default(false), +- disableUpdateCheck: z.boolean().optional().default(false), ++ disableUpdateCheck: z.boolean().optional().default(true), + enableOnlinestream: z.boolean().optional().default(false), + includeOnlineStreamingInLibrary: z.boolean().optional().default(false), + disableAnimeCardTrailers: z.boolean().optional().default(false), diff --git a/pkgs/by-name/se/seanime/package.nix b/pkgs/by-name/se/seanime/package.nix new file mode 100644 index 000000000000..08cfac41dc4f --- /dev/null +++ b/pkgs/by-name/se/seanime/package.nix @@ -0,0 +1,91 @@ +{ + lib, + fetchFromGitHub, + buildGoModule, + buildNpmPackage, + inter, + ffmpeg, +}: +let + version = "3.3.0"; + src = fetchFromGitHub { + owner = "5rahim"; + repo = "seanime"; + rev = "v${version}"; + hash = "sha256-AsRbT4P4B8uWyCtoET14pqqXjkZraoPPih6waiuHVso="; + }; + + seanime-web = buildNpmPackage { + pname = "seanime-web"; + + inherit src version; + + sourceRoot = "${src.name}/seanime-web"; + + patches = [ ./default-disable-update-check.patch ]; + + npmDepsHash = "sha256-rRgp8nXuRvCSOLo040i4ZL+0GCYkEEnkxpgwqDBt/EY="; + + # nextjs seems to require relative paths + postPatch = '' + cp "${inter}/share/fonts/truetype/InterVariable.ttf" src/app/Inter.ttf + + substituteInPlace ./src/app/layout.tsx \ + --replace-fail 'import { Inter } from "next/font/google"' 'import localFont from "next/font/local"' \ + --replace-fail 'const inter = Inter({ subsets: ["latin"] })' 'const inter = localFont({ src: "./Inter.ttf" })' + + substituteInPlace './src/app/(main)/entry/_containers/torrent-stream/torrent-stream-overlay.tsx' \ + --replace-fail 'import { Inter } from "next/font/google"' 'import localFont from "next/font/local"' \ + --replace-fail 'const inter = Inter({ subsets: ["latin"] })' 'const inter = localFont({ src: "../../../../Inter.ttf" })' + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out + cp -r out $out/web + + runHook postInstall + ''; + }; +in +buildGoModule { + pname = "seanime"; + + inherit src version; + + vendorHash = "sha256-6KM3fGpK78wRnP+PKSY/NKexzz/3WxBDRkhnQzoE5KY="; + + preBuild = '' + cp -r ${seanime-web}/web . + + # .github scripts redeclare main + rm -rf .github + ''; + + subPackages = [ "." ]; + + doCheck = false; # broken in clean environments + + ldflags = [ + "-s" + "-w" + ]; + + makeWrapperArgs = [ + "--prefix PATH : ${ + lib.makeBinPath [ + ffmpeg + ] + }" + ]; + + meta = { + description = "Open-source media server for anime and manga"; + homepage = "https://seanime.app"; + changelog = "https://github.com/5rahim/seanime/blob/main/CHANGELOG.md"; + mainProgram = "seanime"; + license = lib.licenses.gpl3; + maintainers = with lib.maintainers; [ thegu5 ]; + }; +}