nix/systems/nixos-pulse/default.nix

246 lines
6.8 KiB
Nix

{ config
, lib
, pkgs
, modulesPath
, system
, inputs
, ...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
inputs.nixos-hardware.nixosModules.common-cpu-amd
inputs.nixos-hardware.nixosModules.common-cpu-amd-pstate
inputs.nixos-hardware.nixosModules.common-hidpi
inputs.nixos-hardware.nixosModules.common-pc-laptop-acpi_call
inputs.nixos-hardware.nixosModules.tuxedo-pulse-15-gen2
../../os-mods/amdgpu
../../os-mods/cachix
../../os-mods/common
../../os-mods/desktop
../../os-mods/desktop/audio.nix
../../os-mods/desktop/gaming.nix
../../os-mods/desktop/printing.nix
../../os-mods/network
../../os-mods/ryzenapu
../../os-mods/virt
../../users
];
programs.corectrl.gpuOverclock.enable = lib.mkForce false;
nix.settings.system-features = [
"benchmark"
"big-parallel"
"kvm"
"nixos-test"
"gccarch-x86-64-v3"
"gccarch-znver2"
];
boot = {
kernelPackages = pkgs.pkgsx86_64_v3.linuxPackages_cachyos;
kernelPatches = [ ];
kernelParams = [
# "systemd.unit=emergency.target"
"systemd.setenv=SYSTEMD_SULOGIN_FORCE=1"
# "rescue"
# "pcie_aspm=force"
# "pcie_aspm.policy=powersupersave"
# "rtc_cmos.use_acpi_alarm=1" # reduce S0 sleep wakeups
# "gpiolib_acpi.ignore_interrupt=AMDI0030:00@9" # mask IRQ 9 ?
];
loader = {
systemd-boot = {
enable = true;
configurationLimit = 16;
};
efi.canTouchEfiVariables = true;
};
supportedFilesystems = [ "btrfs" "vfat" ];
initrd = {
availableKernelModules = [ "nvme" "xhci_pci" "uas" "usbhid" "usb_storage" "sd_mod" ];
kernelModules = [ ];
systemd.enable = true;
supportedFilesystems = [ "btrfs" "vfat" ];
luks.devices = {
"crypted_1" = {
device = "/dev/disk/by-uuid/9cca6269-6afa-4f77-92ff-2e9eb8fc9bc7";
allowDiscards = true;
bypassWorkqueues = true;
crypttabExtraOpts = [ "nofail" ];
};
"crypted_swap_1" = {
device = "/dev/disk/by-uuid/7b19e61a-20cd-47ae-9da2-0f40c9be86fe";
allowDiscards = true;
bypassWorkqueues = true;
crypttabExtraOpts = [ "nofail" ];
};
};
};
extraModulePackages = [ ];
};
swapDevices = [
{ device = "/dev/disk/by-uuid/83b6aa0a-ff9f-40ef-b728-6540bd5c9365"; }
];
services.btrfs.autoScrub.enable = true;
networking = {
hostName = "nixos-pulse";
extraHosts = ''
192.168.0.75 monitor.oekonzept.de
192.168.0.151 rosa.oekonzept.de
192.168.0.171 karl.oekonzept.de
192.168.0.206 vewadb.oekonzept.de
192.168.0.191 vewadb2.oekonzept.de
192.168.0.190 vpn.oekonzept.de
192.168.0.180 vewasmb.oekonzept.de
192.168.0.91 puppet.oekonzept.de
192.168.0.245 camt.oekonzept.net
192.168.0.245 camt-cbg.oekonzept.net
192.168.0.245 camt-eth.oekonzept.net
192.168.0.245 camt-pro.oekonzept.net
192.168.0.245 camt-swbfk.oekonzept.net
192.168.0.245 cloud.oekonzept.net
192.168.0.245 office.oekonzept.net
192.168.0.245 llama.oekonzept.net
192.168.0.245 netdata.oekonzept.net
192.168.0.245 nixos-karl-kvm-guest.oekonzept.de
176.9.242.147 fe3f3294-c93a-4aca-895e-abe6c858dbd5-llama-cpp.redvau.lt
'';
interfaces = {
enp5s0f4u1u1c2 = {
useDHCP = false;
ipv4.addresses = [
{
address = "192.168.0.21";
prefixLength = 24;
}
];
ipv4.routes = [
{
address = "192.168.0.0";
prefixLength = 24;
}
{
address = "0.0.0.0";
prefixLength = 0;
via = "192.168.0.5";
}
];
};
};
};
fileSystems =
let
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
perm_opts = "uid=1000,gid=100";
btrfs_opts = "autodefrag,compress=zstd,discard=async,noatime,space_cache=v2,ssd";
smb_opts = [
"vers=2.0,credentials=/home/tristand/.smb-secrets"
perm_opts
automount_opts
];
sshfs_opts = [
"allow_other,_netdev,reconnect,ServerAliveInterval=15,IdentityFile=/var/secrets/id_ed25519"
perm_opts
automount_opts
];
in
{
"/" = {
device = "/dev/mapper/crypted_1";
fsType = "btrfs";
options = [
btrfs_opts
"subvol=_active/root"
];
};
"/boot" = {
device = "/dev/disk/by-uuid/3226-7E38";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
"/home" = {
device = "/dev/mapper/crypted_1";
fsType = "btrfs";
options = [
btrfs_opts
"subvol=_active/home"
];
};
"/nix" = {
device = "/dev/mapper/crypted_1";
fsType = "btrfs";
options = [
btrfs_opts
"subvol=_active/nix"
];
};
"/mnt/ServerF" = {
# device = "//srv-nas-01.local/Server_F";
device = "//192.168.0.1/Server_F";
fsType = "cifs";
options = smb_opts;
};
"/mnt/Scans" = {
# device = "//srv-nas-01.local/Server_F";
device = "//192.168.0.1/Scans";
fsType = "cifs";
options = smb_opts;
};
"/mnt/media_v2" = {
device = "root@23.88.68.113:/media_v2";
fsType = "sshfs";
options = sshfs_opts;
};
};
system.fsPackages = [ pkgs.sshfs ];
systemd = {
services = {
# This manually configures the automatically created network-adresses service to be more flexible
# regarding booting without the the device being available on boot
# It prevents slow timeouts & errors on boot while preserving Plug & Play ability
network-addresses-enp5s0f4u1u1c2.unitConfig = {
ConditionPathExists = "/sys/class/net/enp5s0f4u1u1c2";
BindsTo = lib.mkForce null;
};
};
};
services.udev.extraRules = ''
ACTION=="add", KERNEL=="enp5s0f4u1u1c2", TAG+="systemd", ENV{SYSTEMD_WANTS}="network-addresses-enp5s0f4u1u1c2.service"
ACTION=="remove", KERNEL=="enp5s0f4u1u1c2", RUN+="${pkgs.systemd}/bin/systemctl stop network-addresses-enp5s0f4u1u1c2.service"
SUBSYSTEM=="pci", ATTR{power/control}="auto"
ACTION=="add", SUBSYSTEM=="serio", DRIVERS=="atkbd", ATTR{power/wakeup}="disabled"
'';
environment.systemPackages = with pkgs; [
android-tools
android-udev-rules
];
hardware = {
enableRedistributableFirmware = true;
i2c.enable = true;
tuxedo-keyboard.enable = true;
cpu.amd.updateMicrocode = true;
sensor.iio.enable = true;
tuxedo-rs = {
enable = true;
tailor-gui.enable = true;
};
};
zramSwap.enable = true;
system.stateVersion = "23.05";
}