snowfall migration wip framework12 config

This commit is contained in:
Aleksandr Lebedev 2025-08-09 22:44:28 +02:00
parent aaf4ff29c4
commit 0994847b4e
10 changed files with 3860 additions and 60 deletions

View file

@ -17,9 +17,15 @@ with lib.${namespace}; let
in {
options.${namespace}.hardware.framework12 = with types; {
enable = mkBoolOpt false "Enable hardware support for framework 12. P.s. you still need to import inputs.nixos-hardware.nixosModules.framework-12-13th-gen-intel yourself";
imports = [inputs.nixos-hardware.nixosModules.framework-12-13th-gen-intel];
};
config = mkIf cfg.enable {
${namespace}.hardware.battery = {
enable = true;
batteryName = "BAT1";
remainingEnergy = "charge_now";
powerUsage = "current_now";
};
services.fwupd.enable = true; #fwupdmgr update
# Ensure that the `pinctrl_tigerlake` kernel module is loaded before `soc_button_array`.
# This is required for correcly switching to tablet mode when the display is folded back.
boot.extraModprobeConfig = ''

View file

@ -0,0 +1,42 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.hardware.hibernation;
in {
options.${namespace}.hardware.hibernation = with types; {
enable = mkBoolOpt false "Enable hibernation";
swapFileOffset = mkOpt (nullOr int) null "Offset of swapfile. Calculate offset using https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Acquire_swap_file_offset";
resumeDevice = mkOpt' path "/dev/disk/by-label/nixos";
};
config = mkIf cfg.enable {
boot = {
kernelParams = [
"resume_offset=${builtins.toString cfg.resumeDevice}"
"mem_sleep_default=deep"
];
inherit (cfg) resumeDevice;
};
services.logind = {
lidSwitch = mkDefault "suspend-then-hibernate";
powerKey = mkDefault "suspend-then-hibernate";
powerKeyLongPress = mkDefault "poweroff";
};
systemd.sleep.extraConfig = ''
HibernateDelaySec=30m
SuspendState=mem
'';
};
}