2018-07-20 20:56:59 +00:00
|
|
|
{ config, lib, ... }:
|
2016-04-09 18:22:16 +00:00
|
|
|
with lib;
|
|
|
|
|
|
|
|
{
|
2016-09-15 13:23:52 +00:00
|
|
|
meta = {
|
|
|
|
maintainers = [ maintainers.joachifm ];
|
|
|
|
doc = ./hidepid.xml;
|
|
|
|
};
|
2016-04-09 18:22:16 +00:00
|
|
|
|
2016-09-15 13:23:52 +00:00
|
|
|
options = {
|
|
|
|
security.hideProcessInformation = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Restrict process information to the owning user.
|
|
|
|
'';
|
|
|
|
};
|
2016-04-09 18:22:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf config.security.hideProcessInformation {
|
|
|
|
users.groups.proc.gid = config.ids.gids.proc;
|
2016-11-29 01:16:15 +00:00
|
|
|
users.groups.proc.members = [ "polkituser" ];
|
2016-04-09 18:22:16 +00:00
|
|
|
|
2016-08-31 14:16:30 +00:00
|
|
|
boot.specialFileSystems."/proc".options = [ "hidepid=2" "gid=${toString config.ids.gids.proc}" ];
|
2016-11-29 01:16:15 +00:00
|
|
|
systemd.services.systemd-logind.serviceConfig.SupplementaryGroups = [ "proc" ];
|
2020-11-17 20:54:26 +00:00
|
|
|
|
|
|
|
# Disable cgroupsv2, which doesn't work with hidepid.
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/104094#issuecomment-729996203
|
|
|
|
systemd.enableUnifiedCgroupHierarchy = false;
|
2016-04-09 18:22:16 +00:00
|
|
|
};
|
|
|
|
}
|