snowfall migration wip framework12 config
This commit is contained in:
parent
aaf4ff29c4
commit
0994847b4e
10 changed files with 3860 additions and 60 deletions
|
|
@ -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 = ''
|
||||
|
|
|
|||
42
modules/nixos/hardware/hibernation/default.nix
Normal file
42
modules/nixos/hardware/hibernation/default.nix
Normal 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
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -22,6 +22,10 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
${namespace}.impermanence = {
|
||||
enable = true;
|
||||
persistentStorage = "/persist";
|
||||
};
|
||||
disko.devices = {
|
||||
disk.main = {
|
||||
inherit (cfg) device;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,96 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
namespace,
|
||||
system,
|
||||
target,
|
||||
format,
|
||||
virtual,
|
||||
systems,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with lib.${namespace}; let
|
||||
cfg = config.${namespace}.presets.disko.impermanenceBtrfsLuks;
|
||||
in {
|
||||
options.${namespace}.presets.disko.impermanenceBtrfsLuks = with types; {
|
||||
enable = mkBoolOpt false "Enable preset";
|
||||
device = mkOpt' str "/dev/nvme0n1";
|
||||
swapSize = mkOpt' int 32;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
${namespace}.impermanence = {
|
||||
enable = true;
|
||||
persistentStorage = "/persist";
|
||||
};
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
inherit device;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
label = "boot";
|
||||
name = "ESP";
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [
|
||||
"defaults"
|
||||
];
|
||||
};
|
||||
};
|
||||
luks = {
|
||||
size = "100%";
|
||||
label = "luks";
|
||||
content = {
|
||||
type = "luks";
|
||||
name = "root_vg";
|
||||
extraOpenArgs = [
|
||||
"--allow-discards"
|
||||
"--perf-no_read_workqueue"
|
||||
"--perf-no_write_workqueue"
|
||||
];
|
||||
# https://0pointer.net/blog/unlocking-luks2-volumes-with-tpm2-fido2-pkcs11-security-hardware-on-systemd-248.html
|
||||
settings = {crypttabExtraOpts = ["fido2-device=auto" "token-timeout=10"];};
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = ["-L" "nixos" "-f"];
|
||||
subvolumes = {
|
||||
"/root" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = ["subvol=root" "compress=zstd" "noatime"];
|
||||
};
|
||||
"/nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = ["subvol=nix" "compress=zstd" "noatime"];
|
||||
};
|
||||
"/persist" = {
|
||||
mountpoint = "/persist";
|
||||
mountOptions = ["subvol=persist" "compress=zstd" "noatime"];
|
||||
};
|
||||
"/swap" = {
|
||||
mountpoint = "/swap";
|
||||
swap.swapfile.size = "${builtins.toString cfg.swapSize}G";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue