mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
pinchflat: use a static user
This commit is contained in:
parent
95cca8d853
commit
c2450f04fb
1 changed files with 30 additions and 1 deletions
|
@ -62,6 +62,22 @@ in
|
|||
description = "Log level for Pinchflat.";
|
||||
};
|
||||
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "pinchflat";
|
||||
description = ''
|
||||
User account under which Pinchflat runs.
|
||||
'';
|
||||
};
|
||||
|
||||
group = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "pinchflat";
|
||||
description = ''
|
||||
Group under which Pinchflat runs.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type =
|
||||
with types;
|
||||
|
@ -125,7 +141,9 @@ in
|
|||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
DynamicUser = true;
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
|
||||
StateDirectory = baseNameOf stateDir;
|
||||
Environment =
|
||||
[
|
||||
|
@ -151,6 +169,17 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
users.users = lib.mkIf (cfg.user == "pinchflat") {
|
||||
pinchflat = {
|
||||
group = cfg.group;
|
||||
isSystemUser = true;
|
||||
};
|
||||
};
|
||||
|
||||
users.groups = lib.mkIf (cfg.group == "pinchflat") {
|
||||
pinchflat = { };
|
||||
};
|
||||
|
||||
networking.firewall = mkIf cfg.openFirewall {
|
||||
allowedTCPPorts = [ cfg.port ];
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue