2023-05-24 13:37:59 +00:00
|
|
|
{ binaryen
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, fetchzip
|
|
|
|
, lib
|
|
|
|
, lldap
|
|
|
|
, nixosTests
|
|
|
|
, rustPlatform
|
|
|
|
, rustc
|
2023-10-09 19:29:22 +00:00
|
|
|
, rustc-wasm32
|
2023-05-24 13:37:59 +00:00
|
|
|
, stdenv
|
|
|
|
, wasm-bindgen-cli
|
|
|
|
, wasm-pack
|
|
|
|
, which
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
wasm-bindgen-84 = wasm-bindgen-cli.override {
|
|
|
|
version = "0.2.84";
|
|
|
|
hash = "sha256-0rK+Yx4/Jy44Fw5VwJ3tG243ZsyOIBBehYU54XP/JGk=";
|
|
|
|
cargoHash = "sha256-vcpxcRlW1OKoD64owFF6mkxSqmNrvY+y3Ckn5UwEQ50=";
|
|
|
|
};
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
commonDerivationAttrs = rec {
|
|
|
|
pname = "lldap";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "0.5.0";
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lldap";
|
|
|
|
repo = "lldap";
|
|
|
|
rev = "v${version}";
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-2MEfwppkS9l3iHPNlkJB4tJnma0xMi0AckLv6wpzy1Y=";
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# `Cargo.lock` has git dependencies, meaning can't use `cargoHash`
|
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
|
|
|
"lber-0.4.1" = "sha256-2rGTpg8puIAXggX9rEbXPdirfetNOHWfFc80xqzPMT4=";
|
|
|
|
"opaque-ke-0.6.1" = "sha256-99gaDv7eIcYChmvOKQ4yXuaGVzo2Q6BcgSQOzsLF+fM=";
|
|
|
|
"yew_form-0.1.8" = "sha256-1n9C7NiFfTjbmc9B5bDEnz7ZpYJo9ZT8/dioRXJ65hc=";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
frontend = rustPlatform.buildRustPackage (commonDerivationAttrs // {
|
|
|
|
pname = commonDerivationAttrs.pname + "-frontend";
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2023-10-09 19:29:22 +00:00
|
|
|
wasm-pack wasm-bindgen-84 binaryen which rustc-wasm32 rustc-wasm32.llvmPackages.lld
|
2023-05-24 13:37:59 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
HOME=`pwd` RUSTFLAGS="-C linker=lld" ./app/build.sh
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -R app/{index.html,pkg,static} $out/
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
in rustPlatform.buildRustPackage (commonDerivationAttrs // {
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
cargoBuildFlags = [ "-p" "lldap" "-p" "lldap_migration_tool" "-p" "lldap_set_password" ];
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
patches = [
|
|
|
|
./static-frontend-path.patch
|
|
|
|
];
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
postPatch = ''
|
2023-05-24 13:37:59 +00:00
|
|
|
substituteInPlace server/src/infra/tcp_server.rs --subst-var-by frontend '${frontend}'
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
inherit frontend;
|
|
|
|
tests = {
|
|
|
|
inherit (nixosTests) lldap;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A 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; [ emilylange bendlas ];
|
2023-08-04 22:07:22 +00:00
|
|
|
mainProgram = "lldap";
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
|
|
|
})
|