Finally on thinkpad

This commit is contained in:
Andrea Ciceri 2022-08-05 21:02:53 +02:00
parent 55ead06206
commit 4dbc3df3a7
No known key found for this signature in database
GPG key ID: A1FC89532D1C5654
4 changed files with 125 additions and 47 deletions

View file

@ -5,47 +5,23 @@
fleetModules,
...
}: {
imports = fleetModules [
imports =
[
./zfs.nix
./hardware-configuration.nix
]
++ fleetModules [
"common"
"audio"
"ccr"
"exwm"
];
hardware.cpu.intel.updateMicrocode = true;
hardware.enableRedistributableFirmware = true;
boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [];
fileSystems."/" = {
device = "rpool/system/root";
fsType = "zfs";
};
fileSystems."/nix" = {
device = "rpool/system/nix";
fsType = "zfs";
};
fileSystems."/home" = {
device = "rpool/user/home";
fsType = "zfs";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/boot";
fsType = "vfat";
};
swapDevices = [
{device = "/dev/disk/by-uuid/3cab8a5d-602c-4e3d-b436-c0e5595aeb94";}
];
networking.hostId = "8ef630a9";
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
@ -53,16 +29,6 @@
#networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
#networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
boot.loader.grub = {
enable = true;
copyKernels = true;
efiSupport = true;
devices = ["nodev"];
efiInstallAsRemovable = true;
};
networking.hostName = "thinkpad"; # Define your hostname.
# Pick only one of the below networking options.
#networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
@ -117,6 +83,8 @@
wget
];
programs.light.enable = true;
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;

View file

@ -0,0 +1,73 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = [];
boot.extraModulePackages = [];
fileSystems."/" = {
device = "rpool/nixos/root";
fsType = "zfs";
options = ["zfsutil" "X-mount.mkdir"];
};
fileSystems."/home" = {
device = "rpool/nixos/home";
fsType = "zfs";
options = ["zfsutil" "X-mount.mkdir"];
};
fileSystems."/var/lib" = {
device = "rpool/nixos/var/lib";
fsType = "zfs";
options = ["zfsutil" "X-mount.mkdir"];
};
fileSystems."/var/log" = {
device = "rpool/nixos/var/log";
fsType = "zfs";
options = ["zfsutil" "X-mount.mkdir"];
};
fileSystems."/boot" = {
device = "bpool/nixos/root";
fsType = "zfs";
options = ["zfsutil" "X-mount.mkdir"];
};
fileSystems."/boot/efis/nvme-INTEL_SSDPEKKF010T8L_PHHP938405741P0D-part1" = {
device = "/dev/disk/by-uuid/5C39-390F";
fsType = "vfat";
};
fileSystems."/boot/efi" = {
device = "/boot/efis/nvme-INTEL_SSDPEKKF010T8L_PHHP938405741P0D-part1";
fsType = "none";
options = ["bind"];
};
swapDevices = [];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

37
hosts/thinkpad/zfs.nix Normal file
View file

@ -0,0 +1,37 @@
{
config,
pkgs,
...
}: {
boot.supportedFilesystems = ["zfs"];
networking.hostId = "adf0b5e7";
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
boot.loader.efi.canTouchEfiVariables = false;
boot.loader.generationsDir.copyKernels = true;
boot.loader.grub.efiInstallAsRemovable = true;
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.copyKernels = true;
boot.loader.grub.efiSupport = true;
boot.loader.grub.zfsSupport = true;
boot.loader.grub.extraPrepareConfig = ''
mkdir -p /boot/efis
for i in /boot/efis/*; do mount $i ; done
mkdir -p /boot/efi
mount /boot/efi
'';
boot.loader.grub.extraInstallCommands = ''
ESP_MIRROR=$(mktemp -d)
cp -r /boot/efi/EFI $ESP_MIRROR
for i in /boot/efis/*; do
cp -r $ESP_MIRROR/EFI $i
done
rm -rf $ESP_MIRROR
'';
boot.loader.grub.devices = [
"/dev/disk/by-id/nvme-INTEL_SSDPEKKF010T8L_PHHP938405741P0D"
];
users.users.root.initialHashedPassword = "$6$EqXfyFLxUZfpmJ8F$UH3pLcHwgLpOZwiSDhdq/iR/p.uyZZYlk6G4Q0S8BtYr3Qt2xKU56Fwv3Mgco.J0i3cx1Nm8XMfvythSuv8gh/";
}

View file

@ -45,8 +45,8 @@
};
mkConfigurations = {
pc = mkConfiguration {
name = "pc";
thinkpad = mkConfiguration {
name = "thinkpad";
system = supportedSystems.x86_64-linux;
modules = [];
};