me like nix
1{ ... }: {
2 flake.modules.nixos.lenovo-ideapad5 =
3 { pkgs, lib, config, ... }:
4 {
5 networking.hostName = "ideapad5";
6
7 # AMD laptop basics
8 boot.kernelModules = [ "kvm-amd" ];
9 hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
10 boot.kernelParams = [ "amdgpu.abmlevel=0" ];
11
12 # Low-spec laptop tuning: compressed RAM helps avoid swap thrashing.
13 zramSwap = {
14 enable = true;
15 algorithm = "zstd";
16 memoryPercent = 100;
17 };
18 boot.kernel.sysctl."vm.swappiness" = 180;
19
20 # Laptop power management.
21 services.power-profiles-daemon.enable = true;
22 services.fstrim.enable = true;
23
24 environment.systemPackages = with pkgs; [
25 brightnessctl
26 ];
27
28 # SSH
29 services.openssh = {
30 enable = true;
31 settings = {
32 PasswordAuthentication = false;
33 KbdInteractiveAuthentication = false;
34 PermitRootLogin = "no";
35 AllowUsers = [ "sean" ];
36 };
37 };
38
39 networking.firewall.enable = true;
40
41 system.stateVersion = "25.05";
42 };
43}