Hardware/Apple: Difference between revisions
m Add category hardware |
m style fixes |
||
| Line 4: | Line 4: | ||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
$ cat /sys/devices/virtual/dmi/id/product_{family,name} | |||
MacBook | MacBook | ||
MacBook2,1 | MacBook2,1 | ||
| Line 22: | Line 22: | ||
let | let | ||
register = { | |||
"mini_white_intel+nVidia" = "00:03.0 0x7b.b=0x19"; | |||
"mini_white_intel" = "0:1f.0 0xa4.b=0"; | |||
"mini_unibody_intel" = "0:3.0 -0x7b=20"; | |||
"mini_unibody_M1" = "?"; | |||
}; | |||
in | in | ||
{ | { | ||
options.hardware.macVariant = mkOption { | |||
type = types.enum (attrNames register); | |||
default = elemAt (attrNames register) 0; | |||
example = elemAt (attrNames register) 0; | |||
description = "Minor hardware variants have different registers for enabling autostart"; | |||
}; | |||
# https://www.linuxfromscratch.org/blfs/view/svn/general/pciutils.html | |||
config.environment.systemPackages = with pkgs; [ pciutils ]; | |||
# Needs to run every reboot | |||
config.systemd.services.enable-autorestart = { | |||
script = ("/run/current-system/sw/bin/setpci -s " + (getAttr config.hardware.macVariant register)) ; | |||
wantedBy = [ "default.target" ]; | |||
after = [ "default.target" ]; | |||
}; | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category:Hardware]] | [[Category:Hardware]] | ||