about summary refs log tree commit diff
path: root/irc.nix
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2023-02-21 22:56:05 +0900
committerNguyễn Gia Phong <mcsinyx@disroot.org>2023-02-21 22:56:05 +0900
commitbb1c3ca919c58ed47a09813831c7ffc790a5f0d3 (patch)
tree43f302c7a186f705f8d236e450d04249b7e40e06 /irc.nix
parentee31e594c9810e914d048e68143babf0750580cd (diff)
downloadnixos-conf-bb1c3ca919c58ed47a09813831c7ffc790a5f0d3.tar.gz
Substitute dependency in script
Diffstat (limited to 'irc.nix')
-rw-r--r--irc.nix8
1 files 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'