diff --git a/nixos/common/default.nix b/nixos/common/default.nix index 215ad9b..ea519ef 100644 --- a/nixos/common/default.nix +++ b/nixos/common/default.nix @@ -12,7 +12,7 @@ boot.cleanTmpDir = true; # Set your time zone. - time.timeZone = "Europe/Amsterdam"; + time.timeZone = lib.mkDefault "Europe/Amsterdam"; # Nix Settings nix = { diff --git a/nixos/common/users/default.nix b/nixos/common/users/default.nix index eb13a7d..20a19bd 100644 --- a/nixos/common/users/default.nix +++ b/nixos/common/users/default.nix @@ -48,7 +48,7 @@ ]; # Make me admin - extraGroups = [ "systemd-journal" "wheel" ]; + extraGroups = [ "systemd-journal" "wheel" "networkmanager" ]; }; # Configure the root account diff --git a/nixos/hosts/other/null/configuration.nix b/nixos/hosts/other/null/configuration.nix index 88bd8b7..6972662 100644 --- a/nixos/hosts/other/null/configuration.nix +++ b/nixos/hosts/other/null/configuration.nix @@ -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. It‘s perfectly fine and recommended to leave diff --git a/nixos/hosts/other/null/hardware-configuration.nix b/nixos/hosts/other/null/hardware-configuration.nix index 2b68231..8b01aa8 100644 --- a/nixos/hosts/other/null/hardware-configuration.nix +++ b/nixos/hosts/other/null/hardware-configuration.nix @@ -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..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;