From bb1c3ca919c58ed47a09813831c7ffc790a5f0d3 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Tue, 21 Feb 2023 22:56:05 +0900 Subject: Substitute dependency in script --- irc.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/irc.nix b/irc.nix index 2d03c5c..671b872 100644 --- a/irc.nix +++ b/irc.nix @@ -23,8 +23,10 @@ let in { environment.systemPackages = [ (pkgs.writeTextFile rec { name = "sojupw"; - text = '' + text = let htpasswd = "${pkgs.apacheHttpd}/bin/htpasswd"; + in '' #!/bin/sh + set -e printf 'soju password: ' read -rs password printf '\nretype soju password: ' @@ -32,8 +34,8 @@ in { file=$(mktemp) trap 'rm $file' EXIT - htpasswd -bBC 10 $file "" $password 2> /dev/null - if htpasswd -bv $file "" $confirmation 2> /dev/null + ${htpasswd} -bBC 10 $file "" $password 2> /dev/null + if ${htpasswd} -bv $file "" $confirmation 2> /dev/null then printf '\nbcrypt: ' cat $file | tr -d ':\n' -- cgit 1.4.1