From d857988d21be667385c3841f0ce7df7c9ec153fb Mon Sep 17 00:00:00 2001 From: Chuck Z Date: Fri, 31 Mar 2023 13:19:53 -0600 Subject: [PATCH 1/3] 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. --- pkgs/games/anki/bin.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/games/anki/bin.nix b/pkgs/games/anki/bin.nix index c2a988d16876..d824475f8fd8 100644 --- a/pkgs/games/anki/bin.nix +++ b/pkgs/games/anki/bin.nix @@ -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 = '' From 5f2678d7d3dff2956b53fcd69c8dd22ac39e8521 Mon Sep 17 00:00:00 2001 From: Charles Zhang Date: Fri, 31 Mar 2023 14:21:30 -0600 Subject: [PATCH 2/3] Update pkgs/games/anki/bin.nix Co-authored-by: Norbert Melzer --- pkgs/games/anki/bin.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/games/anki/bin.nix b/pkgs/games/anki/bin.nix index d824475f8fd8..76da2825571a 100644 --- a/pkgs/games/anki/bin.nix +++ b/pkgs/games/anki/bin.nix @@ -57,7 +57,7 @@ let targetPkgs = pkgs: (with pkgs; [ xorg.libxkbfile krb5 ]); runScript = writeShellScript "anki-wrapper.sh" '' - exec ${unpacked}/bin/anki ${ lib.strings.escapeShellArg commandLineArgs } + exec ${unpacked}/bin/anki ${ lib.strings.escapeShellArgs commandLineArgs } ''; extraInstallCommands = '' From 052d58934700a81b270edc148c76e50e8ce90956 Mon Sep 17 00:00:00 2001 From: Charles Zhang Date: Fri, 31 Mar 2023 14:21:40 -0600 Subject: [PATCH 3/3] Update pkgs/games/anki/bin.nix Co-authored-by: Norbert Melzer --- pkgs/games/anki/bin.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/games/anki/bin.nix b/pkgs/games/anki/bin.nix index 76da2825571a..cb07fcde442b 100644 --- a/pkgs/games/anki/bin.nix +++ b/pkgs/games/anki/bin.nix @@ -1,4 +1,4 @@ -{ fetchurl, stdenv, lib, buildFHSUserEnv, appimageTools, writeShellScript, anki, undmg, zstd, commandLineArgs ? "" }: +{ fetchurl, stdenv, lib, buildFHSUserEnv, appimageTools, writeShellScript, anki, undmg, zstd, commandLineArgs ? [] }: let pname = "anki-bin";