From 9b47f133a260db798911ef4232d6257a420c6383 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Thu, 20 Jun 2024 18:13:27 +0200 Subject: [PATCH] init --- README.md | 16 +++++ configuration.nix | 116 +++++++++++++++++++++++++++++++++++++ flake.lock | 44 ++++++++++++++ flake.nix | 19 ++++++ hardware-configuration.nix | 38 ++++++++++++ 5 files changed, 233 insertions(+) create mode 100644 README.md create mode 100644 configuration.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hardware-configuration.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..70b0aab --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# nixosconfig + +Run game in Game mode with optimized system settings: +```bash +gamemoderun $command +``` + +Run game with resources HUD: +```bash +mangohud $command +``` + +Use Steam's gamescope to launch game: +```bash +gamescope $command +``` diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..0b916ef --- /dev/null +++ b/configuration.nix @@ -0,0 +1,116 @@ +# Edit this configuration file to define what should be installed on your system. Help is available in the configuration.nix(5) man page and in the +# NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "gamepc"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary networking.proxy.default = "http://user:password@proxy:port/"; networking.proxy.noProxy = + # "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Amsterdam"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { LC_ADDRESS = "nl_NL.UTF-8"; LC_IDENTIFICATION = "nl_NL.UTF-8"; LC_MEASUREMENT = "nl_NL.UTF-8"; LC_MONETARY = + "nl_NL.UTF-8"; LC_NAME = "nl_NL.UTF-8"; LC_NUMERIC = "nl_NL.UTF-8"; LC_PAPER = "nl_NL.UTF-8"; LC_TELEPHONE = "nl_NL.UTF-8"; LC_TIME = + "nl_NL.UTF-8"; + }; + + # Enable the X11 windowing system. + services.xserver = { + enable = true; + videoDrivers = [ "amdgpu" ]; + }; + + # Enable the KDE Plasma Desktop Environment. + services.displayManager.sddm.enable = true; + services.desktopManager.plasma6.enable = true; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound with pipewire. + sound.enable = true; hardware.pulseaudio.enable = false; security.rtkit.enable = true; services.pipewire = { + enable = true; alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; + # If you want to use JACK applications, uncomment this jack.enable = true; + + # use the example session manager (no others are packaged yet so this is enabled by default, no need to redefine it in your config for now) + #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.pim = { isNormalUser = true; description = "Pim Kunis"; extraGroups = [ "networkmanager" "wheel" ]; packages = with pkgs; [ + + ]; + }; + + # Install firefox. + programs.firefox.enable = true; + + programs.steam = { + enable = true; + gamescopeSession.enable = true; + }; + + programs.gamemode.enable = true; + + # 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 + vim + git + mangohud + protonup + lutris + bottles + transmission-qt + kate + unar + ]; + + environment.sessionVariables = { + STEAM_EXTRA_COMPAT_TOOLS_PATHS = "/home/pim/.steam/root/compatibilitytools.d"; + }; + + # 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 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 = "23.11"; # Did you read the comment? + + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..862c395 --- /dev/null +++ b/flake.lock @@ -0,0 +1,44 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1718086528, + "narHash": "sha256-hoB7B7oPgypePz16cKWawPfhVvMSXj4G/qLsfFuhFjw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "47b604b07d1e8146d5398b42d3306fdebd343986", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1717974879, + "narHash": "sha256-GTO3C88+5DX171F/gVS3Qga/hOs/eRMxPFpiHq2t+D8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c7b821ba2e1e635ba5a76d299af62821cbcb09f3", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..72dfa4a --- /dev/null +++ b/flake.nix @@ -0,0 +1,19 @@ +{ + description = "A very basic flake"; + inputs = { + nixpkgs-unstable.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + }; + + outputs = { self, nixpkgs, ... }@inputs: { + nixosConfigurations.gamepc = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + + specialArgs = { inherit inputs; }; + + modules = [ + ./configuration.nix + ]; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..95b7ec6 --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,38 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/98e7028a-c416-4a66-8309-222b08f73be4"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/AEFD-8878"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}