nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 binaryen,
3 fetchFromGitHub,
4 lib,
5 lldap,
6 nixosTests,
7 rustPlatform,
8 rustc,
9 wasm-bindgen-cli_0_2_95,
10 wasm-pack,
11 which,
12}:
13
14let
15
16 commonDerivationAttrs = rec {
17 pname = "lldap";
18 version = "0.6.1";
19
20 src = fetchFromGitHub {
21 owner = "lldap";
22 repo = "lldap";
23 rev = "v${version}";
24 hash = "sha256-iQ+Vv9kx/pWHoa/WZChBK+FD2r1avzWWz57bnnzRjUg=";
25 };
26
27 cargoHash = "sha256-qXYgr9uRswuo9hwVROUX9KUKpkzR0VEcXImbdyOgxsY=";
28
29 };
30
31 frontend = rustPlatform.buildRustPackage (
32 commonDerivationAttrs
33 // {
34 pname = commonDerivationAttrs.pname + "-frontend";
35
36 nativeBuildInputs = [
37 wasm-pack
38 wasm-bindgen-cli_0_2_95
39 binaryen
40 which
41 rustc
42 rustc.llvmPackages.lld
43 ];
44
45 buildPhase = ''
46 HOME=`pwd` ./app/build.sh
47 '';
48
49 installPhase = ''
50 mkdir -p $out
51 cp -R app/{index.html,pkg,static} $out/
52 '';
53
54 doCheck = false;
55 }
56 );
57
58in
59rustPlatform.buildRustPackage (
60 commonDerivationAttrs
61 // {
62 cargoBuildFlags = [
63 "-p"
64 "lldap"
65 "-p"
66 "lldap_migration_tool"
67 "-p"
68 "lldap_set_password"
69 ];
70
71 patches = [
72 ./0001-parameterize-frontend-location.patch
73 ];
74
75 postPatch = ''
76 substituteInPlace server/src/infra/tcp_server.rs --subst-var-by frontend '${frontend}'
77 '';
78
79 passthru = {
80 inherit frontend;
81 tests = {
82 inherit (nixosTests) lldap;
83 };
84 };
85
86 meta = with lib; {
87 description = "Lightweight authentication server that provides an opinionated, simplified LDAP interface for authentication";
88 homepage = "https://github.com/lldap/lldap";
89 changelog = "https://github.com/lldap/lldap/blob/v${lldap.version}/CHANGELOG.md";
90 license = licenses.gpl3Only;
91 platforms = platforms.linux;
92 maintainers = with maintainers; [ bendlas ];
93 mainProgram = "lldap";
94 };
95 }
96)