nixos: define user limits
This commit is contained in:
+37
-12
@@ -1,7 +1,7 @@
|
|||||||
{ pkgs, ... }:
|
{ lib, ... }:
|
||||||
{
|
|
||||||
users.users =
|
|
||||||
let
|
let
|
||||||
|
inherit (lib) optionals;
|
||||||
|
|
||||||
adminGroups = [
|
adminGroups = [
|
||||||
"adm"
|
"adm"
|
||||||
"named"
|
"named"
|
||||||
@@ -10,18 +10,43 @@
|
|||||||
"tuxcord"
|
"tuxcord"
|
||||||
"wheel"
|
"wheel"
|
||||||
];
|
];
|
||||||
in
|
|
||||||
{
|
mkUser = name: uid: options: {
|
||||||
error = {
|
users.users.${name} = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
shell = pkgs.fish;
|
extraGroups = optionals options.admin adminGroups;
|
||||||
extraGroups = adminGroups;
|
inherit uid;
|
||||||
};
|
};
|
||||||
|
|
||||||
javalsai = {
|
systemd.slices."user-${uid}".sliceConfig = {
|
||||||
isNormalUser = true;
|
CPUQuota = "50%";
|
||||||
shell = pkgs.zsh;
|
CPUWeight = "10";
|
||||||
extraGroups = adminGroups;
|
IOAccounting = true;
|
||||||
|
IOWeight = "10";
|
||||||
|
MemoryMax = "2G";
|
||||||
|
MemorySwapMax = "1G";
|
||||||
|
TasksMax = "100";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
in
|
||||||
|
map (user: mkUser user.name user.uid user.options) [
|
||||||
|
{
|
||||||
|
name = "error";
|
||||||
|
uid = 1000;
|
||||||
|
options.admin = true;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
name = "javalsai";
|
||||||
|
uid = 1001;
|
||||||
|
options.admin = true;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "deadvey";
|
||||||
|
uid = 1002;
|
||||||
|
options.admin = true;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "vectorum";
|
||||||
|
uid = 1003;
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user