Hello i am creating a package for tinymediamanager
Here is my PR
The commit that i reference (in case i force push): tinyMediaManager: init at 5.3.0 · NixOS/nixpkgs@0bed87f · GitHub
For local development i have a default.nix file so that i can use nix-build to test changes in package.nix
default.nix
let
pkgs = import <nixpkgs> {};
in
pkgs.callPackage ./package.nix {}
package.nix
{
alsa-lib,
autoPatchelfHook,
chromedriver,
copyDesktopItems,
deno,
ffmpeg,
fontconfig,
fetchFromGitLab,
glib,
gtk3,
imagemagick,
lib,
libmediainfo,
libzen,
libx11,
libxext,
libxft,
libxi,
libxrender,
libxtst,
makeDesktopItem,
makeWrapper,
maven,
pipewire,
wayland,
yt-dlp,
zenity,
zlib,
stdenv,
xz,
}:
let
# Define sources for different architectures
sources = {
"x86_64-linux" = {
arch = "amd64";
};
"aarch64-linux" = {
arch = "arm64";
};
};
# Select the source based on the current system
sysSrc =
sources.${stdenv.hostPlatform.system}
or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
runtimeLibs = [
alsa-lib
fontconfig
glib
gtk3
libmediainfo
libzen
pipewire
wayland
libx11
libxext
libxft
libxi
libxrender
libxtst
zlib
];
runtimepaths = [
chromedriver
yt-dlp
ffmpeg
deno
zenity
];
in
maven.buildMavenPackage rec {
pname = "tinyMediaManager";
version = "5.3.0";
# hash for nix-build
# mvnHash = "sha256-bf5GSlZgFvNBE7yVF/CasLBOQoaqgDKyX+OmDCVVuuc=";
# hash for nixpkgs-review rev HEAD
# mvnHash = "sha256-EkoJHjdgBYH821T3/yvTQFhU1uTtipqiBp+gFwJdUEE=";
mvnHash = "sha256-bf5GSlZgFvNBE7yVF/CasLBOQoaqgDKyX+OmDCVVuuc=";
src = fetchFromGitLab {
owner = "tinyMediaManager";
repo = "tinyMediaManager";
rev = "tinyMediaManager-${version}";
hash = "sha256-chvr+EvZO84ln6YmHxtVSrxXXf9G7xlmJGSyzS/ItfQ=";
};
# remove other builds from pom.xml to speed up build
postPatch = ''
substituteInPlace pom.xml \
--replace-fail "<descriptor>src/assembly/windows-x64.xml</descriptor>" ""
'';
# Fetch plugins during the dependency download phase.
mvnDepsParameters = "-DskipTests -Pdist -DbuildNumber=${version} -Dmaven.buildNumber.skip=true";
mvnParameters = "-DskipTests -Pdist -DbuildNumber=${version} -Dmaven.buildNumber.skip=true";
nativeBuildInputs = [
autoPatchelfHook
copyDesktopItems
makeWrapper
imagemagick
xz
];
buildInputs = runtimeLibs;
strictDeps = true;
__structuredAttrs = true;
desktopItems = [
(makeDesktopItem {
name = "tinyMediaManager";
exec = "tinyMediaManager";
icon = "tinyMediaManager";
comment = "A media management tool";
desktopName = "tinyMediaManager";
genericName = "Media Manager";
categories = [
"Video"
"AudioVideo"
];
terminal = false;
})
];
installPhase = ''
runHook preInstall
TARBALL="dist/tinyMediaManager-${version}-GIT-linux-${sysSrc.arch}.tar.gz"
if [ ! -f "$TARBALL" ]; then
echo "Error: Could not find $TARBALL"
echo "Actual contents of dist/ directory:"
ls -R dist/ || echo "dist/ directory not found"
exit 5
fi
# Create destination directory
mkdir -p $out/opt/tinyMediaManager $out/bin
# --strip-components=1 removes the top-level folder inside the tarball
# so files land directly in our share directory.
tar -xvf "$TARBALL" -C $out/opt/tinyMediaManager --strip-components=1
# maven downloads an unfree binary
makeWrapper $out/opt/tinyMediaManager/tinyMediaManager $out/bin/tinyMediaManager \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeLibs}" \
--prefix PATH : "${lib.makeBinPath runtimepaths}"
# Handle the icon
mkdir -p $out/share/pixmaps
if [ -f "$out/opt/tinyMediaManager/tmm.png" ]; then
ln -s $out/opt/tinyMediaManager/tmm.png $out/share/pixmaps/tinyMediaManager.png
fi
for size in 16 32 48 64 128; do
mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
magick -background none $out/share/pixmaps/tinyMediaManager.png -resize "$size"x"$size" $out/share/icons/hicolor/"$size"x"$size"/apps/tinyMediaManager.png
done
# change startup settings
# suppress autoupdate
# it should use PATH and not shipped binaries
substituteInPlace $out/opt/tinyMediaManager/launcher.yml \
--replace-fail 'jvmOpts:' "jvmOpts:
- '-Dtmm.noupdate=true'
- '-Dtmm.useexternaltools=false'"
runHook postInstall
'';
meta = with lib; {
description = "A media management tool";
homepage = "https://www.tinymediamanager.org/";
changelog = "https://gitlab.com/tinyMediaManager/tinyMediaManager/-/releases/tinyMediaManager-${version}#changelog";
# the java code is open source but the binary which invokes the java code is unfree
# maven downloads this unfree binary
# the creator said that in the future it could be possible that building from source no longer works when he integrates stronger drm
# the creator allowed redistributing
license =
with lib.licenses;
AND [
asl20
unfreeRedistributable
];
maintainers = with lib.maintainers; [ gamebeaker ];
platforms = [
"x86_64-linux"
"aarch64-linux"
];
mainProgram = "tinyMediaManager";
};
}
My problem is that with nix-build my maven hash is:
mvnHash = "sha256-bf5GSlZgFvNBE7yVF/CasLBOQoaqgDKyX+OmDCVVuuc=";
When i use nixpkgs-review rev HEAD the hash changes to:
mvnHash = "sha256-EkoJHjdgBYH821T3/yvTQFhU1uTtipqiBp+gFwJdUEE=";
The code is in Line 80
I tried deleting my maven cache.
I thought maybe nixpkgs-review builds the arm version so i made the hashes system depended.
Why does this happen?
