about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--irc.nix21
-rw-r--r--matrix.nix4
2 files changed, 20 insertions, 5 deletions
diff --git a/irc.nix b/irc.nix
index e8bdb09..2d03c5c 100644
--- a/irc.nix
+++ b/irc.nix
@@ -25,9 +25,24 @@ in {
     name = "sojupw";
     text = ''
       #!/bin/sh
-      read password
-      ${pkgs.apacheHttpd}/bin/htpasswd -bnBC 10 "" $password | tr -d ':\n'
-      echo
+      printf 'soju password: '
+      read -rs password
+      printf '\nretype soju password: '
+      read -rs confirmation
+
+      file=$(mktemp)
+      trap 'rm $file' EXIT
+      htpasswd -bBC 10 $file "" $password 2> /dev/null
+      if htpasswd -bv $file "" $confirmation 2> /dev/null
+      then
+        printf '\nbcrypt: '
+        cat $file | tr -d ':\n'
+        echo
+        exit 0
+      else
+        printf '\nsorry, passwords do not match\n'
+        exit 1
+      fi
     '';
     executable = true;
     destination = "/bin/${name}";
diff --git a/matrix.nix b/matrix.nix
index cdd75cc..b42ca07 100644
--- a/matrix.nix
+++ b/matrix.nix
@@ -105,8 +105,8 @@ in {
     postgresql = {
       ensureDatabases = [ "dendrite" ];
       ensureUsers = [ {
-          name = "dendrite";
-          ensurePermissions."DATABASE dendrite" = "ALL PRIVILEGES";
+        name = "dendrite";
+        ensurePermissions."DATABASE dendrite" = "ALL PRIVILEGES";
       } ];
     };
   };