School/services: add mysql
This commit is contained in:
parent
dbb6887168
commit
0466a64c17
2 changed files with 34 additions and 0 deletions
|
|
@ -2,5 +2,6 @@
|
|||
imports = [
|
||||
./networkmanager.nix
|
||||
./syncthing.nix
|
||||
./mysql.nix
|
||||
];
|
||||
}
|
||||
|
|
|
|||
33
roles/school/services/mysql.nix
Normal file
33
roles/school/services/mysql.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
services.mysql = {
|
||||
enable = true;
|
||||
package = pkgs.mysql84;
|
||||
user = "toast";
|
||||
group = "users";
|
||||
};
|
||||
|
||||
# Don't autostart MySQL
|
||||
systemd.services.mysql.wantedBy = lib.mkForce [];
|
||||
|
||||
security.polkit.extraConfig = ''
|
||||
polkit.addRule(function(action, subject) {
|
||||
if (
|
||||
action.id == "org.freedesktop.systemd1.manage-units" &&
|
||||
action.lookup("unit") == "mysql.service" &&
|
||||
subject.user == "${config.services.mysql.user}"
|
||||
)
|
||||
{
|
||||
return polkit.Result.YES;
|
||||
}
|
||||
})
|
||||
'';
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
mycli
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue