anki-bin: add commandLineArgs to package arguments

anki-bin is built with buildFHSUserEnv on Linux, which makes using overrides
  to pass in command line arguments impossible. This commit adds the
  commandLineArgs argument to the package inputs and appends the string
  to the runscript, allowing pkgs.override to add flags to pass to anki
  when the derivation is built.

  This is useful when anki's desired directory isn't the default, allowing
  users to specify the directory in their overlays instead of adding a
  flag everytime they call the program.
This commit is contained in:
Chuck Z 2023-03-31 13:19:53 -06:00
parent 0c36f27606
commit d857988d21

View File

@ -1,4 +1,4 @@
{ fetchurl, stdenv, lib, buildFHSUserEnv, appimageTools, writeShellScript, anki, undmg, zstd }:
{ fetchurl, stdenv, lib, buildFHSUserEnv, appimageTools, writeShellScript, anki, undmg, zstd, commandLineArgs ? "" }:
let
pname = "anki-bin";
@ -57,7 +57,7 @@ let
targetPkgs = pkgs: (with pkgs; [ xorg.libxkbfile krb5 ]);
runScript = writeShellScript "anki-wrapper.sh" ''
exec ${unpacked}/bin/anki
exec ${unpacked}/bin/anki ${ lib.strings.escapeShellArg commandLineArgs }
'';
extraInstallCommands = ''