Add the x220 host

I don't have the time to split this commit
This commit is contained in:
caem 2024-10-30 15:32:07 +01:00
parent c0e985d51c
commit d8ce89bd77
Signed by: caem
GPG key ID: 69A830D03203405F
10 changed files with 539 additions and 217 deletions

75
hosts/x220/default.nix Normal file
View file

@ -0,0 +1,75 @@
{ pkgs, ... }:
{
imports = [
./hardware-configuration.nix
./persist.nix
../../home/default.nix
../../modules/desktop/environments/river.nix
../../modules/system/basic.nix
../../modules/system/security.nix
../../modules/desktop/apps/communication.nix
../../modules/desktop/apps/multimedia.nix
../../modules/system/development.nix
../../modules/packages/firefox.nix
../../modules/packages/zsh.nix
../../modules/packages/fastfetch.nix
];
boot = {
loader.grub = {
enable = true;
device = "/dev/sda";
gfxmodeEfi = "1366x768";
};
kernelPackages = pkgs.linuxPackages_xanmod_latest;
supportedFilesystems = [ "btrfs" ];
};
networking = {
hostName = "x220";
networkmanager.enable = true;
};
users.users.hu.extraGroups = [ "networkmanager" ];
time.timeZone = "Europe/Berlin";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "de";
# useXkbConfig = true;
};
nixpkgs.config.allowUnfree = true;
programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
jack.enable = true;
};
services.tlp.enable = true;
nix = {
extraOptions = ''
experimental-features = nix-command flakes
'';
};
system.stateVersion = "24.05";
}

View file

@ -0,0 +1,61 @@
{ config, lib, modulesPath, ... }:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
fileSystems."/" = {
device = "/dev/disk/by-uuid/e0b531cf-b575-4579-b866-9b7265e01b0a";
fsType = "btrfs";
options = [ "subvol=root" "compress=zstd" "noatime" "ssd" ];
};
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/e0b531cf-b575-4579-b866-9b7265e01b0a";
fsType = "btrfs";
options = [ "subvol=nix" "compress=zstd" "noatime" "ssd" ];
neededForBoot = true;
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/bfe6e556-44e9-427f-9ae6-eddae6c62298";
fsType = "ext4";
};
boot.initrd.luks.devices."vg".device = "/dev/disk/by-uuid/92b4f484-2c00-47e7-baf6-9f396883e231";
boot.initrd.availableKernelModules = [
"ehci_pci" "ahci" "xhci_pci" "usb_storage" "sd_mod" "sdhci_pci"
];
boot.kernelModules = [ "kvm-intel" ];
boot.initrd.postDeviceCommands = lib.mkAfter ''
mkdir /btrfs_tmp
mount ${config.fileSystems."/".device} /btrfs_tmp
if [[ -e /btrfs_tmp/root ]]; then
mkdir -p /btrfs_tmp/old_roots
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
fi
delete_subvolume_recursively() {
IFS=$'\n'
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
delete_subvolume_recursively "/btrfs_tmp/$i"
done
btrfs subvolume delete "$1"
}
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
delete_subvolume_recursively "$i"
done
btrfs subvolume create /btrfs_tmp/root
umount /btrfs_tmp
'';
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

23
hosts/x220/persist.nix Normal file
View file

@ -0,0 +1,23 @@
{ ... }:
{
environment.persistence."/nix/persist" = {
hideMounts = true;
directories = [
"/var/log"
"/var/lib/nixos"
"/var/lib/systemd/coredump"
{
directory = "/var/lib/colord";
user = "colord";
group = "colord";
mode = "u=rwx,g=rx,o=";
}
"/etc/NetworkManager/system-connections"
];
files = [
"/etc/machine-id"
];
};
}