nixos/hosts/citadel/default.nix

129 lines
3.3 KiB
Nix
Raw Normal View History

2024-09-15 10:12:56 +01:00
{
inputs,
lib,
pkgs,
config,
configVars,
2024-09-15 10:12:56 +01:00
...
}: let
2024-07-20 12:38:57 +01:00
# Disko setup
fsType = "btrfs"; # one of ext4 or btrfs. Use btrfs if using impermanence
dev = "/dev/nvme0n1"; # depends on target hardware
encrypted = true; # currrently only applies to btrfs
2024-09-15 10:12:56 +01:00
btrfsMountDevice =
if encrypted
then "/dev/mapper/crypted"
else "/dev/root_vg/root";
2024-07-20 12:38:57 +01:00
user = "sam";
impermanence = true;
pieholeIp = configVars.networking.addresses.piehole.ip;
gatewayIp = configVars.networking.addresses.gateway.ip;
2024-09-15 10:12:56 +01:00
in {
imports = [
# Create users for this host
../common/users/${user}
2024-07-20 12:38:57 +01:00
2024-09-15 10:12:56 +01:00
# Disk configuration
inputs.disko.nixosModules.disko
(import ../common/disks {
device = dev;
impermanence = impermanence;
fsType = fsType;
encrypted = encrypted;
})
2024-07-20 12:38:57 +01:00
2024-09-15 10:12:56 +01:00
# Impermanence
(import ../common/disks/btrfs/impermanence.nix {
btrfsMountDevice = btrfsMountDevice;
lib = lib;
})
2024-07-20 12:38:57 +01:00
2024-09-15 10:12:56 +01:00
# Import core options
./hardware-configuration.nix
../common/core
2024-07-20 12:38:57 +01:00
2024-09-15 10:12:56 +01:00
# Import optional options
../common/optional/persistence.nix
../common/optional/pipewire.nix
../common/optional/openssh.nix
../common/optional/dwm.nix
../common/optional/nfs-mounts/media.nix
../common/optional/nfs-mounts/homeshare.nix
../common/optional/nfs-mounts/photos.nix
../common/optional/printing.nix
../common/optional/backlight.nix
../common/optional/xmodmap-arrow-remaps.nix
2024-10-19 13:33:51 +01:00
../common/optional/nix-ld.nix
2024-09-15 10:12:56 +01:00
];
2024-07-20 12:38:57 +01:00
boot = {
2024-09-15 10:12:56 +01:00
blacklistedKernelModules = ["snd_hda_intel" "snd_soc_skl"];
kernelModules = ["iwlwifi"];
initrd.kernelModules = ["thinkpad-acpi" "acpi-call"];
2024-07-20 12:38:57 +01:00
kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest;
2024-07-20 23:50:33 +01:00
extraModulePackages = [
config.boot.kernelPackages.acpi_call
];
2024-07-20 12:38:57 +01:00
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
timeout = 3;
};
};
2024-07-20 17:38:49 +01:00
services = {
libinput.touchpad.accelSpeed = "0.5";
xserver = {
xkb.options = "caps:swapescape";
dpi = 196;
upscaleDefaultCursor = true;
2024-10-14 16:57:01 +01:00
displayManager.sessionCommands = pkgs.writeShellScriptBin "key-remaps" ''
${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 64 = Mode_switch"
${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 43 = h H Left H"
${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 44 = j J Down J"
${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 45 = k K Up K"
${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 46 = l L Right L"
'';
2024-07-20 17:38:49 +01:00
};
};
environment.variables = {
GDK_SCALE = "2.2";
GDK_DPI_SCALE = "0.8";
_JAVA_OPTIONS = "-Dsun.java2d.uiScale=2.2";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
XCURSOR_SIZE = "64";
};
2024-10-23 19:06:08 +01:00
# services.tlp = {
# enable = true;
# settings = {
# CPU_SCALING_GOVERNOR_ON_AC = "ondemand";
# CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
#
# START_CHARGE_THRESH_BAT0 = 50;
# STOP_CHARGE_THRESH_BAT0 = 95;
# };
# };
2024-07-20 23:51:10 +01:00
hardware = {
2024-07-20 23:51:40 +01:00
bluetooth = {
enable = true;
powerOnBoot = true;
};
enableRedistributableFirmware = true;
firmware = [
pkgs.sof-firmware
];
};
2024-07-20 12:38:57 +01:00
networking = {
hostName = "citadel";
networkmanager.enable = true;
enableIPv6 = false;
nameservers = ["${pieholeIp}" "${gatewayIp}" "8.8.8.8"];
2024-07-20 12:38:57 +01:00
};
services.libinput.enable = true;
}