nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 124 lines 3.2 kB view raw
1{ 2 lib, 3 stdenv, 4 nodejs, 5 fetchPnpmDeps, 6 pnpmConfigHook, 7 pnpm, 8 fetchFromGitHub, 9 buildGo124Module, 10 installShellFiles, 11 callPackage, 12 nixosTests, 13 authelia-web ? callPackage ./web.nix { 14 inherit 15 nodejs 16 fetchPnpmDeps 17 pnpmConfigHook 18 pnpm 19 fetchFromGitHub 20 ; 21 }, 22}: 23 24let 25 buildGoModule = buildGo124Module; 26 27 inherit (import ./sources.nix { inherit fetchFromGitHub; }) 28 pname 29 version 30 src 31 vendorHash 32 ; 33 34 web = authelia-web; 35in 36buildGoModule rec { 37 inherit 38 pname 39 version 40 src 41 vendorHash 42 ; 43 44 nativeBuildInputs = [ installShellFiles ]; 45 46 ## FIXME: add swagger-ui https://github.com/authelia/authelia/blob/master/cmd/authelia-scripts/cmd/build.go#L148 47 postPatch = '' 48 cp -r api internal/server/public_html 49 cp -r ${web}/share/authelia-web/* internal/server/public_html 50 ''; 51 52 subPackages = [ "cmd/authelia" ]; 53 54 ldflags = 55 let 56 p = "github.com/authelia/authelia/v${lib.versions.major version}/internal/utils"; 57 in 58 [ 59 "-s" 60 "-w" 61 "-X ${p}.BuildTag=v${version}" 62 "-X '${p}.BuildState=tagged clean'" 63 "-X ${p}.BuildBranch=v${version}" 64 "-X ${p}.BuildExtra=nixpkgs" 65 ]; 66 67 # It is required to set this to avoid a change in the 68 # handling of sync map in go 1.24+ 69 # Upstream issue: https://github.com/authelia/authelia/issues/8980 70 env.GOEXPERIMENT = "nosynchashtriemap"; 71 72 # several tests with networking and several that want chromium 73 doCheck = false; 74 75 postInstall = '' 76 mkdir -p $out/etc/authelia 77 cp config.template.yml $out/etc/authelia 78 '' 79 + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' 80 installShellCompletion --cmd authelia \ 81 --bash <($out/bin/authelia completion bash) \ 82 --fish <($out/bin/authelia completion fish) \ 83 --zsh <($out/bin/authelia completion zsh) 84 ''; 85 86 doInstallCheck = true; 87 installCheckPhase = '' 88 runHook preInstallCheck 89 90 $out/bin/authelia --help 91 $out/bin/authelia --version | grep "v${version}" 92 $out/bin/authelia build-info | grep 'v${version}\|nixpkgs' 93 94 runHook postInstallCheck 95 ''; 96 97 passthru = { 98 # if overriding replace the postPatch to put your web UI output in internal/server/public_html 99 inherit web; 100 updateScript = ./update.sh; 101 tests = { inherit (nixosTests) authelia; }; 102 }; 103 104 meta = { 105 homepage = "https://www.authelia.com/"; 106 changelog = "https://github.com/authelia/authelia/releases/tag/v${version}"; 107 description = "Single Sign-On Multi-Factor portal for web apps"; 108 longDescription = '' 109 Authelia is an open-source authentication and authorization server 110 providing two-factor authentication and single sign-on (SSO) for your 111 applications via a web portal. It acts as a companion for reverse proxies 112 like nginx, Traefik, caddy or HAProxy to let them know whether requests 113 should either be allowed or redirected to Authelia's portal for 114 authentication. 115 ''; 116 license = lib.licenses.asl20; 117 maintainers = with lib.maintainers; [ 118 jk 119 dit7ya 120 nicomem 121 ]; 122 mainProgram = "authelia"; 123 }; 124}