more laptop config

This commit is contained in:
Vivian 2022-08-20 12:16:29 +02:00
parent 1411cbb4a4
commit ddaf32e68a
4 changed files with 37 additions and 47 deletions

View file

@ -12,7 +12,7 @@
boot.cleanTmpDir = true;
# Set your time zone.
time.timeZone = "Europe/Amsterdam";
time.timeZone = lib.mkDefault "Europe/Amsterdam";
# Nix Settings
nix = {

View file

@ -48,7 +48,7 @@
];
# Make me admin
extraGroups = [ "systemd-journal" "wheel" ];
extraGroups = [ "systemd-journal" "wheel" "networkmanager" ];
};
# Configure the root account

View file

@ -3,10 +3,19 @@
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
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 =
[ # Include the results of the hardware scan.
[
# Include the results of the hardware scan.
./hardware-configuration.nix
];
@ -18,9 +27,6 @@
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Amsterdam";
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.utf8";
@ -47,6 +53,26 @@
services.xserver = {
layout = "us";
xkbVariant = "altgr-intl";
xkbOptions = "caps:swapescape";
videoDrivers = [ "nvidia" ];
};
# modesetting
# hardware.nvidia.modesetting.enable = true;
hardware.nvidia.prime = {
offload.enable = true;
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
specialisation = {
external-display.configuration = {
system.nixos.tags = [ "external-display" ];
hardware.nvidia.prime.offload.enable = lib.mkForce false;
hardware.nvidia.powerManagement.enable = lib.mkForce false;
};
};
# Enable CUPS to print documents.
@ -69,48 +95,12 @@
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.v = {
isNormalUser = true;
description = "v";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
firefox
];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
pciutils
nvidia-offload
vim
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave

View file

@ -31,7 +31,7 @@
# 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.wlp0s20f3.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;