{ config, lib, pkgs, hostName, ... }:
-let rpool = "patate200"; in
{
-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)
- '';
-};
-
-# 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/acpid.nix
+ ../../nixos/profiles/hardware/thinkpad.nix
+ ../../nixos/profiles/zfs.nix
+ ../../nixos/profiles/zramSwap.nix
];
+
boot.loader.grub = {
enable = true;
version = 2;
device = "/dev/disk/by-id/ata-CT250MX500SSD1_2004E2849DD1";
configurationLimit = 3;
- #zfsSupport = true;
- /*
- efiSupport = true;
- efi = {
- canTouchEfiVariables = false;
- efiSysMountPoint = "/boot/efi";
- };
- */
- #enableCryptodisk = true;
-};
-services.acpid = {
- enable = true;
- handlers = {
- brightnessDown = {
- event = "video/brightnessdown.*";
- action = "${pkgs.acpilight}/bin/xbacklight -dec 10";
- };
- brightnessUp = {
- event = "video/brightnessup.*";
- action = "${pkgs.acpilight}/bin/xbacklight -inc 10";
- };
- 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
- '';
- };
- };
};
fileSystems."/boot" =
- { device = "/dev/disk/by-partlabel/${rpool}_ssd_boot";
+ { device = "/dev/disk/by-partlabel/${hostName}_ssd_boot";
fsType = "ext2";
};
fileSystems."/boot/efi" =
- { device = "/dev/disk/by-partlabel/${rpool}_ssd_efi";
+ { device = "/dev/disk/by-partlabel/${hostName}_ssd_efi";
fsType = "vfat";
};
swapDevices = [
- { device = "/dev/disk/by-partlabel/${rpool}_ssd_swap";
+ { device = "/dev/disk/by-partlabel/${hostName}_ssd_swap";
randomEncryption = {
enable = true;
cipher = "aes-xts-plain64";
};
}
];
-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 = "ec2adb40";
-# 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.extraModulePackages = [
+ #config.boot.kernelPackages.exfat-nofuse
];
-boot.zfs.forceImportAll = false;
-boot.zfs.forceImportRoot = false;
-boot.zfs.enableUnstable = false;
-boot.zfs.requestEncryptionCredentials = [ rpool ];
-services.zfs.autoScrub.enable = true;
+powerManagement.powertop.enable = true;
fileSystems."/" =
- { device = "${rpool}/root";
+ { device = "${hostName}/root";
fsType = "zfs";
};
fileSystems."/nix" =
- { device = "${rpool}/nix";
+ { device = "${hostName}/nix";
fsType = "zfs";
};
-fileSystems."/home" =
- { device = "${rpool}/home";
+fileSystems."/home/sevy" =
+ { device = "${hostName}/home";
fsType = "zfs";
};
fileSystems."/home/sevy/Documents" =
- { device = "${rpool}/home/documents";
+ { device = "${hostName}/home/Documents";
+ fsType = "zfs";
+ };
+fileSystems."/home/sevy/Images" =
+ { device = "${hostName}/home/Images";
+ fsType = "zfs";
+ };
+fileSystems."/home/sevy/Téléchargements" =
+ { device = "${hostName}/home/Downloads";
+ fsType = "zfs";
+ };
+fileSystems."/home/sevy/.thunderbird" =
+ { device = "${hostName}/home/Mails";
+ fsType = "zfs";
+ };
+fileSystems."/home/sevy/Vidéos" =
+ { device = "${hostName}/home/Videos";
fsType = "zfs";
};
fileSystems."/var" =
- { device = "${rpool}/var";
+ { device = "${hostName}/var";
fsType = "zfs";
};
fileSystems."/var/cache" =
- { device = "${rpool}/var/cache";
+ { device = "${hostName}/var/cache";
fsType = "zfs";
};
fileSystems."/var/log" =
- { device = "${rpool}/var/log";
+ { device = "${hostName}/var/log";
fsType = "zfs";
};
fileSystems."/var/tmp" =
- { device = "${rpool}/var/tmp";
+ { device = "${hostName}/var/tmp";
fsType = "zfs";
};