Skip to content

Commit

Permalink
add Nix files
Browse files Browse the repository at this point in the history
  • Loading branch information
minijackson committed Feb 8, 2020
1 parent 24bd299 commit 2ae4e8e
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/result

/src/*.erl

tags
Expand Down
8 changes: 8 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ nixpkgs ? import <nixpkgs> }:

let pkgs = nixpkgs {
overlays = [ (self: super: {
paddle = self.callPackage ./derivation.nix {};
}) ];
};
in pkgs.paddle
39 changes: 39 additions & 0 deletions derivation.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{ stdenv, beamPackages, openldap }:

beamPackages.buildMix {
name = "paddle";
version = "0.1.5";

src = ./.;

checkInputs = [ openldap ];

patchPhase = ''
substituteInPlace .travis/ldap/slapd.conf \
--replace /etc/ldap ${openldap}/etc \
--replace /usr/lib/openldap ${openldap}/lib
cp config/dev.exs config/prod.exs
substituteInPlace config/test.exs \
--replace /etc/ldap ${openldap}/etc
'';

checkPhase = ''
mkdir /tmp/slapd
${openldap}/libexec/slapd -d2 -f .travis/ldap/slapd.conf -h ldap://localhost:3389 &
sleep 3
ldapadd -h localhost:3389 -D cn=admin,dc=test,dc=com -w test -f $src/.travis/ldap/base.ldif
ldapadd -h localhost:3389 -D cn=admin,dc=test,dc=com -w test -f $src/.travis/ldap/test_data.ldif
MIX_ENV=test mix test
'';

doCheck = true;

meta = with stdenv.lib; {
description = "A library simplifying LDAP usage in Elixir projects";
homepage = "https://github.com/minijackson/paddle";
license = licenses.mit;
};
}

0 comments on commit 2ae4e8e

Please sign in to comment.