anki-bin: set correct name and version for derivation

anki-bin is built with buildFHSUserEnv on Linux, which doesn't set a
version for the resulting derivation.  This commit overrides the
resulting derivation to have a version set correctly.

This is important for end-users to be able to easily tell what
version of Anki they will get when they install `anki-bin`.  It is
normally very important to use the correct version of Anki.
This commit is contained in:
Dennis Gosnell 2023-02-25 14:00:05 +09:00
parent 9009e18c95
commit 0467f6d76f
No known key found for this signature in database
GPG Key ID: 462E0C03D11422F4

View File

@ -49,28 +49,39 @@ let
};
passthru = { inherit sources; };
fhsUserEnvAnki = buildFHSUserEnv (appimageTools.defaultFhsEnvArgs // {
name = "anki";
# Dependencies of anki
targetPkgs = pkgs: (with pkgs; [ xorg.libxkbfile krb5 ]);
runScript = writeShellScript "anki-wrapper.sh" ''
exec ${unpacked}/bin/anki
'';
extraInstallCommands = ''
mkdir -p $out/share
cp -R ${unpacked}/share/applications \
${unpacked}/share/man \
${unpacked}/share/pixmaps \
$out/share/
'';
inherit meta passthru;
});
fhsUserEnvAnkiWithVersion = fhsUserEnvAnki.overrideAttrs (oldAttrs: {
# buildFHSUserEnv doesn't have an easy way to set the version of the
# resulting derivation, so we manually override it here. This makes
# it clear to end users the version of anki-bin. Without this, users
# might assume anki-bin is an old version of Anki.
name = "${pname}-${version}";
});
in
if stdenv.isLinux then buildFHSUserEnv (appimageTools.defaultFhsEnvArgs // {
name = "anki";
# Dependencies of anki
targetPkgs = pkgs: (with pkgs; [ xorg.libxkbfile krb5 ]);
runScript = writeShellScript "anki-wrapper.sh" ''
exec ${unpacked}/bin/anki
'';
extraInstallCommands = ''
mkdir -p $out/share
cp -R ${unpacked}/share/applications \
${unpacked}/share/man \
${unpacked}/share/pixmaps \
$out/share/
'';
inherit meta passthru;
}) else stdenv.mkDerivation {
if stdenv.isLinux then fhsUserEnvAnkiWithVersion
else stdenv.mkDerivation {
inherit pname version passthru;
src = if stdenv.isAarch64 then sources.darwin-aarch64 else sources.darwin-x86_64;