From 9c56503ed091a9b12c991f42d231ea9344ac1f46 Mon Sep 17 00:00:00 2001 From: Martin Benonisen Date: Sun, 21 Apr 2024 06:49:09 +0200 Subject: [PATCH] plz --- flake.lock | 77 ++++++++++++++++++++------- flake.nix | 27 +++++----- hosts/zedd/configuration.nix | 20 ++++++- hosts/zedd/hardware-configuration.nix | 2 - system/hardware.nix | 30 ++++++----- system/programs.nix | 35 +++++++----- system/services.nix | 16 +++--- user/default.nix | 1 + user/packages/default.nix | 26 ++++----- user/programs/games/default.nix | 10 ++++ user/zsh/default.nix | 2 +- 11 files changed, 163 insertions(+), 83 deletions(-) create mode 100644 user/programs/games/default.nix diff --git a/flake.lock b/flake.lock index 480aabb..2cfe2ef 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712014858, + "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -7,32 +27,52 @@ ] }, "locked": { - "lastModified": 1706981411, - "narHash": "sha256-cLbLPTL1CDmETVh4p0nQtvoF+FSEjsnJTFpTxhXywhQ=", + "lastModified": 1713566308, + "narHash": "sha256-7Y91t8pheIzjJveUMAPyeh5NOq5F49Nq4Hl2532QpJs=", "owner": "nix-community", "repo": "home-manager", - "rev": "652fda4ca6dafeb090943422c34ae9145787af37", + "rev": "057117a401a34259c9615ce62218aea7afdee4d3", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-23.11", "repo": "home-manager", "type": "github" } }, + "nix-gaming": { + "inputs": { + "flake-parts": [ + "flake-parts" + ], + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1713662031, + "narHash": "sha256-z6BbpvY2QcqDaJnJFBi3BLVwzy5aWZT3nnqzzu/sXD0=", + "owner": "fufexan", + "repo": "nix-gaming", + "rev": "f37fff222a3abf4deebf7d9388c23da8fc4325c6", + "type": "github" + }, + "original": { + "owner": "fufexan", + "repo": "nix-gaming", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1710695816, - "narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=", - "owner": "nixos", + "lastModified": 1713596654, + "narHash": "sha256-LJbHQQ5aX1LVth2ST+Kkse/DRzgxlVhTL1rxthvyhZc=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "614b4613980a522ba49f0d194531beddbb7220d3", + "rev": "fd16bb6d3bcca96039b11aa52038fafeb6e4f4be", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-23.11", + "owner": "NixOS", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } @@ -53,13 +93,13 @@ "type": "github" } }, - "nixpkgs-unstable": { + "nixpkgs_2": { "locked": { - "lastModified": 1710631334, - "narHash": "sha256-rL5LSYd85kplL5othxK5lmAtjyMOBg390sGBTb3LRMM=", + "lastModified": 1713537308, + "narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c75037bbf9093a2acb617804ee46320d6d1fea5a", + "rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f", "type": "github" }, "original": { @@ -69,7 +109,7 @@ "type": "github" } }, - "nixpkgs_2": { + "nixpkgs_3": { "locked": { "lastModified": 1710534455, "narHash": "sha256-huQT4Xs0y4EeFKn2BTBVYgEwJSv8SDlm82uWgMnCMmI=", @@ -87,15 +127,16 @@ }, "root": { "inputs": { + "flake-parts": "flake-parts", "home-manager": "home-manager", - "nixpkgs": "nixpkgs", - "nixpkgs-unstable": "nixpkgs-unstable", + "nix-gaming": "nix-gaming", + "nixpkgs": "nixpkgs_2", "sops-nix": "sops-nix" } }, "sops-nix": { "inputs": { - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "nixpkgs-stable": "nixpkgs-stable" }, "locked": { diff --git a/flake.nix b/flake.nix index a311f69..688a966 100644 --- a/flake.nix +++ b/flake.nix @@ -3,31 +3,32 @@ inputs = { # nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; - nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-23.11"; - nixpkgs-unstable.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; home-manager = { - url = "github:nix-community/home-manager?ref=release-23.11"; + url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; sops-nix.url = "github:Mic92/sops-nix"; + flake-parts = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs-lib.follows = "nixpkgs"; + }; + nix-gaming = { + url = "github:fufexan/nix-gaming"; + inputs.flake-parts.follows = "flake-parts"; + }; + }; outputs = { self , nixpkgs - , nixpkgs-unstable , sops-nix , ... }@inputs: let system = "x86_64-linux"; user = "mbeno"; - overlay-unstable = final: prev: { - unstable = import nixpkgs-unstable { - inherit system; - config.allowUnfree = true; - }; - }; in { nixosConfigurations = { @@ -35,11 +36,7 @@ inherit system; specialArgs = { inherit inputs self user sops-nix; }; modules = [ - ({ config, pkgs, ... }: { - nixpkgs.overlays = [ - overlay-unstable - ]; - }) + ({ config, pkgs, ... }: { }) ./hosts/zedd sops-nix.nixosModules.sops ]; diff --git a/hosts/zedd/configuration.nix b/hosts/zedd/configuration.nix index 11aeae7..0cabef1 100644 --- a/hosts/zedd/configuration.nix +++ b/hosts/zedd/configuration.nix @@ -7,6 +7,17 @@ # Bootloader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; + boot = { + extraModulePackages = with config.boot.kernelPackages; [ acpi_call ]; + kernelModules = [ "acpi_call" ]; + kernelPackages = pkgs.linuxPackages_xanmod_latest; + }; + boot.kernel.sysctl = { + "vm.max_map_count" = 16777216; + "fs.file-max" = 524288; + }; + + networking.hostName = "zedd"; # Define your hostname. networking.networkmanager.enable = true; @@ -21,6 +32,10 @@ XDG_BIN_HOME = "$HOME/.local/bin"; PATH = [ "${XDG_BIN_HOME}" ]; }; + fileSystems."/data" = { + device = "/dev/data/data"; + fsType = "ext4"; + }; xdg.portal = { enable = true; @@ -42,7 +57,10 @@ # Allow unfree packages nixpkgs.config.allowUnfree = true; nix.settings.experimental-features = [ "nix-command" "flakes" ]; - + nix.settings = { + substituters = [ "https://nix-gaming.cachix.org" ]; + trusted-public-keys = [ "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" ]; + }; virtualisation.docker.enable = true; system.stateVersion = "23.11"; # Did you read the comment? diff --git a/hosts/zedd/hardware-configuration.nix b/hosts/zedd/hardware-configuration.nix index c8ab28f..da0b2c0 100644 --- a/hosts/zedd/hardware-configuration.nix +++ b/hosts/zedd/hardware-configuration.nix @@ -26,8 +26,6 @@ fsType = "vfat"; }; - swapDevices = - [{ device = "/dev/disk/by-uuid/796cc9db-33c0-446e-8be6-02ae63461c19"; }]; # 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 diff --git a/system/hardware.nix b/system/hardware.nix index 7332a07..a7bed51 100644 --- a/system/hardware.nix +++ b/system/hardware.nix @@ -1,18 +1,20 @@ { config, pkgs, ... }: { - hardware.opengl = { - enable = true; - driSupport = true; - driSupport32Bit = true; + hardware = { + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + ckb-next.enable = true; + nvidia = { + modesetting.enable = true; + powerManagement.enable = false; + powerManagement.finegrained = false; + open = false; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + pulseaudio.enable = false; }; - hardware.ckb-next.enable = true; - hardware.nvidia = { - modesetting.enable = true; - powerManagement.enable = false; - powerManagement.finegrained = false; - open = false; - nvidiaSettings = true; - package = config.boot.kernelPackages.nvidiaPackages.stable; - }; - hardware.pulseaudio.enable = false; } diff --git a/system/programs.nix b/system/programs.nix index dda63e1..5c285c1 100644 --- a/system/programs.nix +++ b/system/programs.nix @@ -1,25 +1,34 @@ { config, pkgs, ... }: { - programs.steam = { enable = true; - gamescopeSession.enable = true; - remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play - dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server - }; - nixpkgs.config.packageOverrides = pkgs: { - steam = pkgs.steam.override { - extraPkgs = pkgs: with pkgs; [ - gamescope - mangohud - ]; + + extraCompatPackages = [ + pkgs.proton-ge-bin + ]; + + # fix gamescope inside steam + package = pkgs.steam.override { + extraPkgs = pkgs: + with pkgs; [ + keyutils + libkrb5 + libpng + libpulseaudio + libvorbis + stdenv.cc.cc.lib + xorg.libXcursor + xorg.libXi + xorg.libXinerama + xorg.libXScrnSaver + ]; }; }; programs.thunar.enable = true; programs.gnupg.agent = { enable = true; - pinentryFlavor = "curses"; enableSSHSupport = true; }; + programs.gamemode.enable = true; boot.binfmt.registrations.appimage = { wrapInterpreterInShell = false; interpreter = "${pkgs.appimage-run}/bin/appimage-run"; @@ -33,7 +42,7 @@ pass xdg-desktop-portal xdg-desktop-portal-gtk - unstable.zoom-us + zoom-us neovim git gnupg diff --git a/system/services.nix b/system/services.nix index a9fef01..801c6e4 100644 --- a/system/services.nix +++ b/system/services.nix @@ -5,19 +5,21 @@ networking.firewall.enable = false; security.polkit.enable = true; services = { + displayManager = + { + defaultSession = "none+i3"; + autoLogin.enable = true; + autoLogin.user = "mbeno"; + + }; xserver = { enable = true; - layout = "us"; - xkbVariant = ""; + xkb.layout = "us"; + xkb.variant = ""; desktopManager = { xterm.enable = false; }; videoDrivers = [ "nvidia" ]; - displayManager = { - defaultSession = "none+i3"; - autoLogin.enable = true; - autoLogin.user = "mbeno"; - }; windowManager.i3 = { enable = true; diff --git a/user/default.nix b/user/default.nix index aa29932..a1ffdb4 100644 --- a/user/default.nix +++ b/user/default.nix @@ -15,6 +15,7 @@ ./programs/rofi ./programs/obs-studio ./programs/vscode + ./programs/games ./scripts ./zsh ./packages diff --git a/user/packages/default.nix b/user/packages/default.nix index 821259c..001c585 100644 --- a/user/packages/default.nix +++ b/user/packages/default.nix @@ -4,7 +4,7 @@ age discord alacritty - unstable.btop + btop bzip2 croc easyeffects @@ -32,22 +32,24 @@ spotify spicetify-cli sshfs - unstable.ventoy + ventoy expect - # k8s tools - unstable.talosctl - unstable.k9s - unstable.cilium-cli - unstable.kubernetes-helm - unstable.cmctl - unstable.krew + talosctl + k9s + cilium-cli + kubernetes-helm + cmctl + krew + gnome.zenity + protontricks + winetricks tokei unzip yt-dlp - unstable.zoom-us - unstable.vmware-horizon-client + zoom-us + vmware-horizon-client # Editors # vscode @@ -63,7 +65,7 @@ typescript # Py stuff - (unstable.python312.withPackages (p: with p; [ + (python312.withPackages (p: with p; [ requests mypy pydantic diff --git a/user/programs/games/default.nix b/user/programs/games/default.nix new file mode 100644 index 0000000..7b1e9df --- /dev/null +++ b/user/programs/games/default.nix @@ -0,0 +1,10 @@ +{ pkgs +, inputs +, ... +}: +# games +{ + home.packages = [ + inputs.nix-gaming.packages.${pkgs.system}.star-citizen + ]; +} diff --git a/user/zsh/default.nix b/user/zsh/default.nix index 79644ef..d0ed5b7 100644 --- a/user/zsh/default.nix +++ b/user/zsh/default.nix @@ -3,7 +3,7 @@ programs.zsh = { enable = true; autocd = false; - enableAutosuggestions = true; + autosuggestion.enable = true; enableCompletion = true; syntaxHighlighting.enable = true; shellAliases = {