panacea/configuration.nix

148 lines
3.6 KiB
Nix
Raw Normal View History

2020-04-16 19:14:10 +02:00
{ config, lib, pkgs, ... }:
2021-11-16 16:12:01 +01:00
with pkgs;
let hybrid-codec-vaapiIntel = vaapiIntel.override { enableHybridCodec = true; };
in {
2020-04-16 19:14:10 +02:00
# Kernel configuration
boot = {
kernelPackages = linuxPackages_zen;
2020-12-02 19:10:01 +01:00
kernelParams =
[ "zfs.zfs_arc_max=1073741824" "zfs.zfs_arc_meta_limit_percent=90" ];
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" ];
zfs = {
requestEncryptionCredentials = true;
enableUnstable = true;
};
2020-04-16 19:14:10 +02:00
};
# Intel CPU tweaks
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
# GPU Hardware acceleration
hardware.opengl.extraPackages =
[ intel-media-driver hybrid-codec-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;
editor = false;
2020-04-16 19:14:10 +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 = {
2022-01-30 22:06:17 +01:00
settings = {
auto-optimise-store = true;
trusted-users = [ "root" "coolneng" ];
};
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-11-16 16:12:01 +01:00
package = nixUnstable;
2020-04-16 19:14:10 +02:00
};
# Clean tmp directory on shutdown
boot.cleanTmpDir = true;
# 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
nixpkgs.config = {
allowUnfree = true;
pulseaudio = true;
};
2020-04-22 22:13:03 +02:00
# Scrub zpool monthly
services.zfs.autoScrub = {
enable = true;
interval = "monthly";
};
# Set timezone and synchronize NTP
2021-08-18 01:47:11 +02:00
time.timeZone = "Europe/Brussels";
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";
# 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" ];
2021-11-16 16:12:01 +01:00
shell = fish;
};
2021-08-09 22:59:07 +02:00
# Set shell for root user
2021-11-16 16:12:01 +01:00
users.users.root.shell = fish;
2021-08-09 02:10:51 +02:00
# Specify secrets
2021-08-13 10:48:58 +02:00
age = {
secrets.wireguard.file = secrets/wireguard.age;
2021-08-13 11:00:13 +02:00
secrets.syncthing.file = secrets/syncthing.age;
2022-01-27 00:29:15 +01:00
secrets.samba-ugent.file = secrets/samba-ugent.age;
identityPaths = [ "/etc/ssh/id_ed25519" ];
2021-08-13 10:48:58 +02:00
};
2021-08-09 02:10:51 +02:00
# Enable internal microphone when headphones are plugged in
hardware.firmware = [
(writeTextDir "/lib/firmware/hda-jack-retask.fw" ''
[codec]
0x10ec0293 0x17aa2233 0
[pincfg]
0x12 0x90a60130
0x13 0x40000000
0x14 0x90170110
0x15 0x03211040
0x16 0x21211010
0x18 0x411111f0
0x19 0x21a11010
0x1a 0x40f000f0
0x1b 0x411111f0
0x1d 0x40738105
0x1e 0x411111f0
'')
];
boot.extraModprobeConfig = "options snd-hda-intel patch=hda-jack-retask.fw";
# Import other configuration modules
imports = [
./modules/hardware-configuration.nix
2020-04-24 04:08:44 +02:00
./modules/software.nix
./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
./modules/power.nix
2020-09-24 00:03:02 +02:00
./overlays/emacs.nix
2021-09-29 12:09:36 +02:00
./overlays/nix-direnv.nix
2022-01-21 00:31:34 +01:00
./overlays/openconnect-sso.nix
2022-01-29 13:28:28 +01:00
./overlays/cyrus-sasl-oauth2.nix
];
2020-04-16 19:14:10 +02:00
}