parent
2316901e93
commit
59990a614f
73
pkgs/tools/admin/gam/default.nix
Normal file
73
pkgs/tools/admin/gam/default.nix
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
{ lib
|
||||||
|
, fetchFromGitHub
|
||||||
|
, python3
|
||||||
|
}:
|
||||||
|
|
||||||
|
python3.pkgs.buildPythonApplication rec {
|
||||||
|
pname = "gam";
|
||||||
|
version = "6.22";
|
||||||
|
format = "other";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "GAM-team";
|
||||||
|
repo = "gam";
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "sha256-G/S1Rrm+suiy1CTTFLcBGt/QhARL7puHgR65nCxodH0=";
|
||||||
|
};
|
||||||
|
|
||||||
|
sourceRoot = "source/src";
|
||||||
|
|
||||||
|
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 ];
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
38
pkgs/tools/admin/gam/signal_files_as_env_vars.patch
Normal file
38
pkgs/tools/admin/gam/signal_files_as_env_vars.patch
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
diff --git a/gam/__init__.py b/gam/__init__.py
|
||||||
|
index 1c187ce..b2de793 100755
|
||||||
|
--- a/gam/__init__.py
|
||||||
|
+++ b/gam/__init__.py
|
||||||
|
@@ -549,22 +549,16 @@ def SetGlobalVariables():
|
||||||
|
_getOldEnvVar(GC_TLS_MIN_VERSION, 'GAM_TLS_MIN_VERSION')
|
||||||
|
_getOldEnvVar(GC_TLS_MAX_VERSION, 'GAM_TLS_MAX_VERSION')
|
||||||
|
_getOldEnvVar(GC_CA_FILE, 'GAM_CA_FILE')
|
||||||
|
- _getOldSignalFile(GC_DEBUG_LEVEL,
|
||||||
|
- 'debug.gam',
|
||||||
|
- filePresentValue=4,
|
||||||
|
- fileAbsentValue=0)
|
||||||
|
- _getOldSignalFile(GC_NO_BROWSER, 'nobrowser.txt')
|
||||||
|
- _getOldSignalFile(GC_NO_TDEMAIL, 'notdemail.txt')
|
||||||
|
- _getOldSignalFile(GC_OAUTH_BROWSER, 'oauthbrowser.txt')
|
||||||
|
+ _getOldEnvVar(GC_DEBUG_LEVEL, 'GAM_DEBUG')
|
||||||
|
+ _getOldEnvVar(GC_NO_BROWSER, 'GAM_NO_BROWSER')
|
||||||
|
+ _getOldEnvVar(GC_NO_TDEMAIL, 'GAM_NO_TDEMAIL')
|
||||||
|
+ _getOldEnvVar(GC_OAUTH_BROWSER, 'GAM_OAUTH_BROWSER')
|
||||||
|
# _getOldSignalFile(GC_NO_CACHE, u'nocache.txt')
|
||||||
|
# _getOldSignalFile(GC_CACHE_DISCOVERY_ONLY, u'allcache.txt', filePresentValue=False, fileAbsentValue=True)
|
||||||
|
- _getOldSignalFile(GC_NO_CACHE,
|
||||||
|
- 'allcache.txt',
|
||||||
|
- filePresentValue=False,
|
||||||
|
- fileAbsentValue=True)
|
||||||
|
- _getOldSignalFile(GC_NO_SHORT_URLS, 'noshorturls.txt')
|
||||||
|
- _getOldSignalFile(GC_NO_UPDATE_CHECK, 'noupdatecheck.txt')
|
||||||
|
- _getOldSignalFile(GC_ENABLE_DASA, FN_ENABLEDASA_TXT)
|
||||||
|
+ _getOldEnvVar(GC_NO_CACHE, 'GAM_NO_CACHE')
|
||||||
|
+ _getOldEnvVar(GC_NO_SHORT_URLS, 'GAM_NO_SHORT_URLS')
|
||||||
|
+ GC_Defaults[GC_NO_UPDATE_CHECK] = True
|
||||||
|
+ _getOldEnvVar(GC_ENABLE_DASA, FN_ENABLEDASA_TXT)
|
||||||
|
# Assign directories first
|
||||||
|
for itemName in GC_VAR_INFO:
|
||||||
|
if GC_VAR_INFO[itemName][GC_VAR_TYPE] == GC_TYPE_DIRECTORY:
|
||||||
|
--
|
||||||
|
2.36.0
|
||||||
|
|
|
@ -1179,6 +1179,8 @@ with pkgs;
|
||||||
inherit (darwin.apple_sdk.frameworks) ApplicationServices Carbon Cocoa VideoToolbox;
|
inherit (darwin.apple_sdk.frameworks) ApplicationServices Carbon Cocoa VideoToolbox;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
gam = callPackage ../tools/admin/gam { };
|
||||||
|
|
||||||
gfshare = callPackage ../tools/security/gfshare { };
|
gfshare = callPackage ../tools/security/gfshare { };
|
||||||
|
|
||||||
gh-cal = callPackage ../tools/misc/gh-cal {
|
gh-cal = callPackage ../tools/misc/gh-cal {
|
||||||
|
|
Loading…
Reference in a new issue