modules/android_integration: termux-setup-storage & unsupported

This commit is contained in:
Alexander Sosedkin 2024-07-05 22:52:18 +02:00
parent c4c4f09e3d
commit 733a9fe55c
7 changed files with 265 additions and 4 deletions

View file

@ -7,6 +7,10 @@ let
termux-am =
pkgs.callPackage (import ../../pkgs/android-integration/termux-am.nix) { };
termux-tools =
pkgs.callPackage (import ../../pkgs/android-integration/termux-tools.nix) {
inherit termux-am;
};
in
{
@ -25,12 +29,35 @@ in
'';
};
termux-setup-storage.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = "true";
description = lib.mdDoc ''
Provide a `termux-setup-storage` command
that makes the app request storage permission,
and then creates a $HOME/storage directory with symlinks to storage.
'';
};
unsupported.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = "true";
description = lib.mdDoc ''
Provide several more unsupported and untested commands.
For testing and for brave souls only.
'';
};
};
###### implementation
config = {
config = let ifD = cond: pkg: if cond then [ pkg ] else [ ]; in {
environment.packages =
lib.mkIf cfg.am.enable [ termux-am ];
(ifD cfg.am.enable termux-am) ++
(ifD cfg.termux-setup-storage.enable termux-tools.setup_storage) ++
(ifD cfg.unsupported.enable termux-tools.out);
};
}