{
config,
lib,
pkgs,
modulesPath,
user,
...
}: {
imports = [
../../nixos/desktop.nix
../../nixos/nvidia.nix
../../nixos/sway.nix
../../nixos/hp.nix
../../nixos/steam.nix
(modulesPath + "/installer/scan/not-detected.nix")
];
nixpkgs.config = {
allowUnfree = true;
chromium.enableWideVine = true;
};
boot = {
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
supportedFilesystems = ["btrfs" "zfs"];
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "uas"];
initrd.luks.devices."enc".device = "/dev/disk/by-label/LUKS";
extraModulePackages = with config.boot.kernelPackages; [acpi_call];
kernelModules = ["kvm-intel" "i2c-dev" "acpi_call"];
};
programs.msmtp = let
mail = "alert@nrab.lol";
in {
enable = true;
setSendmail = true;
defaults = {
aliases = pkgs.writeText "mail-aliases" ''
${user}: nikodem@rabulinski.com
root: ${mail}
'';
tls = "on";
auth = "login";
tls_starttls = "off";
};
accounts = {
default = {
host = "mail.nrab.lol";
passwordeval = "cat ${../../assets/alertplaintext}";
user = mail;
from = mail;
};
};
};
# TODO: ZFS ONLY IN SERVER SPECIALIZATION
boot.zfs.extraPools = ["yottapool"];
services.zfs = {
autoScrub.enable = true;
zed.settings = {
ZED_DEBUG_LOG = "/tmp/zed.debug.log";
ZED_EMAIL_ADDR = [user];
ZED_EMAIL_PROG = "${pkgs.msmtp}/bin/msmtp";
ZED_EMAIL_OPTS = "@ADDRESS@";
ZED_NOTIFY_INTERVAL_SECS = 3600;
ZED_NOTIFY_VERBOSE = true;
ZED_USE_ENCLOSURE_LEDS = true;
ZED_SCRUB_AFTER_RESILVER = true;
};
};
hardware = {
enableAllFirmware = true;
cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
opentabletdriver.enable = true;
};
networking.hostName = "legion";
networking.hostId = builtins.substring 0 8 (builtins.readFile ./machine-id);
environment.etc.machine-id.source = ./machine-id;
networking.networkmanager.enable = true;
networking.firewall.enable = false;
networking.useDHCP = lib.mkDefault true;
time.timeZone = "Europe/Warsaw";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "pl";
};
virtualisation.podman = {
enable = true;
dockerCompat = true;
};
virtualisation.libvirtd = {
enable = true;
onBoot = "ignore";
};
services.xserver.libinput = {
enable = true;
mouse.accelProfile = "flat";
};
users.users.${user}.extraGroups = ["libvirtd" "i2c" "networkmanager"];
services.udisks2.enable = true;
services.usbmuxd.enable = true;
environment.systemPackages = with pkgs; [libimobiledevice ifuse podman-compose];
system.stateVersion = "22.05";
powerManagement.cpuFreqGovernor = "performance";
# TODO: Which of those actually does what I need?
services.logind = {
lidSwitch = "ignore";
lidSwitchDocked = "ignore";
lidSwitchExternalPower = "ignore";
extraConfig = "HandleLidSwitch=ignore";
};
# TODO: Manage those sanely
fileSystems."/" = {
device = "/dev/disk/by-label/LINUX";
fsType = "btrfs";
options = ["subvol=root" "compress=zstd" "noatime"];
};
fileSystems."/home" = {
device = "/dev/disk/by-label/LINUX";
fsType = "btrfs";
options = ["subvol=home" "compress=zstd" "noatime"];
};
fileSystems."/nix" = {
device = "/dev/disk/by-label/LINUX";
fsType = "btrfs";
options = ["subvol=nix" "compress=zstd" "noatime"];
};
fileSystems."/persist" = {
device = "/dev/disk/by-label/LINUX";
fsType = "btrfs";
options = ["subvol=persist" "compress=zstd" "noatime"];
};
fileSystems."/var/log" = {
device = "/dev/disk/by-label/LINUX";
fsType = "btrfs";
options = ["subvol=log" "compress=zstd" "noatime"];
neededForBoot = true;
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/BOOT";
fsType = "vfat";
};
swapDevices = [
{device = "/dev/disk/by-label/SWAP";}
];
}