2022-08-21 13:32:41 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, python3
|
|
|
|
}:
|
|
|
|
|
|
|
|
python3.pkgs.buildPythonApplication rec {
|
|
|
|
pname = "gam";
|
2023-02-02 18:25:31 +00:00
|
|
|
version = "6.25";
|
2022-08-21 13:32:41 +00:00
|
|
|
format = "other";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "GAM-team";
|
|
|
|
repo = "gam";
|
2023-02-02 18:25:31 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
sha256 = "sha256-/VmBFMjCkd1xhudlcjYGGv+6tgEsyY/xqQoGdupJvOg=";
|
2022-08-21 13:32:41 +00:00
|
|
|
};
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
sourceRoot = "${src.name}/src";
|
2022-08-21 13:32:41 +00:00
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Also disables update check
|
|
|
|
./signal_files_as_env_vars.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = with python3.pkgs; [
|
|
|
|
distro
|
|
|
|
filelock
|
|
|
|
google-api-python-client
|
|
|
|
google-auth
|
|
|
|
google-auth-oauthlib
|
|
|
|
passlib
|
|
|
|
pathvalidate
|
|
|
|
python-dateutil
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
|
|
|
# Use XDG-ish dirs for configuration. These would otherwise be in the gam
|
|
|
|
# package.
|
|
|
|
#
|
|
|
|
# Using --run as `makeWapper` evaluates variables for --set and --set-default
|
|
|
|
# at build time and then single quotes the vars in the wrapper, thus they
|
|
|
|
# wouldn't get expanded. But using --run allows setting default vars that are
|
|
|
|
# evaluated on run and not during build time.
|
|
|
|
makeWrapperArgs = [
|
|
|
|
''--run 'export GAMUSERCONFIGDIR="''${XDG_CONFIG_HOME:-$HOME/.config}/gam"' ''
|
|
|
|
''--run 'export GAMSITECONFIGDIR="''${XDG_CONFIG_HOME:-$HOME/.config}/gam"' ''
|
|
|
|
''--run 'export GAMCACHEDIR="''${XDG_CACHE_HOME:-$HOME/.cache}/gam"' ''
|
|
|
|
''--run 'export GAMDRIVEDIR="$PWD"' ''
|
|
|
|
];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp gam.py $out/bin/gam
|
|
|
|
mkdir -p $out/lib/${python3.libPrefix}/site-packages
|
|
|
|
cp -r gam $out/lib/${python3.libPrefix}/site-packages
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
${python3.interpreter} -m unittest discover --pattern "*_test.py" --buffer
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Command line management for Google Workspace";
|
|
|
|
homepage = "https://github.com/GAM-team/GAM/wiki";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ thanegill ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|