Unified home and system modules!

This commit is contained in:
marc
2022-11-19 11:58:21 +01:00
parent cfcc374a69
commit 890b05d352
45 changed files with 389 additions and 566 deletions

View File

@@ -0,0 +1,50 @@
{ config, pkgs, lib, ... }:
{
imports = [
./hardware.nix
./nvidia.nix
];
# - Basic --------------------------------------
user.name = "marc";
user.shell = pkgs.zsh;
networking.hostName = "reykjavik";
# - Bootloader ---------------------------------
boot.loader.systemd-boot.enable = true;
# - Modules ------------------------------------
samfelag.modules = {
# - Common -----------------------------------
# See modules/common.nix for common packages installed
# - System -----------------------------------
system.bluetooth.enable = true;
# - Desktop ----------------------------------
desktop = {
enable = true;
laptop = true;
};
# - Editors and development ------------------
editors.emacs.enable = true;
dev.git.userName = "marc";
dev.git.userEmail = "marc@sastre.cat";
# - Other apps -------------------------------
app.spotify.enable = true;
# - Gaming -----------------------------------
gaming.lutris.enable = true;
gaming.steam.enable = true;
app.discord.enable = true;
};
}

View File

@@ -0,0 +1,41 @@
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot = {
initrd = {
availableKernelModules = [ "xhci_pci" "thunderbolt" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ];
kernelModules = [ ];
};
kernelModules = [ "kvm-intel" ];
extraModulePackages = [ ];
};
fileSystems = {
"/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
};
"/boot" = {
device = "/dev/disk/by-label/BOOT";
fsType = "vfat";
};
};
swapDevices = [
{ device = "/dev/disk/by-label/swap"; }
];
networking = {
useDHCP = lib.mkDefault true;
interfaces = {
enp92s0.useDHCP = lib.mkDefault true;
wlp0s20f3.useDHCP = lib.mkDefault true;
};
};
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -0,0 +1,29 @@
{ 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
{
environment.systemPackages = [ nvidia-offload ];
services.xserver.videoDrivers = [ "nvidia" ];
hardware.opengl.enable = true;
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
hardware.nvidia.prime = {
offload.enable = true;
# Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA
intelBusId = "PCI:0:2:0";
# Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA
nvidiaBusId = "PCI:1:0:0";
};
}

View File

@@ -0,0 +1,2 @@
* Reykjavik
Portàtil Lenovo Legion 5 15ITH6H