School: add mongodb and mongosh
This commit is contained in:
parent
dddd601fd2
commit
7c7f1ca339
2 changed files with 32 additions and 0 deletions
|
|
@ -5,5 +5,6 @@
|
|||
./syncthing.nix
|
||||
./mysql.nix
|
||||
./xampp.nix
|
||||
./mongodb.nix
|
||||
];
|
||||
}
|
||||
|
|
|
|||
31
roles/school/services/mongodb.nix
Normal file
31
roles/school/services/mongodb.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
services.mongodb = {
|
||||
enable = true;
|
||||
package = pkgs.mongodb-4_4;
|
||||
user = "toast";
|
||||
};
|
||||
|
||||
# Don't autostart MySQL
|
||||
systemd.services.mongodb.wantedBy = lib.mkForce [];
|
||||
|
||||
# Allow regular users to start/stop mongodb
|
||||
# https://stackoverflow.com/questions/61480914/using-policykit-to-allow-non-root-users-to-start-and-stop-a-service
|
||||
security.polkit.extraConfig = ''
|
||||
polkit.addRule(function(action, subject) {
|
||||
if (
|
||||
action.id == "org.freedesktop.systemd1.manage-units" &&
|
||||
action.lookup("unit") == "mongodb.service" &&
|
||||
subject.user == "${config.services.mongodb.user}"
|
||||
)
|
||||
{
|
||||
return polkit.Result.YES;
|
||||
}
|
||||
})
|
||||
'';
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
mongosh
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue