Place the following in /etc/nixos/configuration.nix:
security.sudo.extraRules = [{ users = [ "jas" ]; commands = [{ command = "ALL"; options = [ "SETENV" "NOPASSWD" ]; }]; }];
nix = { * Automate `nix-store --optimize` autoOptimiseStore = true; * Automate garbage collection gc = { automatic = true; dates = "weekly"; options = "--delete-older-than 7d"; }; trustedUsers = [ "root" "jas" ]; extraOptions = '' keep-outputs = true keep-derivations = true ''; };
boot.extraModprobeConfig = "options snd-hda-intel probe_mask=1";
fileSystems."/home/jas/tmp" = { device = "tmpfs"; fsType = "tmpfs"; options = [ "nodev" "nosuid" "uid=1000" "gid=1000" "size=10G" "noexec" "mode=1700" ]; };
environment.etc."resolv.conf" = with lib; with pkgs; { source = writeText "resolv.conf" '' ${concatStringsSep "\n" (map (ns: "nameserver ${ns}") config.networking.nameservers)} options edns0 ''; };
services.xserver.videoDrivers = [ "nvidia" ]; hardware.nvidia = { prime.intelBusId = "PCI:0:2:0"; prime.nvidiaBusId = "PCI:1:0:0"; prime.sync.enable = true; modesetting.enable = true; };
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 -a "$0" "$@" ''; in { environment.systemPackages = [ nvidia-offload ]; services.xserver.videoDrivers = [ "nvidia" ]; hardware.nvidia.modesetting.enable = true; hardware.nvidia.prime = { offload.enable = true; intelBusId = "PCI:0:2:0"; nvidiaBusId = "PCI:1:0:0"; }; }