fix(systemd): sandbox privileged hardware oneshots

Assisted-by: DeepSeek Harness (deepseek-flash)
This commit is contained in:
Ryan Yin committed 2026-11-01 20:49:51 +08:00
1 parent e0cb3eab75
commit a97400df69
6 files changed
+82 -3

No files matched your search

+2 -1
View File
@@ -1,5 +1,6 @@
{
lib,
mylib,
pkgs,
nixos-apple-silicon,
my-asahi-firmware,
@@ -76,7 +77,7 @@
wantedBy = [ "multi-user.target" ];
after = [ "systemd-modules-load.service" ];
path = [ pkgs.coreutils ];
serviceConfig = {
serviceConfig = mylib.systemdHardening.privilegedOneshot // {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = pkgs.writeShellScript "apple-charge-limit" ''
+4 -1
View File
@@ -119,9 +119,12 @@ in
description = "Disable APM/standby on the USB HDDs";
after = [ "local-fs.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
serviceConfig = mylib.systemdHardening.privilegedOneshot // {
Type = "oneshot";
RemainAfterExit = true;
CapabilityBoundingSet = [ "CAP_SYS_RAWIO" ];
PrivateDevices = false;
DeviceAllow = [ "block-sd rw" ];
};
script = ''
for d in ${hddPublic} ${hddEncrypted}; do
+2 -1
View File
@@ -1,5 +1,6 @@
{
pkgs,
mylib,
myvars,
...
}:
@@ -83,7 +84,7 @@
wantedBy = [ "multi-user.target" ];
after = [ "systemd-modules-load.service" ];
path = [ pkgs.coreutils ];
serviceConfig = {
serviceConfig = mylib.systemdHardening.privilegedOneshot // {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = pkgs.writeShellScript "amdgpu-power-cap" ''