| 17 Mar 2024 |
tgerbet | Yep | 12:51:40 |
hexa | what surprises me is that the derivation and module both construct their own php instance | 12:51:46 |
@patka_123:matrix.org | That was my initial thought seeing it for the first time. But also can get behind the override reason from the docs @tgerbet shared earlier
| 12:52:12 |
hexa | diff --git a/nixos/modules/services/web-apps/engelsystem.nix b/nixos/modules/services/web-apps/engelsystem.nix
index 669620debce5..343f2e1b7dc1 100644
--- a/nixos/modules/services/web-apps/engelsystem.nix
+++ b/nixos/modules/services/web-apps/engelsystem.nix
@@ -99,7 +99,11 @@ in {
'';
services.phpfpm.pools.engelsystem = {
- phpPackage = pkgs.php81;
+ phpPackage = pkgs.php82.buildEnv {
+ extraConfig = ''
+ session.gc_maxlifetime = 604800
+ '';
+ };
user = "engelsystem";
settings = {
"listen.owner" = config.services.nginx.user;
diff --git a/pkgs/servers/web-apps/engelsystem/default.nix b/pkgs/servers/web-apps/engelsystem/default.nix
index 53a33195f610..762b42391dd5 100644
--- a/pkgs/servers/web-apps/engelsystem/default.nix
+++ b/pkgs/servers/web-apps/engelsystem/default.nix
@@ -1,9 +1,10 @@
-{ lib, stdenv, fetchzip, php, writeText, nixosTests }:
+{ lib
+, stdenv
+, fetchzip
+, php82
+, nixosTests
+}:
-let
- phpExt = php.withExtensions
- ({ enabled, all }: with all; [ filter mysqlnd mysqli pdo pdo_mysql ]);
-in
stdenv.mkDerivation rec {
pname = "engelsystem";
version = "3.5.0";
@@ -13,7 +14,7 @@ stdenv.mkDerivation rec {
hash = "sha256-RbzAHBZN02u14WaLtq5EOh4XwIdHKvzX7NhDBhn/CaU=";
};
- buildInputs = [ phpExt ];
+ buildInputs = [ php82 ];
installPhase = ''
runHook preInstall
@@ -30,7 +31,7 @@ stdenv.mkDerivation rec {
echo $(command -v php)
# The patchShebangAuto function always used the php without extensions, so path the shebang manually
- sed -i -e "1 s|.*|#\!${phpExt}/bin/php|" "$out/share/engelsystem/bin/migrate"
+ sed -i -e "1 s|.*|#\!${lib.getExe php82}|" "$out/share/engelsystem/bin/migrate"
ln -s "$out/share/engelsystem/bin/migrate" "$out/bin/migrate"
runHook postInstall
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 3a906641326c..b7e8a9d81ca9 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -25999,7 +25999,7 @@ with pkgs;
dspam = callPackage ../servers/mail/dspam { };
- engelsystem = callPackage ../servers/web-apps/engelsystem { php = php81; };
+ engelsystem = callPackage ../servers/web-apps/engelsystem { };
envoy = callPackage ../servers/http/envoy {
go = go_1_20;
| 12:52:19 |
hexa | this was that I tried myself | 12:52:24 |
hexa | kinda because php82 is
let
base = callPackage ./generic.nix (_args // {
version = "8.2.17";
hash = "sha256-GRMWwgMmfZYWC0fSL5VdTcEXk96KXzJ+DCp2J1polOo=";
});
in
base.withExtensions ({ all, ... }: with all; ([
| 12:53:01 |
hexa | so it does include all extensions already? | 12:53:12 |
hexa | * so it does include alot extensions already? | 12:53:21 |
hexa | * so it does include alot of extensions already? | 12:53:25 |
hexa | trimming it down was an afterthought really | 12:53:38 |
hexa | did I understand that wrong? | 12:54:01 |
hexa | ok, I am stupid … my local staged changes do actually work. | 12:55:09 |
tgerbet | They are not all enabled but yes | 12:55:25 |
tgerbet | Hum in this case it should work out of box | 12:56:10 |
hexa | and instead of constructing it twice, wouldn't it be better to expose and reuse it as engelsystem.php | 12:56:22 |
@patka_123:matrix.org | In reply to @hexa:lossy.network ok, I am stupid … my local staged changes do actually work. No, not stupid, smart. Because now I had the opportunity to learn a few things I hadn't seen before ^^
It was for the greater good
| 12:56:41 |
hexa | you're welcome | 12:56:59 |
@patka_123:matrix.org | (Feel free to change my PR or comment on it, I don't mind. But I will get to it tomorrow because I'm not close to a pc) | 12:57:42 |
tgerbet | Yes we probably should expose something like this for things that are built with buildComposerProject Looking the phpfpm services declared in nixos/ they would all benefit from it | 12:58:37 |
hexa | I think making it work and making it pretty can be a two step process | 12:58:43 |
hexa | yeah, it is the wild, wild west | 12:59:15 |
hexa | also, I used to set session.gc_maxlifetime to a week or so for engelsystem | 13:03:29 |
hexa | the default seems to be 24 minutes (1440s) | 13:03:37 |
hexa | what is up with that? | 13:03:39 |
hexa | the effect was that people needed to login again on nearly every visit to the engelsystem | 13:04:16 |
hexa | they got so annoyed that they complained about it 🙂 | 13:04:23 |
hexa | (I'm fairly certain I could also be holding it wrong) | 13:05:25 |
tgerbet | It's the PHP default value https://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime
It can be annoying if the app maintains authentication via the PHP session mechanism (also session.cookie_lifetime)
| 13:26:04 |
hexa | so I'd better go with shorter sessions, but longer cookies? | 13:38:40 |
@patka_123:matrix.org | Yes | 13:51:43 |