Migrate to `callPackage` pattern.

main
Joshua Potter 2024-02-02 09:47:19 -07:00
parent 06dee21fd5
commit 06e835ddee
2 changed files with 17 additions and 8 deletions

View File

@ -1,17 +1,26 @@
{ pkgs, lib, commandLineArgs ? [] }: { fetchurl
, stdenv
, lib
, buildFHSEnv
, appimageTools
, writeShellScript
, anki
, zstd
, commandLineArgs ? []
}:
let let
pname = "anki-bin"; pname = "anki-bin";
version = "23.12.1"; version = "23.12.1";
linux = pkgs.fetchurl { linux = fetchurl {
url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-linux-qt6.tar.zst"; url = "https://github.com/ankitects/anki/releases/download/${version}/anki-${version}-linux-qt6.tar.zst";
sha256 = "sha256-bFtAUqSoFS8CWESiepWXywndkijATbWp6CJdqlQecuk="; sha256 = "sha256-bFtAUqSoFS8CWESiepWXywndkijATbWp6CJdqlQecuk=";
}; };
unpacked = pkgs.stdenv.mkDerivation { unpacked = stdenv.mkDerivation {
inherit pname version; inherit pname version;
nativeBuildInputs = [ pkgs.zstd ]; nativeBuildInputs = [ zstd ];
src = linux; src = linux;
installPhase = '' installPhase = ''
@ -28,12 +37,12 @@ let
passthru.sources = { inherit linux; }; passthru.sources = { inherit linux; };
meta = with lib; { meta = with lib; {
inherit (pkgs.anki.meta) license homepage description longDescription; inherit (anki.meta) license homepage description longDescription;
platforms = [ "x86_64-linux" ]; platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ mahmoudk1000 ]; maintainers = with maintainers; [ mahmoudk1000 ];
}; };
in in
pkgs.buildFHSEnv (pkgs.appimageTools.defaultFhsEnvArgs // { buildFHSEnv (appimageTools.defaultFhsEnvArgs // {
inherit pname version; inherit pname version;
name = null; # Appimage sets it to "appimage-env" name = null; # Appimage sets it to "appimage-env"
@ -43,7 +52,7 @@ in
krb5 krb5
]); ]);
runScript = pkgs.writeShellScript "anki-wrapper.sh" '' runScript = writeShellScript "anki-wrapper.sh" ''
exec ${unpacked}/bin/anki ${ lib.strings.escapeShellArgs commandLineArgs } "$@" exec ${unpacked}/bin/anki ${ lib.strings.escapeShellArgs commandLineArgs } "$@"
''; '';

View File

@ -129,6 +129,6 @@ in
}; };
home.packages = [ home.packages = [
(import ./bin.nix { inherit pkgs lib; }) (pkgs.callPackage ./bin.nix {})
]; ];
} }