Files
nixpkgs/pkgs/by-name/ll/lldap/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

134 lines
2.9 KiB
Nix

{
binaryen,
fetchFromGitHub,
lib,
lldap,
makeWrapper,
nixosTests,
rustPlatform,
rustc,
wasm-bindgen-cli_0_2_100,
wasm-pack,
which,
runCommand,
cacert,
curl,
staticAssetsHash ? "sha256-xVbHD9s3ofbtHCDvjYwmsWXDEJ9z9vRxQDRR6pW6rt8=",
}:
let
version = "0.6.2";
commonDerivationAttrs = {
pname = "lldap";
inherit version;
src = fetchFromGitHub {
owner = "lldap";
repo = "lldap";
rev = "v${version}";
hash = "sha256-UBQWOrHika8X24tYdFfY8ETPh9zvI7/HV5j4aK8Uq+Y=";
};
cargoHash = "sha256-SO7+HiiXNB/KF3fjzSMeiTPjRQq/unEfsnplx4kZv9c=";
};
staticAssets =
src:
runCommand "${commonDerivationAttrs.pname}-static-assets"
{
outputHash = staticAssetsHash;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
inherit src;
nativeBuildInputs = [
curl
];
env.SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
}
''
mkdir $out
mkdir $out/fonts
for file in $(cat ${src}/app/static/libraries.txt); do
curl $file --location --remote-name --output-dir $out
done
for file in $(cat ${src}/app/static/fonts/fonts.txt); do
curl $file --location --remote-name --output-dir $out/fonts
done
'';
frontend = rustPlatform.buildRustPackage (
finalAttrs:
commonDerivationAttrs
// {
pname = commonDerivationAttrs.pname + "-frontend";
nativeBuildInputs = [
wasm-pack
wasm-bindgen-cli_0_2_100
binaryen
which
rustc
rustc.llvmPackages.lld
];
buildPhase = ''
HOME=`pwd` ./app/build.sh
'';
installPhase = ''
mkdir -p $out
cp -R app/{pkg,static} $out/
cp app/index_local.html $out/index.html
cp -R ${staticAssets finalAttrs.src}/* $out/static
rm $out/static/libraries.txt $out/static/fonts/fonts.txt
'';
doCheck = false;
}
);
in
rustPlatform.buildRustPackage (
commonDerivationAttrs
// {
cargoBuildFlags = [
"-p"
"lldap"
"-p"
"lldap_migration_tool"
"-p"
"lldap_set_password"
];
nativeBuildInputs = [ makeWrapper ];
postInstall = ''
wrapProgram $out/bin/lldap \
--set LLDAP_ASSETS_PATH ${frontend}
'';
passthru = {
inherit frontend;
tests = {
inherit (nixosTests) lldap;
};
};
meta = with lib; {
description = "Lightweight authentication server that provides an opinionated, simplified LDAP interface for authentication";
homepage = "https://github.com/lldap/lldap";
changelog = "https://github.com/lldap/lldap/blob/v${lldap.version}/CHANGELOG.md";
license = licenses.gpl3Only;
platforms = platforms.linux;
maintainers = with maintainers; [
bendlas
ibizaman
];
mainProgram = "lldap";
};
}
)