From a5a2c3396d06b431bc71a90e0e6e83e75af79db0 Mon Sep 17 00:00:00 2001 From: caem Date: Tue, 8 Apr 2025 21:30:40 +0200 Subject: [PATCH] x220: Add host Probably broken right now. --- hosts/x220/default.nix | 49 ++++++++++++++++ hosts/x220/disko.nix | 62 ++++++++++++++++++++ hosts/x220/packages.nix | 17 ++++++ modules/nixos/hardware/cpu/intel/default.nix | 10 ++++ 4 files changed, 138 insertions(+) create mode 100644 hosts/x220/default.nix create mode 100644 hosts/x220/disko.nix create mode 100644 hosts/x220/packages.nix create mode 100644 modules/nixos/hardware/cpu/intel/default.nix diff --git a/hosts/x220/default.nix b/hosts/x220/default.nix new file mode 100644 index 0000000..c202450 --- /dev/null +++ b/hosts/x220/default.nix @@ -0,0 +1,49 @@ +{ pkgs, lib, username, ... }: + +{ + imports = [ + ./disko.nix + ./packages.nix + ]; + + time.timeZone = "Europe/Berlin"; + + networking = { + hostName = "x220"; + useDHCP = lib.mkDefault true; + }; + + boot = { + loader = { + efi.canTouchEfiVariables = true; + grub = { + enable = true; + # device = "/dev/sda"; # [managed by install.sh] + gfxmodeEfi = "1366x768"; + }; + }; + + tmp.useTmpfs = true; + kernelPackages = pkgs.unstable.linuxPackages_xanmod_latest; + supportedFilesystems = [ "btfs" "vfat" "xfs" ]; + initrd = { + availableKernelModules = [ "ehci_pci" "ahci" "xhci_pci" + "usb_storage" "sd_mod" "sdhci_pci" ]; + }; + }; + + services = { + fstrim.enable = true; + btrfs.autoScrub.enable = true; + }; + + fileSystems = { + # These are system specific. If you have any additional drives that are not + # your root device you can add and mount them here. Added nofail so that you can + # install this configuration on a device without it exploding when you don't have + # these specific partitions. + }; + + system.stateVersion = "24.11"; # [managed by install.sh] { state version } +} + diff --git a/hosts/x220/disko.nix b/hosts/x220/disko.nix new file mode 100644 index 0000000..fe2391c --- /dev/null +++ b/hosts/x220/disko.nix @@ -0,0 +1,62 @@ +{ ... }: + +{ + disko.devices = { + disk = { + master = { + type = "disk"; + device = "/dev/sda1"; # [managed by install.sh] + content = { + type = "gpt"; + partitions = { + grub_mbr = { + size = "1M"; + type = "EF02"; + }; + boot = { + size = "1G"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/boot"; + mountOptions = [ + "umask=0077" + "noatime" + ]; + }; + }; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "crypted"; + content = { + type = "btrfs"; + extraArgs = [ "-f" "-L nixos" ]; + subvolumes = { + /* Do not rename the root partition as it'll break impermanence */ + "/root" = { + mountpoint = "/"; + mountOptions = [ + "noatime" + "compress=zstd" + ]; + }; + + "/nix" = { + mountpoint = "/nix"; + mountOptions = [ + "noatime" + "compress=zstd" + ]; + }; + }; + }; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/x220/packages.nix b/hosts/x220/packages.nix new file mode 100644 index 0000000..92a2db3 --- /dev/null +++ b/hosts/x220/packages.nix @@ -0,0 +1,17 @@ +{ ... }: + +{ + imports = let + modules = ../../modules/nixos; + in [ + "${modules}/core" + "${modules}/hardware/audio" + "${modules}/hardware/cpu/intel" + "${modules}/multimedia" + "${modules}/desktop/gnome" + "${modules}/communication" + "${modules}/development" + "${modules}/edv" + ]; +} + diff --git a/modules/nixos/hardware/cpu/intel/default.nix b/modules/nixos/hardware/cpu/intel/default.nix new file mode 100644 index 0000000..f0f1ad2 --- /dev/null +++ b/modules/nixos/hardware/cpu/intel/default.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: + +{ + boot = { + kernelModules = [ "kvm-intel"]; + }; + + hardware.cpu.intel.updateMicrocode = true; + hardware.firmware = with pkgs; [ linux-firmware ]; +}