stockholm/krebs/5pkgs/simple/hashPassword/default.nix

16 lines
286 B
Nix
Raw Normal View History

2015-07-24 21:16:48 +00:00
{ lib, pkgs, ... }:
2016-06-13 00:04:22 +00:00
pkgs.writeDashBin "hashPassword" ''
2015-07-24 21:16:48 +00:00
# usage: hashPassword
set -euf
2016-03-03 18:45:46 +00:00
export PATH=${lib.makeBinPath (with pkgs; [
2015-07-24 21:16:48 +00:00
coreutils
mkpasswd
openssl
])}
salt=$(openssl rand -base64 16 | tr -d '+=' | head -c 16)
exec mkpasswd -m sha-512 -S "$salt"
''