This commit is contained in:
parent
e113833196
commit
794edb3f11
2 changed files with 40 additions and 84 deletions
|
@ -2,16 +2,16 @@
|
|||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1707347730,
|
||||
"narHash": "sha256-0etC/exQIaqC9vliKhc3eZE2Mm2wgLa0tj93ZF/egvM=",
|
||||
"lastModified": 1718717462,
|
||||
"narHash": "sha256-qddfQLMaWR2gxfEzUM/zFZVK6H1kTv9WBQSBQxbP3MU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "6832d0d99649db3d65a0e15fa51471537b2c56a6",
|
||||
"rev": "938aa157bbd6e3c6fd7dcb77998b1f92c2ad1631",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-23.11",
|
||||
"ref": "nixos-24.05",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
|
|
112
flake.nix
112
flake.nix
|
@ -3,7 +3,7 @@
|
|||
|
||||
inputs = {
|
||||
nixpkgs = {
|
||||
url = "nixpkgs/nixos-23.11";
|
||||
url = "nixpkgs/nixos-24.05";
|
||||
# url = "github:natsukium/nixpkgs/pydantic2";
|
||||
};
|
||||
};
|
||||
|
@ -19,21 +19,6 @@
|
|||
py = pkgs.python3.override {
|
||||
packageOverrides = final: prev: {
|
||||
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 = {
|
||||
|
@ -60,81 +45,50 @@
|
|||
};
|
||||
in {
|
||||
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
|
||||
pname = "healthchecks";
|
||||
version = "3.2";
|
||||
hash = "sha256-TAhr1PeoGp/zqsnJz9C/w7auip4RdRIFSxvo6haOG0Q=";
|
||||
version = "3.4";
|
||||
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" ''
|
||||
import os
|
||||
CSRF_TRUSTED_HOSTS = os.getenv("CSRF_TRUSTED_HOSTS", "").split(",")
|
||||
STATIC_ROOT = os.getenv("STATIC_ROOT")
|
||||
STATICFILES_DIRS = [ ]
|
||||
SECRET_KEY_FILE = os.getenv("SECRET_KEY_FILE")
|
||||
if SECRET_KEY_FILE:
|
||||
with open(SECRET_KEY_FILE, "r") as file:
|
||||
SECRET_KEY = file.readline()
|
||||
${pkgs.lib.concatLines (map
|
||||
(secret: ''
|
||||
${secret}_FILE = os.getenv("${secret}_FILE")
|
||||
if ${secret}_FILE:
|
||||
with open(${secret}_FILE, "r") as file:
|
||||
${secret} = file.readline()
|
||||
'')
|
||||
secrets)}
|
||||
'';
|
||||
propagatedBuildInputs = with py.pkgs; [
|
||||
aiosmtpd
|
||||
apprise
|
||||
cron-descriptor
|
||||
cronsim
|
||||
django
|
||||
django-compressor
|
||||
django-stubs-ext
|
||||
fido2
|
||||
minio
|
||||
oncalendar
|
||||
psycopg2
|
||||
pycurl
|
||||
pydantic
|
||||
|
@ -145,7 +99,7 @@
|
|||
];
|
||||
in
|
||||
py.pkgs.buildPythonApplication {
|
||||
inherit pname version propagatedBuildInputs;
|
||||
inherit pname version;
|
||||
format = "other";
|
||||
|
||||
outputs = ["out" "static" "doc"];
|
||||
|
@ -153,10 +107,12 @@
|
|||
src = pkgs.fetchFromGitHub {
|
||||
owner = "healthchecks";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
inherit hash;
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = hash;
|
||||
};
|
||||
|
||||
inherit propagatedBuildInputs;
|
||||
|
||||
dontPatch = true;
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
|
@ -304,7 +260,7 @@
|
|||
pkgs.dockerTools.buildLayeredImage (
|
||||
pkgs.lib.attrsets.recursiveUpdate baseImage {
|
||||
name = "healthchecks-webserver";
|
||||
fakeRootCommands = '' ;
|
||||
fakeRootCommands = ''
|
||||
mkdir /tmp
|
||||
chmod 0777 /tmp
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue