Merge pull request #197989 from SuperSandro2000/healthchecks
This commit is contained in:
commit
4f989630d2
|
@ -15,14 +15,14 @@ let
|
||||||
|
|
||||||
environmentFile = pkgs.writeText "healthchecks-environment" (lib.generators.toKeyValue { } environment);
|
environmentFile = pkgs.writeText "healthchecks-environment" (lib.generators.toKeyValue { } environment);
|
||||||
|
|
||||||
healthchecksManageScript = with pkgs; (writeShellScriptBin "healthchecks-manage" ''
|
healthchecksManageScript = pkgs.writeShellScriptBin "healthchecks-manage" ''
|
||||||
|
sudo=exec
|
||||||
if [[ "$USER" != "${cfg.user}" ]]; then
|
if [[ "$USER" != "${cfg.user}" ]]; then
|
||||||
echo "please run as user 'healtchecks'." >/dev/stderr
|
sudo='exec /run/wrappers/bin/sudo -u ${cfg.user} --preserve-env --preserve-env=PYTHONPATH'
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
export $(cat ${environmentFile} | xargs);
|
export $(cat ${environmentFile} | xargs)
|
||||||
exec ${pkg}/opt/healthchecks/manage.py "$@"
|
$sudo ${pkg}/opt/healthchecks/manage.py "$@"
|
||||||
'');
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.healthchecks = {
|
options.services.healthchecks = {
|
||||||
|
@ -163,7 +163,7 @@ in
|
||||||
WorkingDirectory = cfg.dataDir;
|
WorkingDirectory = cfg.dataDir;
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
Group = cfg.group;
|
Group = cfg.group;
|
||||||
EnvironmentFile = environmentFile;
|
EnvironmentFile = [ environmentFile ];
|
||||||
StateDirectory = mkIf (cfg.dataDir == "/var/lib/healthchecks") "healthchecks";
|
StateDirectory = mkIf (cfg.dataDir == "/var/lib/healthchecks") "healthchecks";
|
||||||
StateDirectoryMode = mkIf (cfg.dataDir == "/var/lib/healthchecks") "0750";
|
StateDirectoryMode = mkIf (cfg.dataDir == "/var/lib/healthchecks") "0750";
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,10 +33,10 @@ import ../make-test-python.nix ({ lib, pkgs, ... }: {
|
||||||
)
|
)
|
||||||
|
|
||||||
with subtest("Manage script works"):
|
with subtest("Manage script works"):
|
||||||
# Should fail if not called by healthchecks user
|
|
||||||
machine.fail("echo 'print(\"foo\")' | healthchecks-manage help")
|
|
||||||
|
|
||||||
# "shell" sucommand should succeed, needs python in PATH.
|
# "shell" sucommand should succeed, needs python in PATH.
|
||||||
assert "foo\n" == machine.succeed("echo 'print(\"foo\")' | sudo -u healthchecks healthchecks-manage shell")
|
assert "foo\n" == machine.succeed("echo 'print(\"foo\")' | sudo -u healthchecks healthchecks-manage shell")
|
||||||
|
|
||||||
|
# Shouldn't fail if not called by healthchecks user
|
||||||
|
assert "foo\n" == machine.succeed("echo 'print(\"foo\")' | healthchecks-manage shell")
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
|
@ -8,43 +8,32 @@ let
|
||||||
py = python3.override {
|
py = python3.override {
|
||||||
packageOverrides = final: prev: {
|
packageOverrides = final: prev: {
|
||||||
django = prev.django_4;
|
django = prev.django_4;
|
||||||
fido2 = prev.fido2.overridePythonAttrs (old: rec {
|
|
||||||
version = "0.9.3";
|
|
||||||
src = prev.fetchPypi {
|
|
||||||
pname = "fido2";
|
|
||||||
inherit version;
|
|
||||||
sha256 = "sha256-tF6JphCc/Lfxu1E3dqotZAjpXEgi+DolORi5RAg0Zuw=";
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
py.pkgs.buildPythonApplication rec {
|
py.pkgs.buildPythonApplication rec {
|
||||||
pname = "healthchecks";
|
pname = "healthchecks";
|
||||||
version = "2.2.1";
|
version = "2.4.1";
|
||||||
format = "other";
|
format = "other";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "healthchecks";
|
owner = "healthchecks";
|
||||||
repo = pname;
|
repo = pname;
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "sha256-C+NUvs5ijbj/l8G1sjSXvUJDNSOTVFAStfS5KtYFpUs=";
|
sha256 = "sha256-K2zA0ZkAPMgm+IofNiCf+mVTF/RIoorTupWLOowT29g=";
|
||||||
};
|
};
|
||||||
|
|
||||||
propagatedBuildInputs = with py.pkgs; [
|
propagatedBuildInputs = with py.pkgs; [
|
||||||
apprise
|
apprise
|
||||||
cffi
|
|
||||||
cron-descriptor
|
cron-descriptor
|
||||||
cronsim
|
cronsim
|
||||||
cryptography
|
|
||||||
django
|
django
|
||||||
django-compressor
|
django-compressor
|
||||||
fido2
|
fido2
|
||||||
minio
|
minio
|
||||||
psycopg2
|
psycopg2
|
||||||
py
|
pycurl
|
||||||
pyotp
|
pyotp
|
||||||
requests
|
|
||||||
segno
|
segno
|
||||||
statsd
|
statsd
|
||||||
whitenoise
|
whitenoise
|
||||||
|
|
Loading…
Reference in a new issue