snowfall lib migration wip

This commit is contained in:
Aleksandr Lebedev 2025-08-07 18:07:27 +02:00
parent b9dadac2af
commit ed08a98651
31 changed files with 1067 additions and 172 deletions

View file

@ -0,0 +1,35 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.hardware.asahi;
in {
options.${namespace}.hardware.asahi = with types; {
enable = mkBoolOpt false "Enable hardware support for Apple Silicon (M Chips)";
imports = [
inputs.apple-silicon-support.nixosModules.default
({pkgs, ...}: {
hardware.asahi = {
peripheralFirmwareDirectory = ./firmware;
useExperimentalGPUDriver = true; #deprecated
#experimentalGPUInstallMode = "overlay";
setupAsahiSound = true;
};
environment.systemPackages = with pkgs; [
mesa-asahi-edge
];
})
];
};
}

Binary file not shown.

View file

@ -19,9 +19,8 @@ in {
enable = mkBoolOpt false "Enable bluetooth support";
};
config =
mkIf cfg.enable {
hardware.bluetooth = {
config = mkIf cfg.enable {
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
settings = {
@ -30,6 +29,6 @@ in {
};
};
};
services.blueman.enable = true;
};
services.blueman.enable = true;
};
}

View file

@ -0,0 +1,49 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.hardware.framework12;
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";
};
config = mkIf cfg.enable {
# 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 = ''
softdep soc_button_array pre: pinctrl_tigerlake
'';
boot.initrd.kernelModules = ["pinctrl_tigerlake"];
# Patch the `udev` rules shipping with `iio-sensor-proxy` according to:
# https://github.com/FrameworkComputer/linux-docs/blob/main/framework12/Ubuntu-25-04-accel-ubuntu25.04.md
nixpkgs.overlays = [
(final: prev: {
iio-sensor-proxy = prev.iio-sensor-proxy.overrideAttrs (old: {
postInstall = ''
${old.postInstall or ""}
sed -i 's/.*iio-buffer-accel/#&/' $out/lib/udev/rules.d/80-iio-sensor-proxy.rules
'';
});
})
];
hardware.enableRedistributableFirmware = true;
environment.systemPackages = [
pkgs.framework-tool
];
users.groups.touchscreen = {};
services.udev.extraRules = ''
KERNEL=="event*", ATTRS{name}=="ILIT2901:00 222A:5539", SYMLINK+="touchscreen", MODE="0660", GROUP="touchscreen"
'';
};
}

View file

@ -0,0 +1,66 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.hardware.nvidia;
in {
options.${namespace}.hardware.nvidia = with types; {
enable = mkBoolOpt false "Enable Nvidia GPU Drivers";
};
config = mkIf cfg.enable {
hardware = {
graphics = {
enable = true;
extraPackages = with pkgs; [
nvidia-vaapi-driver
];
};
nvidia = {
# https://nixos.wiki/wiki/Nvidia
# Modesetting is required.
modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
# Enable this if you have graphical corruption issues or application crashes after waking
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
# of just the bare essentials.
powerManagement.enable = true; #false;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
powerManagement.finegrained = false;
# Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+
# Currently alpha-quality/buggy, so false is currently the recommended setting.
open = true;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = true;
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.latest;
};
logitech.wireless.enable = true;
};
services.xserver.videoDrivers = ["nvidia"];
};
}

View file

@ -19,16 +19,15 @@ in {
enable = mkBoolOpt false "Enable printers support";
};
config =
mkIf cfg.enable {
environment.systemPackages = with pkgs; [
system-config-printer
];
services.printing.enable = true;
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
system-config-printer
];
services.printing.enable = true;
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
};
}

View file

@ -0,0 +1,38 @@
{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.hardware.secureBoot;
in {
options.${namespace}.hardware.secureBoot = with types; {
enable = mkBoolOpt false "Enable support for secure boot. Note: Secure boot should still be configured imperatively. This module only handles the declarative part.";
};
config = mkIf cfg.enable {
boot = {
initrd.systemd.enable = true;
lanzaboote = {
enable = true;
pkiBundle = "/var/lib/sbctl";
};
};
environment.systemPackages = with pkgs; [
# For debugging and troubleshooting Secure Boot.
sbctl
# For tpm auto unlock
tpm2-tss
];
};
}