about summary refs log tree commit diff
path: root/tools/hash-password.nix
blob: 583f1210bd895a6c52ce437e0f8e1c64d610d47e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Utility for invoking slappasswd with the correct options for
# creating an ARGON2 password hash.
#
# Users should generally use https://signup.tvl.fyi instead.
{ 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
  '';
})