update to 3.4
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Jeffrey C. Ollie 2024-06-20 09:38:27 -05:00
parent e113833196
commit 794edb3f11
No known key found for this signature in database
GPG key ID: F936E4DCB7E25F15
2 changed files with 40 additions and 84 deletions

View file

@ -2,16 +2,16 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1707347730, "lastModified": 1718717462,
"narHash": "sha256-0etC/exQIaqC9vliKhc3eZE2Mm2wgLa0tj93ZF/egvM=", "narHash": "sha256-qddfQLMaWR2gxfEzUM/zFZVK6H1kTv9WBQSBQxbP3MU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "6832d0d99649db3d65a0e15fa51471537b2c56a6", "rev": "938aa157bbd6e3c6fd7dcb77998b1f92c2ad1631",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
"ref": "nixos-23.11", "ref": "nixos-24.05",
"type": "indirect" "type": "indirect"
} }
}, },

112
flake.nix
View file

@ -3,7 +3,7 @@
inputs = { inputs = {
nixpkgs = { nixpkgs = {
url = "nixpkgs/nixos-23.11"; url = "nixpkgs/nixos-24.05";
# url = "github:natsukium/nixpkgs/pydantic2"; # url = "github:natsukium/nixpkgs/pydantic2";
}; };
}; };
@ -19,21 +19,6 @@
py = pkgs.python3.override { py = pkgs.python3.override {
packageOverrides = final: prev: { packageOverrides = final: prev: {
django = prev.django_4; django = prev.django_4;
# cronsim = let
# version = "2.5";
# pname = "cronsim";
# src = pkgs.fetchPypi {
# inherit pname version;
# hash = "sha256-FTzwIZ3MGgyp5xqDav22B5ZTfYxSHGhsenMTSDdXM78=";
# };
# in
# prev.buildPythonPackage {
# inherit pname version src;
# # nativeCheckInputs = [ prev.pytestCheckHook ];
# pythonImportsCheck = [
# "cronsim"
# ];
# };
}; };
}; };
baseImage = { baseImage = {
@ -60,81 +45,50 @@
}; };
in { in {
packages.${system} = { packages.${system} = {
oncalendar = let
in
py.pkgs.buildPythonApplication {
inherit pname version propagatedBuildInputs;
format = "other";
outputs = ["out" "static" "doc"];
src = pkgs.fetchFromGitHub {
owner = "healthchecks";
repo = pname;
rev = "v${version}";
inherit hash;
};
dontPatch = true;
dontConfigure = true;
dontBuild = true;
doCheck = false;
installPhase = ''
mkdir -p $out/app
cp -r CHANGELOG.md hc manage.py templates $out/app
chmod +x $out/app/manage.py
mkdir -p $doc
cp -r *.md LICENSE $doc
mkdir -p $static
DEBUG=False SECRET_KEY=build-key STATIC_ROOT=$static ${py}/bin/python ./manage.py collectstatic --noinput
DEBUG=False SECRET_KEY=build-key STATIC_ROOT=$static ${py}/bin/python ./manage.py compress
cp -r static-collected/* $static
cp ${localSettings} $out/app/hc/local_settings.py
'';
passthru = {
# PYTHONPATH of all dependencies used by the package
pythonPath = py.pkgs.makePythonPath propagatedBuildInputs;
tests = {
inherit (pkgs.nixosTests) healthchecks;
};
};
meta = with pkgs.lib; {
homepage = "https://github.com/healthchecks/healthchecks";
description = "A cron monitoring tool written in Python & Django ";
license = licenses.bsd3;
};
};
healthchecks = let healthchecks = let
pname = "healthchecks"; pname = "healthchecks";
version = "3.2"; version = "3.4";
hash = "sha256-TAhr1PeoGp/zqsnJz9C/w7auip4RdRIFSxvo6haOG0Q="; secrets = [
"DB_PASSWORD"
"DISCORD_CLIENT_SECRET"
"EMAIL_HOST_PASSWORD"
"LINENOTIFY_CLIENT_SECRET"
"MATRIX_ACCESS_TOKEN"
"PD_APP_ID"
"PUSHBULLET_CLIENT_SECRET"
"PUSHOVER_API_TOKEN"
"S3_SECRET_KEY"
"SECRET_KEY"
"SLACK_CLIENT_SECRET"
"TELEGRAM_TOKEN"
"TRELLO_APP_KEY"
"TWILIO_AUTH"
];
hash = "sha256-hiuw7XfCDy+9fzuQMaeN9+XsENeBI1RNXy8IM1HIFhI=";
localSettings = pkgs.writeText "local_settings.py" '' localSettings = pkgs.writeText "local_settings.py" ''
import os import os
CSRF_TRUSTED_HOSTS = os.getenv("CSRF_TRUSTED_HOSTS", "").split(",") CSRF_TRUSTED_HOSTS = os.getenv("CSRF_TRUSTED_HOSTS", "").split(",")
STATIC_ROOT = os.getenv("STATIC_ROOT") STATIC_ROOT = os.getenv("STATIC_ROOT")
STATICFILES_DIRS = [ ] STATICFILES_DIRS = [ ]
SECRET_KEY_FILE = os.getenv("SECRET_KEY_FILE") ${pkgs.lib.concatLines (map
if SECRET_KEY_FILE: (secret: ''
with open(SECRET_KEY_FILE, "r") as file: ${secret}_FILE = os.getenv("${secret}_FILE")
SECRET_KEY = file.readline() if ${secret}_FILE:
with open(${secret}_FILE, "r") as file:
${secret} = file.readline()
'')
secrets)}
''; '';
propagatedBuildInputs = with py.pkgs; [ propagatedBuildInputs = with py.pkgs; [
aiosmtpd aiosmtpd
apprise apprise
cron-descriptor
cronsim cronsim
django django
django-compressor django-compressor
django-stubs-ext django-stubs-ext
fido2 fido2
minio minio
oncalendar
psycopg2 psycopg2
pycurl pycurl
pydantic pydantic
@ -145,7 +99,7 @@
]; ];
in in
py.pkgs.buildPythonApplication { py.pkgs.buildPythonApplication {
inherit pname version propagatedBuildInputs; inherit pname version;
format = "other"; format = "other";
outputs = ["out" "static" "doc"]; outputs = ["out" "static" "doc"];
@ -153,10 +107,12 @@
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "healthchecks"; owner = "healthchecks";
repo = pname; repo = pname;
rev = "v${version}"; rev = "refs/tags/v${version}";
inherit hash; hash = hash;
}; };
inherit propagatedBuildInputs;
dontPatch = true; dontPatch = true;
dontConfigure = true; dontConfigure = true;
dontBuild = true; dontBuild = true;
@ -304,7 +260,7 @@
pkgs.dockerTools.buildLayeredImage ( pkgs.dockerTools.buildLayeredImage (
pkgs.lib.attrsets.recursiveUpdate baseImage { pkgs.lib.attrsets.recursiveUpdate baseImage {
name = "healthchecks-webserver"; name = "healthchecks-webserver";
fakeRootCommands = '' ; fakeRootCommands = ''
mkdir /tmp mkdir /tmp
chmod 0777 /tmp chmod 0777 /tmp
''; '';