about summary refs log blame commit diff
path: root/tools/hash-password.nix
blob: 6192436c17b97ad9cf173edce78b88b8b9ff4547 (plain) (tree)
1
2
3
4

                                                              
              
 










                                                                               
# Utility for invoking slappasswd with the correct options for
# creating an ARGON2 password hash.
{ pkgs, ... }:

let
  script = pkgs.writeShellScriptBin "hash-password" ''
    ${pkgs.openldap}/bin/slappasswd -o module-load=argon2 -h '{ARGON2}' "$@"
  '';
in
script.overrideAttrs (old: {
  doCheck = true;
  checkPhase = ''
    ${pkgs.stdenv.shell} $out/bin/hash-password -s example-password > /dev/null
  '';
})