Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, fetchFromGitHub 3, python3 4}: 5 6python3.pkgs.buildPythonApplication rec { 7 pname = "gam"; 8 version = "6.25"; 9 format = "other"; 10 11 src = fetchFromGitHub { 12 owner = "GAM-team"; 13 repo = "gam"; 14 rev = "refs/tags/v${version}"; 15 sha256 = "sha256-/VmBFMjCkd1xhudlcjYGGv+6tgEsyY/xqQoGdupJvOg="; 16 }; 17 18 sourceRoot = "source/src"; 19 20 patches = [ 21 # Also disables update check 22 ./signal_files_as_env_vars.patch 23 ]; 24 25 propagatedBuildInputs = with python3.pkgs; [ 26 distro 27 filelock 28 google-api-python-client 29 google-auth 30 google-auth-oauthlib 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/lib/${python3.libPrefix}/site-packages 56 cp -r gam $out/lib/${python3.libPrefix}/site-packages 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 = with lib; { 67 description = "Command line management for Google Workspace"; 68 homepage = "https://github.com/GAM-team/GAM/wiki"; 69 license = licenses.asl20; 70 maintainers = with maintainers; [ thanegill ]; 71 }; 72 73}