2020-04-16 19:14:10 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
# Kernel configuration
|
|
|
|
boot = {
|
2020-04-18 21:04:14 +02:00
|
|
|
kernelPackages = pkgs.linuxPackages_latest;
|
2020-04-16 19:14:10 +02:00
|
|
|
kernelParams = [ "zfs.zfs_arc_max=536870912" ];
|
2020-05-11 06:40:41 +02:00
|
|
|
kernelModules = [ "i915" "acpi_call" "kvm-intel" ];
|
2020-04-16 19:14:10 +02:00
|
|
|
extraModulePackages = with config.boot.kernelPackages; [ acpi_call ];
|
|
|
|
supportedFilesystems = [ "zfs" ];
|
2020-05-08 21:53:52 +02:00
|
|
|
zfs.requestEncryptionCredentials = true;
|
2020-04-16 19:14:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
# Intel CPU tweaks
|
2020-05-11 06:40:41 +02:00
|
|
|
hardware.cpu.intel.updateMicrocode =
|
|
|
|
lib.mkDefault config.hardware.enableRedistributableFirmware;
|
2020-04-16 19:14:10 +02:00
|
|
|
|
2020-05-08 21:53:52 +02:00
|
|
|
hardware.opengl.extraPackages = with pkgs; [
|
|
|
|
vaapiIntel
|
|
|
|
vaapiVdpau
|
|
|
|
libvdpau-va-gl
|
|
|
|
];
|
2020-04-16 19:14:10 +02:00
|
|
|
|
|
|
|
# Bootloader configuration
|
|
|
|
boot.loader = {
|
2020-05-08 21:53:52 +02:00
|
|
|
efi.canTouchEfiVariables = true;
|
|
|
|
systemd-boot = {
|
|
|
|
enable = true;
|
2020-04-16 19:14:10 +02:00
|
|
|
configurationLimit = 50;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Run Nix garbage collector, while avoiding compiling
|
|
|
|
nix = {
|
|
|
|
gc = {
|
|
|
|
automatic = true;
|
2020-06-14 01:23:11 +02:00
|
|
|
options = "--delete-older-than 14d";
|
2020-05-14 02:09:23 +02:00
|
|
|
dates = "14:30";
|
2020-04-16 19:14:10 +02:00
|
|
|
};
|
|
|
|
extraOptions = ''
|
|
|
|
keep-outputs = true
|
|
|
|
gc-keep-outputs = true
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
# Clean tmp directory on shutdown
|
|
|
|
boot.cleanTmpDir = true;
|
|
|
|
|
2020-04-18 21:04:14 +02:00
|
|
|
# Rotate logs after 7 days
|
|
|
|
services.journald.extraConfig = "SystemMaxFiles=7";
|
|
|
|
|
2020-08-31 00:43:09 +02:00
|
|
|
# Allow propietary software and build packages with Pulseaudio support
|
2020-05-14 02:09:23 +02:00
|
|
|
nixpkgs.config = {
|
|
|
|
allowUnfree = true;
|
|
|
|
pulseaudio = true;
|
|
|
|
};
|
2020-04-18 21:04:14 +02:00
|
|
|
|
2020-04-22 22:13:03 +02:00
|
|
|
# Scrub zpool monthly
|
|
|
|
services.zfs.autoScrub = {
|
|
|
|
enable = true;
|
|
|
|
interval = "monthly";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Set timezone and synchronize NTP
|
|
|
|
time.timeZone = "Europe/Brussels";
|
|
|
|
services.timesyncd.enable = true;
|
|
|
|
|
|
|
|
# Enable the TLP daemon
|
2020-07-17 13:29:04 +02:00
|
|
|
services.tlp = {
|
|
|
|
enable = true;
|
2020-08-11 09:48:48 +02:00
|
|
|
settings = {
|
2020-07-17 13:29:04 +02:00
|
|
|
# Use the new CPU frequency scaling governor
|
2020-08-11 09:48:48 +02:00
|
|
|
CPU_SCALING_GOVERNOR_ON_AC = "schedutil";
|
|
|
|
CPU_SCALING_GOVERNOR_ON_BAT = "schedutil";
|
2020-07-17 13:29:04 +02:00
|
|
|
|
|
|
|
# Adjust CPU frequencies accordingly to the power state
|
2020-08-11 09:48:48 +02:00
|
|
|
CPU_SCALING_MIN_FREQ_ON_AC = 800000;
|
|
|
|
CPU_SCALING_MAX_FREQ_ON_AC = 3000000;
|
|
|
|
CPU_SCALING_MIN_FREQ_ON_BAT = 800000;
|
|
|
|
CPU_SCALING_MAX_FREQ_ON_BAT = 2300000;
|
2020-07-17 13:29:04 +02:00
|
|
|
|
|
|
|
# Enable audio power saving for Intel HDA, AC97 devices (timeout in secs).
|
|
|
|
# A value of 0 disables, >=1 enables power saving (recommended: 1).
|
|
|
|
# Default: 0 (AC), 1 (BAT)
|
2020-08-11 09:48:48 +02:00
|
|
|
SOUND_POWER_SAVE_ON_AC = 0;
|
|
|
|
SOUND_POWER_SAVE_ON_BAT = 1;
|
2020-07-17 13:29:04 +02:00
|
|
|
|
|
|
|
# Runtime Power Management for PCI(e) bus devices: on=disable, auto=enable.
|
|
|
|
# Default: on (AC), auto (BAT)
|
2020-08-11 09:48:48 +02:00
|
|
|
RUNTIME_PM_ON_AC = "on";
|
|
|
|
RUNTIME_PM_ON_BAT = "auto";
|
2020-07-17 13:29:04 +02:00
|
|
|
|
|
|
|
# Battery feature drivers: 0=disable, 1=enable
|
|
|
|
# Default: 1 (all)
|
2020-08-11 09:48:48 +02:00
|
|
|
NATACPI_ENABLE = 1;
|
|
|
|
TPACPI_ENABLE = 1;
|
|
|
|
TPSMAPI_ENABLE = 1;
|
|
|
|
};
|
2020-07-17 13:29:04 +02:00
|
|
|
};
|
2020-04-22 22:13:03 +02:00
|
|
|
|
2020-05-08 21:53:52 +02:00
|
|
|
# NixOS version
|
|
|
|
system.stateVersion = "20.09";
|
|
|
|
|
2020-05-09 01:17:35 +02:00
|
|
|
# Create coolneng user
|
|
|
|
users.users.coolneng = {
|
|
|
|
isNormalUser = true;
|
|
|
|
home = "/home/coolneng";
|
2020-05-14 03:04:30 +02:00
|
|
|
extraGroups = [ "wheel" "video" "audio" "libvirtd" "lp" ];
|
2020-05-11 06:40:41 +02:00
|
|
|
shell = pkgs.fish;
|
|
|
|
};
|
|
|
|
|
2020-05-14 02:09:23 +02:00
|
|
|
# Set shell and SSH for root user
|
2020-05-11 06:40:41 +02:00
|
|
|
users.users.root = {
|
|
|
|
shell = pkgs.fish;
|
|
|
|
openssh.authorizedKeys.keys = [
|
|
|
|
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC9mMwf7yXwtiEABwq5zkNEXgveUhNEPfqa3VLdnG2UYArB6f2l2aFM+MkGc8s84T8cj7JDF2N1pEBvilGMNWmLT32IBfwjyJov/38/PTpWb3301hCck5EOWmykGWMXdRlIEj6vsR4UqeRFwbr8QBlxv2dTPe9wTrCLvkKOuaPWMyMgtEwnNHvB8e7eqUZZYVmRSQkWCqYmK7a6TCvHUg3XsmjQU3OSmTH+eXJEUL4OiSFKxd9eO5QU04uYDbX8f8jY/slReoEWbuJ/InSWFbPs6L3bUYQrl3ht/7DR9FqzcOpAN4AcrJFyIJzot8inpp6f5IsVVjy0dhNUGWtXMkOgNf6lmylokqFBb1Jcy/lJbgUtJZ5ZNjlJFCbjXHe6J0q7bYKJgMQKuY1N3rexhZIMsBXi8aYaSKaGqX7TPnBEPlr1hXda2lGm2l6jQq5Lj2U5aj5aBa/BYmKFGVxcMpRFlsWfYPyQ/2wxRcpNcDiJt0eWP70mhu8OcupPO9kxGw0= coolneng@panacea"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2020-05-23 15:43:54 +02:00
|
|
|
# Auto-upgrade the system
|
|
|
|
system.autoUpgrade = {
|
|
|
|
enable = true;
|
|
|
|
dates = "14:00";
|
|
|
|
};
|
|
|
|
|
2020-06-13 17:21:21 +02:00
|
|
|
# Suspend to RAM/disk when battery is critical
|
|
|
|
services.upower = {
|
|
|
|
enable = true;
|
2020-07-14 11:53:51 +02:00
|
|
|
percentageAction = 5;
|
2020-06-23 01:29:57 +02:00
|
|
|
criticalPowerAction = "HybridSleep";
|
2020-06-13 17:21:21 +02:00
|
|
|
};
|
|
|
|
|
2020-04-18 21:04:14 +02:00
|
|
|
# Import other configuration modules
|
|
|
|
imports = [
|
2020-04-24 04:08:44 +02:00
|
|
|
./modules/software.nix
|
2020-04-18 21:04:14 +02:00
|
|
|
./modules/networking.nix
|
2020-04-22 22:13:03 +02:00
|
|
|
./modules/gui.nix
|
2020-05-09 18:53:22 +02:00
|
|
|
./modules/datasync.nix
|
2020-05-08 21:53:52 +02:00
|
|
|
./modules/audio.nix
|
2020-05-09 18:45:10 +02:00
|
|
|
./modules/development.nix
|
2020-05-14 03:04:30 +02:00
|
|
|
./modules/printing.nix
|
2020-08-10 23:45:26 +02:00
|
|
|
./modules/periodic.nix
|
2020-05-09 01:17:35 +02:00
|
|
|
./modules/hardware-configuration.nix
|
2020-04-18 21:04:14 +02:00
|
|
|
];
|
|
|
|
|
2020-04-16 19:14:10 +02:00
|
|
|
}
|