factor out components with callPackage to allow for easier overrides

Before this change it was very inconvenient to override specific
dependencies, e.g. patching something in pythonEnv and having its
dependents use that patched version.
This is just a step towards better overridability for the individual
authentik components, because patched versions of components still need
to be manually passed to their dependents. An overlay-like approach
would be even better.
This commit is contained in:
WilliButz 2023-12-09 16:01:26 +01:00
parent d12bdcc87d
commit 6df56466f9
No known key found for this signature in database
GPG key ID: FB0513677AB15BEA
8 changed files with 191 additions and 118 deletions

24
components/frontend.nix Normal file
View file

@ -0,0 +1,24 @@
{ authentik-src
, authentik-version
, authentikComponents
, buildNapalmPackage
, nodejs_21
}:
buildNapalmPackage "${authentik-src}/web" rec {
version = authentik-version; # 0.0.0 specified upstream in package.json
NODE_ENV = "production";
nodejs = nodejs_21;
preBuild = ''
ln -sv ${authentikComponents.docs} ../website
'';
npmCommands = [
"npm install --include=dev --nodedir=${nodejs}/include/node --loglevel verbose --ignore-scripts"
"npm run build"
];
installPhase = ''
mkdir $out
mv dist $out/dist
cp -r authentik icons $out
'';
}