config/hosts/mtworx/configuration.nix

222 lines
5.0 KiB
Nix
Raw Normal View History

2024-03-12 21:26:31 +02:00
{
pkgs,
2024-03-18 17:46:17 +02:00
config,
2024-03-12 21:26:31 +02:00
myData,
...
}: let
2024-03-12 13:44:40 +02:00
nvme = "/dev/disk/by-id/nvme-WD_PC_SN810_SDCQNRY-1T00-1201_23234W800017";
2024-03-13 12:59:41 +02:00
randr = import ./randr.nix;
2024-03-12 21:26:31 +02:00
in {
imports = [
2024-03-13 10:01:09 +02:00
../../shared/work
2024-03-12 21:26:31 +02:00
../../modules
../../modules/profiles/desktop
];
boot = {
kernelPackages = pkgs.linuxPackages_latest;
2024-03-12 21:26:31 +02:00
kernelModules = ["kvm-intel"];
loader.systemd-boot.enable = true;
initrd = {
availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usbhid"];
luks.devices = {
luksroot = {
device = "${nvme}-part3";
allowDiscards = true;
};
};
};
};
swapDevices = [
{
device = "${nvme}-part2";
randomEncryption.enable = true;
}
];
fileSystems = {
"/" = {
device = "/dev/mapper/luksroot";
2024-03-13 15:28:35 +02:00
fsType = "btrfs";
2024-03-13 16:23:01 +02:00
options = ["compress=zstd"];
2024-03-12 21:26:31 +02:00
};
"/boot" = {
device = "${nvme}-part1";
2024-03-12 21:36:08 +02:00
fsType = "vfat";
2024-03-12 21:26:31 +02:00
};
};
powerManagement.cpuFreqGovernor = "powersave";
hardware.cpu.intel.updateMicrocode = true;
nixpkgs.hostPlatform = "x86_64-linux";
boot.binfmt.emulatedSystems = ["aarch64-linux"];
systemd.services.zfs-mount.enable = false;
mj = {
stateVersion = "23.11";
timeZone = "Europe/Vilnius";
username = "motiejus";
base.users = {
enable = true;
2024-03-12 16:03:50 +02:00
devTools = true;
2024-03-18 17:46:17 +02:00
root.hashedPasswordFile = config.age.secrets.root-work-passwd-hash.path;
user.hashedPasswordFile = config.age.secrets.motiejus-work-passwd-hash.path;
2024-03-12 21:26:31 +02:00
};
services = {
sshguard.enable = false;
tailscale = {
enable = true;
verboseLogs = true;
};
node_exporter = {
enable = true;
extraSubnets = [myData.subnets.vno1.cidr];
};
deployerbot = {
follower = {
inherit (myData.hosts."vno1-oh2.servers.jakst") publicKey;
enable = true;
uidgid = myData.uidgid.updaterbot-deployee;
sshAllowSubnets = with myData.subnets; [tailscale.sshPattern];
};
};
#postfix = {
# enable = true;
# saslPasswdPath = config.age.secrets.sasl-passwd.path;
#};
syncthing = {
enable = true;
dataDir = "/home/motiejus/";
user = "motiejus";
group = "users";
};
#remote-builder.client = let
# host = myData.hosts."fra1-a.servers.jakst";
#in {
# enable = true;
# inherit (host) system supportedFeatures;
# hostName = host.jakstIP;
# sshKey = "/etc/ssh/ssh_host_ed25519_key";
#};
};
};
virtualisation.virtualbox.host.enable = true;
users.extraGroups.vboxusers.members = ["motiejus"];
networking = {
hostId = "b14a02aa";
hostName = "mtworx";
domain = "motiejus.jakst";
firewall.rejectPackets = true;
};
2024-03-12 15:47:29 +02:00
services = {
2024-03-18 08:57:23 +02:00
autorandr.profiles = {
2024-03-13 12:59:41 +02:00
default = {
fingerprint = {inherit (randr) eDP-1;};
config = {
DP-1.enable = false;
DP-2.enable = false;
DP-3.enable = false;
DP-4.enable = false;
eDP-1 = {
enable = true;
primary = true;
mode = "1920x1200";
crtc = 0;
position = "0x0";
};
};
};
2024-03-13 14:23:21 +02:00
dualhome = {
fingerprint = {
inherit (randr) eDP-1;
inherit (randr.home) DP-3 HDMI-1;
};
config = {
eDP-1.enable = false;
HDMI-1 = {
enable = true;
mode = "2560x1440";
position = "0x0";
crtc = 1;
};
DP-3 = {
enable = true;
mode = "2560x1440";
position = "2560x0";
crtc = 2;
};
};
};
2024-03-15 11:11:04 +02:00
work-lidopen = {
2024-03-13 12:59:41 +02:00
fingerprint = {
inherit (randr) eDP-1;
inherit (randr.work) DP-3;
};
2024-03-18 08:57:23 +02:00
config = {
DP-3 = {
enable = true;
primary = true;
mode = "3840x2160";
crtc = 0;
position = "1920x0";
};
eDP-1 = {
enable = true;
primary = true;
mode = "1920x1200";
crtc = 1;
position = "0x960";
};
};
2024-03-15 11:11:04 +02:00
};
work-lidclosed = {
2024-03-15 11:13:04 +02:00
fingerprint = {inherit (randr.work) DP-3;};
2024-03-18 08:57:23 +02:00
config = {
eDP-1.enable = false;
DP-3 = {
enable = true;
primary = true;
mode = "3840x2160";
crtc = 0;
position = "0x0";
};
};
2024-03-13 12:59:41 +02:00
};
};
2024-03-12 15:47:29 +02:00
tlp = {
enable = true;
settings = {
CPU_BOOST_ON_BAT = 0;
CPU_HWP_DYN_BOOST_ON_BAT = 0;
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
PLATFORM_PROFILE_ON_BAT = "low-power";
2024-03-15 11:16:07 +02:00
START_CHARGE_THRESH_BAT0 = 80;
STOP_CHARGE_THRESH_BAT0 = 87;
2024-03-12 15:47:29 +02:00
RUNTIME_PM_ON_BAT = "auto";
};
2024-03-12 21:26:31 +02:00
};
};
}