2024-03-27 16:42:29 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
nodejs,
|
|
|
|
pnpm,
|
|
|
|
fetchFromGitHub,
|
|
|
|
buildGoModule,
|
|
|
|
installShellFiles,
|
|
|
|
callPackage,
|
|
|
|
nixosTests,
|
|
|
|
}:
|
2022-12-09 10:03:14 +00:00
|
|
|
|
2023-03-24 11:44:27 +00:00
|
|
|
let
|
|
|
|
inherit (import ./sources.nix { inherit fetchFromGitHub; })
|
|
|
|
pname
|
|
|
|
version
|
|
|
|
src
|
|
|
|
vendorHash
|
|
|
|
;
|
2024-03-27 16:42:29 +00:00
|
|
|
web = callPackage ./web.nix { inherit nodejs pnpm fetchFromGitHub; };
|
2023-03-24 11:44:27 +00:00
|
|
|
in
|
2022-12-09 10:03:14 +00:00
|
|
|
buildGoModule rec {
|
2023-03-24 11:44:27 +00:00
|
|
|
inherit
|
|
|
|
pname
|
|
|
|
version
|
|
|
|
src
|
|
|
|
vendorHash
|
|
|
|
;
|
2022-12-09 10:03:14 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2023-05-22 06:35:10 +00:00
|
|
|
## FIXME: add swagger-ui https://github.com/authelia/authelia/blob/master/cmd/authelia-scripts/cmd/build.go#L148
|
2022-12-09 10:03:14 +00:00
|
|
|
postPatch = ''
|
2023-05-22 06:35:10 +00:00
|
|
|
cp -r api internal/server/public_html
|
2022-12-09 10:03:14 +00:00
|
|
|
cp -r ${web}/share/authelia-web/* internal/server/public_html
|
|
|
|
'';
|
|
|
|
|
|
|
|
subPackages = [ "cmd/authelia" ];
|
|
|
|
|
|
|
|
ldflags =
|
|
|
|
let
|
|
|
|
p = "github.com/authelia/authelia/v${lib.versions.major version}/internal/utils";
|
|
|
|
in
|
|
|
|
[
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X ${p}.BuildTag=v${version}"
|
|
|
|
"-X '${p}.BuildState=tagged clean'"
|
|
|
|
"-X ${p}.BuildBranch=v${version}"
|
|
|
|
"-X ${p}.BuildExtra=nixpkgs"
|
|
|
|
];
|
|
|
|
|
|
|
|
# several tests with networking and several that want chromium
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/etc/authelia
|
|
|
|
cp config.template.yml $out/etc/authelia
|
|
|
|
|
|
|
|
installShellCompletion --cmd authelia \
|
|
|
|
--bash <($out/bin/authelia completion bash) \
|
|
|
|
--fish <($out/bin/authelia completion fish) \
|
|
|
|
--zsh <($out/bin/authelia completion zsh)
|
|
|
|
'';
|
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
|
|
|
|
$out/bin/authelia --help
|
|
|
|
$out/bin/authelia --version | grep "v${version}"
|
|
|
|
$out/bin/authelia build-info | grep 'v${version}\|nixpkgs'
|
|
|
|
|
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
# if overriding replace the postPatch to put your web UI output in internal/server/public_html
|
|
|
|
inherit web;
|
|
|
|
updateScript = ./update.sh;
|
2023-03-27 11:00:07 +00:00
|
|
|
tests = { inherit (nixosTests) authelia; };
|
2022-12-09 10:03:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://www.authelia.com/";
|
|
|
|
changelog = "https://github.com/authelia/authelia/releases/tag/v${version}";
|
|
|
|
description = "Single Sign-On Multi-Factor portal for web apps";
|
|
|
|
longDescription = ''
|
|
|
|
Authelia is an open-source authentication and authorization server
|
|
|
|
providing two-factor authentication and single sign-on (SSO) for your
|
|
|
|
applications via a web portal. It acts as a companion for reverse proxies
|
|
|
|
like nginx, Traefik, caddy or HAProxy to let them know whether requests
|
|
|
|
should either be allowed or redirected to Authelia's portal for
|
|
|
|
authentication.
|
|
|
|
'';
|
|
|
|
license = licenses.asl20;
|
2024-04-15 16:16:51 +00:00
|
|
|
maintainers = with maintainers; [
|
|
|
|
jk
|
|
|
|
dit7ya
|
|
|
|
nicomem
|
|
|
|
];
|
2023-11-23 21:09:35 +00:00
|
|
|
mainProgram = "authelia";
|
2022-12-09 10:03:14 +00:00
|
|
|
};
|
|
|
|
}
|