How to install mysql/mariadb on NIXOS?
Check the .err log file which will often be in your datadir which in your case appears to be /var/lib/mysql/, although sometimes the error log is under /var/log/. The error log file should hopefully have some good clues as to why the MariaDB server won't start up.

You can also have a look in your MariaDB config file which appears to be /etc/my.cnf and see if there's a log_error entry that defines a different location for the file.

See also the MariaDB documentation for the Error Log.

Your installation procedure may or may not have created a password for the root account. With most Linux distros I've encountered it doesn't create one. A password will in any case only be used when connecting over TCP. If you're logged in on the actual server, you can instead connect over the Unix socket with the Linux root user without a password. You can specify the socket file if you you know where it is and you want to be sure it's using the correct one, e.g. mysql -S /tmp/mysql.sock. Obviously, this won't work until you have successfully started the MariaDB server. 

See also the MariaDB documentation on the Authentication Plugin - Unix Socket.