nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 python3,
5}:
6
7python3.pkgs.buildPythonApplication rec {
8 pname = "gam";
9 version = "6.58";
10 format = "other";
11
12 src = fetchFromGitHub {
13 owner = "GAM-team";
14 repo = "GAM";
15 tag = "v${version}";
16 sha256 = "sha256-AIaPzYavbBlJyi9arZN8HTmUXM7Tef0SIfE07PmV9Oo=";
17 };
18
19 sourceRoot = "${src.name}/src";
20
21 propagatedBuildInputs = with python3.pkgs; [
22 chardet
23 cryptography
24 distro
25 filelock
26 google-api-python-client
27 google-auth
28 google-auth-oauthlib
29 httplib2
30 lxml
31 passlib
32 pathvalidate
33 python-dateutil
34 setuptools
35 ];
36
37 # Use XDG-ish dirs for configuration. These would otherwise be in the gam
38 # package.
39 #
40 # Using --run as `makeWapper` evaluates variables for --set and --set-default
41 # at build time and then single quotes the vars in the wrapper, thus they
42 # wouldn't get expanded. But using --run allows setting default vars that are
43 # evaluated on run and not during build time.
44 makeWrapperArgs = [
45 ''--run 'export GAMUSERCONFIGDIR="''${XDG_CONFIG_HOME:-$HOME/.config}/gam"' ''
46 ''--run 'export GAMSITECONFIGDIR="''${XDG_CONFIG_HOME:-$HOME/.config}/gam"' ''
47 ''--run 'export GAMCACHEDIR="''${XDG_CACHE_HOME:-$HOME/.cache}/gam"' ''
48 ''--run 'export GAMDRIVEDIR="$PWD"' ''
49 ];
50
51 installPhase = ''
52 runHook preInstall
53 mkdir -p $out/bin
54 cp gam.py $out/bin/gam
55 mkdir -p $out/${python3.sitePackages}
56 cp -r gam $out/${python3.sitePackages}
57 runHook postInstall
58 '';
59
60 checkPhase = ''
61 runHook preCheck
62 ${python3.interpreter} -m unittest discover --pattern "*_test.py" --buffer
63 runHook postCheck
64 '';
65
66 meta = {
67 description = "Command line management for Google Workspace";
68 mainProgram = "gam";
69 homepage = "https://github.com/GAM-team/GAM/wiki";
70 changelog = "https://github.com/GAM-team/GAM/releases/tag/v${version}";
71 license = lib.licenses.asl20;
72 maintainers = with lib.maintainers; [ thanegill ];
73 };
74
75}