diff --git a/pkgs/by-name/ga/gam/package.nix b/pkgs/by-name/ga/gam/package.nix index 9081375e3f3a..31b8cb898e62 100644 --- a/pkgs/by-name/ga/gam/package.nix +++ b/pkgs/by-name/ga/gam/package.nix @@ -2,36 +2,41 @@ lib, fetchFromGitHub, python3, + yubikey-manager, + gitUpdater, + cacert, }: python3.pkgs.buildPythonApplication rec { pname = "gam"; - version = "6.58"; - format = "other"; + version = "7.21.01"; + pyproject = true; src = fetchFromGitHub { owner = "GAM-team"; repo = "GAM"; tag = "v${version}"; - sha256 = "sha256-AIaPzYavbBlJyi9arZN8HTmUXM7Tef0SIfE07PmV9Oo="; + hash = "sha256-Xj9GTNVuRddu3YQtXD/+yM/MNMxXUkfprtIFAm9SnA4="; }; - sourceRoot = "${src.name}/src"; + build-system = [ python3.pkgs.hatchling ]; - propagatedBuildInputs = with python3.pkgs; [ + dependencies = with python3.pkgs; [ + arrow chardet cryptography distro filelock google-api-python-client google-auth + google-auth-httplib2 google-auth-oauthlib httplib2 lxml passlib pathvalidate python-dateutil - setuptools + yubikey-manager ]; # Use XDG-ish dirs for configuration. These would otherwise be in the gam @@ -41,27 +46,19 @@ python3.pkgs.buildPythonApplication rec { # 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. + # Detailed on this page: https://github.com/GAM-team/GAM/wiki/gam.cfg makeWrapperArgs = [ + ''--set-default GAM_CA_FILE "${cacert}/etc/ssl/certs/ca-bundle.crt"'' + ''--run 'export GAMCFGDIR="''${XDG_CONFIG_HOME:-$HOME/.config}/gam"' '' ''--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/${python3.sitePackages} - cp -r gam $out/${python3.sitePackages} - runHook postInstall - ''; + pythonImportsCheck = [ "gam" ]; - checkPhase = '' - runHook preCheck - ${python3.interpreter} -m unittest discover --pattern "*_test.py" --buffer - runHook postCheck - ''; + passthru.updateScript = gitUpdater { rev-prefix = "v"; }; meta = { description = "Command line management for Google Workspace";