{ config, lib, pkgs, hostName, ... }:
{
-hardware.cpu.intel.updateMicrocode = true;
-powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
-services.thinkfan = {
- enable = true;
- levels = ''
- (0, 0, 57)
- (1, 56, 62)
- (2, 61, 65)
- (3, 64, 66)
- (4, 65, 68)
- (5, 67, 71)
- (6, 70, 76)
- (7, 75, 81)
- (127, 80, 32767)
- '';
-};
-hardware.acpilight.enable = true;
-services.acpid = {
- enable = true;
- handlers = {
- brightnessDown = {
- event = "video/brightnessdown.*";
- action = "${pkgs.acpilight}/bin/xbacklight -dec 5";
- };
- brightnessUp = {
- event = "video/brightnessup.*";
- action = "${pkgs.acpilight}/bin/xbacklight -inc 5";
- };
- acAdapter = {
- event = "ac_adapter/*";
- action = ''
- vals=($1)
- case ''${vals[3]} in
- 00000000) # unplugged
- ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g powersave;;
- 00000001) # plugged in
- ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g ondemand;;
- esac
- '';
- };
- };
-};
-
-# https://bugzilla.kernel.org/show_bug.cgi?id=110941
-boot.kernelParams = [ "intel_pstate=no_hwp" ];
-boot.kernelModules = [ "kvm-intel" ];
-boot.cleanTmpDir = true;
-boot.tmpOnTmpfs = true;
-boot.extraModulePackages = [
- config.boot.kernelPackages.exfat-nofuse
+imports = [
+ ../../nixos/profiles/hardware/X201.nix
+ ../../nixos/profiles/zfs.nix
+ ../../nixos/profiles/zramSwap.nix
];
+
+/*
+boot.loader.efi = {
+ canTouchEfiVariables = true;
+ efiSysMountPoint = "/boot/efi";
+};
+*/
boot.loader.grub = {
enable = true;
version = 2;
- device = "/dev/disk/by-id/ata-Samsung_SSD_850_PRO_128GB_S1SMNSAFC36436X";
- configurationLimit = 3;
+ devices = [
+ "/dev/disk/by-id/ata-Samsung_SSD_850_PRO_128GB_S1SMNSAFC36436X"
+ ];
+ configurationLimit = 16;
+
#zfsSupport = true;
- /*
- efiSupport = true;
- efi = {
- canTouchEfiVariables = false;
- efiSysMountPoint = "/boot/efi";
- };
- */
+ #efiSupport = true;
#enableCryptodisk = true;
};
+services.udev.extraRules = ''
+ ACTION=="add", SUBSYSTEM=="tty", KERNEL=="ttyUSB*", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="9204", RUN+="${pkgs.gobi_loader}/lib/udev/gobi_loader -2000 $env{DEVNAME} /home/julm/documents/thinkpad-x201/gobi"
+'';
+
+
fileSystems."/boot" =
{ device = "/dev/disk/by-partlabel/${hostName}_ssd_boot";
fsType = "ext2";
};
}
];
-zramSwap = {
- enable = true;
- algorithm = lib.mkDefault "zstd";
- # There is little point creating a zram of greater
- # than twice the size of memory
- # since we expect a 2:1 compression ratio.
- # Note that zram uses about 0.1% of the size of the disk
- # when not in use so a huge zram is wasteful.
- memoryPercent = lib.mkDefault 150;
- # Linux supports multithreaded compression for 1 device since 3.15.
- # See https://lkml.org/lkml/2014/2/28/404 for details.
- swapDevices = lib.mkDefault 1;
-};
-boot.kernel.sysctl = {
- # Increase cache pressure, which increases the tendency of the kernel to
- # reclaim memory used for caching of directory and inode objects. You will use
- # less memory over a longer period of time. The performance hit is negated by
- # the downside of swapping sooner.
- "vm.vfs_cache_pressure" = lib.mkDefault 500;
-
- # Increasing how aggressively the kernel will swap memory pages since we are
- # using ZRAM first.
- "vm.swappiness" = lib.mkDefault 100;
-
- # Background processes will start writing right away when it hits the 1% limit
- "vm.dirty_background_ratio" = lib.mkDefault 1;
-
- # The system won’t force synchronous I/O until it gets to 50% dirty_ratio.
- "vm.dirty_ratio" = lib.mkDefault 50;
-};
# The 32-bit host id of the host, formatted as 8 hexadecimal characters.
# You should try to make this id unique among your hosts.
# Manually generated with : head -c4 /dev/urandom | od -A none -t x4 | cut -d ' ' -f 2
networking.hostId = "ce53d0c3";
-# none is the recommended elevator with ZFS (which has its own I/O scheduler)
-# and/or for SSD, whereas HDD could use mq-deadline.
-services.udev.extraRules = ''
- # set none scheduler for non-rotating disks
- ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="none"
-'';
-
-boot.supportedFilesystems = [ "zfs" ];
-boot.initrd.supportedFilesystems = [ "zfs" ];
-boot.initrd.availableKernelModules = [
- "ahci"
- "drbg"
- "ehci_pci"
- "gf128mul"
- "hmac"
- "sd_mod"
-];
+boot.supportedFilesystems = [ "ntfs" "vfat" ];
-boot.zfs.forceImportAll = false;
-boot.zfs.forceImportRoot = false;
-boot.zfs.enableUnstable = false;
-boot.zfs.requestEncryptionCredentials = [ hostName ];
-services.zfs.autoScrub.enable = true;
-environment.systemPackages = [ pkgs.zfs ];
+powerManagement.powertop.enable = true;
+#services.fprintd.enable = true;
fileSystems."/" =
{ device = "${hostName}/root";