stockholm/krebs/5pkgs/hashPassword/default.nix
tv 22a171f3e0 krebs pkgs += charybdis lentil much
While there, put everything into subdirectories.
2015-08-29 00:36:50 +02:00

17 lines
310 B
Nix

{ lib, pkgs, ... }:
pkgs.writeScriptBin "hashPassword" ''
#! /bin/sh
# usage: hashPassword
set -euf
export PATH=${lib.makeSearchPath "bin" (with pkgs; [
coreutils
mkpasswd
openssl
])}
salt=$(openssl rand -base64 16 | tr -d '+=' | head -c 16)
exec mkpasswd -m sha-512 -S "$salt"
''