nixpkgs/pkgs/by-name/ga/gam/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

75 lines
1.9 KiB
Nix

{ lib
, fetchFromGitHub
, python3
}:
python3.pkgs.buildPythonApplication rec {
pname = "gam";
version = "6.58";
format = "other";
src = fetchFromGitHub {
owner = "GAM-team";
repo = "GAM";
rev = "refs/tags/v${version}";
sha256 = "sha256-AIaPzYavbBlJyi9arZN8HTmUXM7Tef0SIfE07PmV9Oo=";
};
sourceRoot = "${src.name}/src";
propagatedBuildInputs = with python3.pkgs; [
chardet
cryptography
distro
filelock
google-api-python-client
google-auth
google-auth-oauthlib
httplib2
lxml
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/${python3.sitePackages}
cp -r gam $out/${python3.sitePackages}
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";
mainProgram = "gam";
homepage = "https://github.com/GAM-team/GAM/wiki";
changelog = "https://github.com/GAM-team/GAM/releases/tag/v${version}";
license = licenses.asl20;
maintainers = with maintainers; [ thanegill ];
};
}