tvl-depot/tools/hash-password.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
477 B
Nix
Raw Normal View History

# 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
'';
})