https://git.jolheiser.com/mint.git
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
{ pkgs ? import <nixpkgs> { }, }: let name = "mint"; python = pkgs.python3Packages.python.override { packageOverrides = self: super: { django = super.django_5; }; }; bundles = pkgs.buildNpmPackage (_: { pname = "mint-assets"; version = "main"; src = ../assets; npmDepsHash = "sha256-mbwThqt7qpK4sCUjeIMzFAz2Ku/HfUUfPHjWB8kJ2Zc="; installPhase = '' runHook preInstall mkdir -p $out cp -r dist/* $out/ runHook postInstall ''; }); in python.pkgs.buildPythonApplication rec { pname = name; version = "main"; pyproject = true; src = pkgs.nix-gitignore.gitignoreSource [ ] ( builtins.path { inherit name; path = ../.; } ); build-system = [ python.pkgs.pdm-backend ]; nativeBuildInputs = [ pkgs.makeBinaryWrapper ]; dependencies = with python.pkgs; [ gunicorn setuptools environs requests whitenoise django django-debug-toolbar mozilla-django-oidc ]; postPatch = '' cp -r ${bundles} assets/dist ''; postBuild = '' export MINT_OIDC_CONFIG_URL= export MINT_OIDC_CLIENT_ID= export MINT_SECRET_KEY=super-secret-key-do-not-use-me export MINT_OIDC_CLIENT_SECRET= ${python.pythonOnBuildForHost.interpreter} manage.py collectstatic ''; postInstall = '' mkdir -p $out/lib cp -r . $out/lib/mint chmod +x $out/lib/mint/manage.py makeWrapper $out/lib/mint/manage.py $out/bin/mint \ --prefix PYTHONPATH : ${passthru.pythonPath}:$out/${python.sitePackages} ''; passthru = { inherit python; pythonPath = "${python.pkgs.makePythonPath dependencies}"; }; meta = { description = "Budget tracking"; homepage = "https://git.jolheiser.com/mint"; mainProgram = "mint"; }; }