Skip to content

Commit

Permalink
feat(hosts: laptop): switch to lenovo T14
Browse files Browse the repository at this point in the history
  • Loading branch information
d4ilyrun committed Dec 18, 2023
1 parent 2f4cd31 commit ade700d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 52 deletions.
5 changes: 2 additions & 3 deletions config/laptop/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
hostName = "leo";
networkmanager.enable = true;
useDHCP = false;
interfaces.enp6s0f1.useDHCP = true;
interfaces.wlp0s20f3.useDHCP = true;
interfaces.enp1s0f0.useDHCP = true;
};

services.xserver = {
Expand Down Expand Up @@ -67,6 +66,6 @@
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "21.11"; # Did you read the comment?
system.stateVersion = "23.11"; # Did you read the comment?
}

4 changes: 2 additions & 2 deletions config/laptop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ in
{
dotfiles = {
extraOptions = {
network = "wlp0s20f3";
network = "wlp2s0";
monitor = {
inherit primary secondary;
};
Expand All @@ -31,7 +31,7 @@ in
services = {
lowbatt = {
enable = true;
device = "BAT1";
device = "BAT0";
notifyCapacity = 15;
};
};
Expand Down
83 changes: 36 additions & 47 deletions config/laptop/hardware-configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,52 @@
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

let
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
export __NV_PRIME_RENDER_OFFLOAD=1
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
exec "$@"
'';
in
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
../yaka/hardware-configuration.nix
];
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];

boot = {
initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
initrd.kernelModules = [ "nvidia-uvm" "nvidia" "nvidia_modeset" "nvidia_drm" ];
kernelParams = [ "nvidia-drm.modeset=1" ];
kernelModules = [ "kvm-intel" "nvidia-uvm" "nvidia" "nvidia_modeset" "nvidia_drm" ];
blacklistedKernelModules = [ "nouveau" ];
extraModulePackages = [ ];
};
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];

fileSystems = {
"/" = {
device = "/dev/disk/by-label/nixos";
fileSystems."/" =
{ device = "/dev/dm-3";
fsType = "ext4";
};

"/boot" = {
device = "/dev/disk/by-label/BOOT";
fsType = "vfat";
fileSystems."/nix" =
{ device = "/dev/dm-1";
fsType = "ext4";
};
};
swapDevices = [
{ device = "/dev/disk/by-label/swap"; }
];

powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/12CE-A600";
fsType = "vfat";
};

# NVIDIA STUFF
fileSystems."/home" =
{ device = "/dev/dm-2";
fsType = "ext4";
};

environment.systemPackages = [ nvidia-offload ];
services.xserver.videoDrivers = [ "nvidia" ];

hardware = {
opengl = {
enable = true;
};
nvidia = {
modesetting.enable = true;
prime = {
sync.enable = true;
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
boot.initrd.luks.devices."acu" = {
device = "/dev/nvme0n1p2";
preLVM = true;
};

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.enp1s0f0.useDHCP = lib.mkDefault true;
networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true;

nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

0 comments on commit ade700d

Please sign in to comment.