blob: 8d3ba25253a61458556565e1a72f7bff157d3387 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
{ lib, pkgs, ... }:
pkgs.writers.writeDashBin "hashPassword" ''
# usage: hashPassword [...]
set -euf
export PATH=${lib.makeBinPath (with pkgs; [
coreutils
mkpasswd
openssl
])}
salt=$(openssl rand -base64 16 | tr -d '+=' | head -c 16)
exec mkpasswd -m sha-512 -S "$salt" "$@"
''
|