2020-04-16 19:14:10 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
# Kernel configuration
|
|
|
|
boot = {
|
2020-09-03 22:23:18 +02:00
|
|
|
kernelPackages = pkgs.linuxPackages_zen;
|
2020-12-02 19:10:01 +01:00
|
|
|
kernelParams =
|
|
|
|
[ "zfs.zfs_arc_max=1073741824 zfs.zfs_arc_meta_limit_percent=90" ];
|
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 ];
|
2021-03-30 18:22:53 +02:00
|
|
|
blacklistedKernelModules = [ "btusb" ];
|
2020-04-16 19:14:10 +02:00
|
|
|
supportedFilesystems = [ "zfs" ];
|
2021-08-09 02:11:33 +02:00
|
|
|
zfs = {
|
|
|
|
requestEncryptionCredentials = true;
|
|
|
|
enableUnstable = 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;
|
2021-05-05 00:40:14 +02:00
|
|
|
services.fwupd.enable = true;
|
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;
|
2021-02-17 03:06:37 +01:00
|
|
|
editor = false;
|
2020-04-16 19:14:10 +02:00
|
|
|
};
|
2020-09-13 16:58:56 +02:00
|
|
|
timeout = 3;
|
2020-04-16 19:14:10 +02:00
|
|
|
};
|
|
|
|
|
2021-08-08 20:56:16 +02:00
|
|
|
# Run Nix garbage collector and enable flakes
|
2020-04-16 19:14:10 +02:00
|
|
|
nix = {
|
2020-09-03 02:36:54 +02:00
|
|
|
autoOptimiseStore = true;
|
2020-04-16 19:14:10 +02:00
|
|
|
gc = {
|
|
|
|
automatic = true;
|
2020-09-03 02:36:54 +02:00
|
|
|
options = "--delete-older-than 7d";
|
2021-03-23 00:14:00 +01:00
|
|
|
dates = "Tue 23:00";
|
2020-04-16 19:14:10 +02:00
|
|
|
};
|
|
|
|
extraOptions = ''
|
|
|
|
keep-outputs = true
|
2020-09-30 12:12:00 +02:00
|
|
|
keep-derivations = true
|
2020-04-16 19:14:10 +02:00
|
|
|
gc-keep-outputs = true
|
2021-08-08 20:56:16 +02:00
|
|
|
experimental-features = nix-command flakes
|
2020-04-16 19:14:10 +02:00
|
|
|
'';
|
2021-08-08 20:56:16 +02:00
|
|
|
package = pkgs.nixUnstable;
|
2020-04-16 19:14:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
# 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
|
2021-07-29 23:27:36 +02:00
|
|
|
time.timeZone = "Europe/London";
|
2020-10-11 15:12:59 +02:00
|
|
|
services.chrony.enable = true;
|
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;
|
2021-01-28 00:40:27 +01:00
|
|
|
openssh.authorizedKeys.keys = [''
|
|
|
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBvnfIsxGZWh+tU7OI60Tw3CyT+q3ghoETfRyWsXhioZ coolneng@panacea
|
|
|
|
''];
|
2020-05-11 06:40:41 +02:00
|
|
|
};
|
|
|
|
|
2020-05-23 15:43:54 +02:00
|
|
|
# Auto-upgrade the system
|
|
|
|
system.autoUpgrade = {
|
2021-07-29 23:27:36 +02:00
|
|
|
enable = false;
|
2020-05-23 15:43:54 +02:00
|
|
|
dates = "14:00";
|
|
|
|
};
|
|
|
|
|
2021-08-09 02:10:51 +02:00
|
|
|
# Specify secrets
|
|
|
|
age.secrets = {
|
|
|
|
soundcloud_api_key.file = secrets/soundcloud_api_key.age;
|
|
|
|
wireguard.file = secrets/wireguard.age;
|
|
|
|
};
|
|
|
|
|
2020-04-18 21:04:14 +02:00
|
|
|
# Import other configuration modules
|
|
|
|
imports = [
|
2020-09-03 02:36:09 +02:00
|
|
|
./modules/hardware-configuration.nix
|
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-09-03 02:36:09 +02:00
|
|
|
./modules/power.nix
|
2020-09-22 03:09:43 +02:00
|
|
|
./modules/cachix.nix
|
2020-09-24 00:03:02 +02:00
|
|
|
./overlays/emacs.nix
|
2020-04-18 21:04:14 +02:00
|
|
|
];
|
|
|
|
|
2020-04-16 19:14:10 +02:00
|
|
|
}
|