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:
parent
d12bdcc87d
commit
6df56466f9
8 changed files with 191 additions and 118 deletions
50
components/gopkgs.nix
Normal file
50
components/gopkgs.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{ authentik-src
|
||||
, authentik-version
|
||||
, authentikComponents
|
||||
, buildGo121Module
|
||||
, lib
|
||||
, makeWrapper
|
||||
}:
|
||||
|
||||
buildGo121Module {
|
||||
pname = "authentik-gopkgs";
|
||||
version = authentik-version;
|
||||
prePatch = ''
|
||||
sed -i"" -e 's,./web/dist/,${authentikComponents.frontend}/dist/,' web/static.go
|
||||
sed -i"" -e 's,./web/dist/,${authentikComponents.frontend}/dist/,' internal/web/static.go
|
||||
sed -i"" -e 's,./lifecycle/gunicorn.conf.py,${authentikComponents.staticWorkdirDeps}/lifecycle/gunicorn.conf.py,' internal/gounicorn/gounicorn.go
|
||||
'';
|
||||
src = lib.cleanSourceWith {
|
||||
src = authentik-src;
|
||||
filter = (path: _:
|
||||
(builtins.any (x: x) (
|
||||
(map (infix: lib.hasInfix infix path) [
|
||||
"/authentik"
|
||||
"/cmd"
|
||||
"/internal"
|
||||
])
|
||||
++
|
||||
(map (suffix: lib.hasSuffix suffix path) [
|
||||
"/web"
|
||||
"/web/static.go"
|
||||
"/web/robots.txt"
|
||||
"/web/security.txt"
|
||||
"go.mod"
|
||||
"go.sum"
|
||||
])
|
||||
))
|
||||
);
|
||||
};
|
||||
subPackages = [
|
||||
"cmd/ldap"
|
||||
"cmd/server"
|
||||
"cmd/proxy"
|
||||
"cmd/radius"
|
||||
];
|
||||
vendorHash = "sha256-8F9emmQmbe7R+xtGrjV5ht0adGasU6WAvLa8Wxr+j8M=";
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
postInstall = ''
|
||||
wrapProgram $out/bin/server --prefix PATH : ${authentikComponents.pythonEnv}/bin
|
||||
wrapProgram $out/bin/server --prefix PYTHONPATH : ${authentikComponents.staticWorkdirDeps}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue