10 pypkgs = python3.pkgs;
12 dbSql = writeText "create_pykms_db.sql" ''
19 lastRequestTime INTEGER,
25 dbScript = writeShellScript "create_pykms_db.sh" ''
28 db=''${1:-/var/lib/pykms/clients.db}
30 if [ ! -e $db ] ; then
31 ${lib.getBin sqlite}/bin/sqlite3 $db < ${dbSql}
36 pypkgs.buildPythonApplication rec {
38 version = "unstable-2021-01-25";
40 src = fetchFromGitHub {
41 owner = "Py-KMS-Organization";
43 rev = "1435c86fe4f11aa7fd42d77fa61715ca3015eeab";
44 hash = "sha256-9KiMbS0uKTbWSZVIv5ziIeR9c8+EKfKd20yPmjCX7GQ=";
47 sourceRoot = "${src.name}/py-kms";
49 propagatedBuildInputs = with pypkgs; [ systemd pytz tzlocal dnspython ];
52 siteDir=$out/${python3.sitePackages}
54 substituteInPlace pykms_DB2Dict.py \
55 --replace "'KmsDataBase.xml'" "'$siteDir/KmsDataBase.xml'"
68 PYTHONPATH="$PYTHONPATH:$siteDir"
71 for b in Client Server ; do
72 makeWrapper ${python3.interpreter} $out/bin/''${b,,} \
73 --argv0 pykms-''${b,,} \
74 --add-flags $siteDir/pykms_$b.py \
75 --set PYTHONPATH $PYTHONPATH
78 install -Dm755 ${dbScript} $out/libexec/create_pykms_db.sh
80 install -Dm644 ../README.md -t $out/share/doc/pykms
82 ${python3.interpreter} -m compileall $siteDir
87 passthru.tests = { inherit (nixosTests) pykms; };
90 description = "Windows KMS (Key Management Service) server written in Python";
91 homepage = "https://github.com/Py-KMS-Organization/py-kms";
92 license = licenses.unlicense;
93 maintainers = with maintainers; [ peterhoeg zopieux ];