From 1422ed88014e9a43d262fa5c3ff5a925d135c030 Mon Sep 17 00:00:00 2001 From: Ratchanan Srirattanamet Date: Mon, 15 Sep 2025 02:24:35 +0700 Subject: [PATCH] kimai: fix bundled assets missing We were relying on `composerNoScripts = false` to make sure post-install command `assets:install` is run. `assets:install` copies assets from `vendor/` directory into `public/` directory, placing it in appropriate places. However, with commit 80bb9aec24 ("kimai: switch to buildComposerProject2 and tag"), we switched to `buildComposerProject2` which has moved `composer install` step to `composerVendor` derivation. By design, `composerVendor` ignores anything that happens outside `vendor/`, so the assets was not copied into final derivation. So stop relying on `composerNoScripts = false` and run `assets:install` ourselves in `postInstall` step. A side effect of this is that there is another post-install step being skipped (`cache:clear`). However we simply handle caches outside of the derivation (it's handled in the module), so that's not a problem. Fixes: https://github.com/NixOS/nixpkgs/issues/442208 --- nixos/tests/kimai.nix | 3 +++ pkgs/by-name/ki/kimai/package.nix | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nixos/tests/kimai.nix b/nixos/tests/kimai.nix index 967d531f3c54..526aa7faeeb6 100644 --- a/nixos/tests/kimai.nix +++ b/nixos/tests/kimai.nix @@ -17,5 +17,8 @@ machine.wait_for_unit("nginx.service") machine.wait_for_open_port(80) machine.succeed("curl -v --location --fail http://localhost/") + # Make sure bundled assets are served. + # https://github.com/NixOS/nixpkgs/issues/442208 + machine.succeed("curl -v --location --fail http://localhost/bundles/tabler/tabler.css") ''; } diff --git a/pkgs/by-name/ki/kimai/package.nix b/pkgs/by-name/ki/kimai/package.nix index 8ac6d55981a9..1137d8419b74 100644 --- a/pkgs/by-name/ki/kimai/package.nix +++ b/pkgs/by-name/ki/kimai/package.nix @@ -41,13 +41,16 @@ php.buildComposerProject2 (finalAttrs: { vendorHash = "sha256-I4v4WkPGLc8vBPjCiYzPxcLn4rH3HWtQXSqwGVKXeGg="; composerNoPlugins = false; - composerNoScripts = false; postInstall = '' # Make available the console utility, as Kimai doesn't list this in # composer.json. mkdir -p "$out"/share/php/kimai "$out"/bin ln -s "$out"/share/php/kimai/bin/console "$out"/bin/console + + # Install bundled assets. This is normally done in the `composer install` + # post-install script, but it's being skipped. + (cd "$out"/share/php/kimai && php ./bin/console assets:install) ''; passthru.tests = {