diff --git a/flake.lock b/flake.lock index 3a4f6f6..e35a8a7 100644 --- a/flake.lock +++ b/flake.lock @@ -22,6 +22,29 @@ "type": "github" } }, + "chaotic": { + "inputs": { + "flake-schemas": "flake-schemas", + "home-manager": "home-manager", + "jovian": "jovian", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1761265276, + "narHash": "sha256-ZngDL68RZbT1RUX/m+h8y5zfXJdnydRKjf3oZTfwam0=", + "owner": "chaotic-cx", + "repo": "nyx", + "rev": "5df2883e9401fd257e39285819996203628f3f0e", + "type": "github" + }, + "original": { + "owner": "chaotic-cx", + "ref": "nyxpkgs-unstable", + "repo": "nyx", + "type": "github" + } + }, "darwin": { "inputs": { "nixpkgs": [ @@ -58,20 +81,18 @@ "type": "github" } }, - "flake-compat_2": { - "flake": false, + "flake-schemas": { "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "type": "github" + "lastModified": 1721999734, + "narHash": "sha256-G5CxYeJVm4lcEtaO87LKzOsVnWeTcHGKbKxNamNWgOw=", + "rev": "0a5c42297d870156d9c57d8f99e476b738dcd982", + "revCount": 75, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.5/0190ef2f-61e0-794b-ba14-e82f225e55e6/source.tar.gz" }, "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%3D0.1.5.tar.gz" } }, "flake-utils": { @@ -92,24 +113,6 @@ "type": "github" } }, - "flake-utils_2": { - "inputs": { - "systems": "systems_3" - }, - "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "ghostty": { "inputs": { "flake-compat": "flake-compat", @@ -137,6 +140,7 @@ "home-manager": { "inputs": { "nixpkgs": [ + "chaotic", "nixpkgs" ] }, @@ -154,6 +158,48 @@ "type": "github" } }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1761081701, + "narHash": "sha256-IwpfaKg5c/WWQiy8b5QGaVPMvoEQ2J6kpwRFdpVpBNQ=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "9b4a2a7c4fbd75b422f00794af02d6edb4d9d315", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "jovian": { + "inputs": { + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1761045626, + "narHash": "sha256-N0OyyLp7VIYUdrtLSPt6y40q3+wAAeJWRwAtrKtHYtU=", + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "rev": "493f3428943605a9a34494cfcba32cd21633752f", + "type": "github" + }, + "original": { + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "type": "github" + } + }, "nix-ai-tools": { "inputs": { "blueprint": "blueprint", @@ -176,7 +222,46 @@ "type": "github" } }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "chaotic", + "jovian", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729697500, + "narHash": "sha256-VFTWrbzDlZyFHHb1AlKRiD/qqCJIripXKiCSFS8fAOY=", + "owner": "zhaofengli", + "repo": "nix-github-actions", + "rev": "e418aeb728b6aa5ca8c5c71974e7159c2df1d8cf", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "ref": "matrix-name", + "repo": "nix-github-actions", + "type": "github" + } + }, "nixpkgs": { + "locked": { + "lastModified": 1761114652, + "narHash": "sha256-f/QCJM/YhrV/lavyCVz8iU3rlZun6d+dAiC3H+CDle4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "01f116e4df6a15f4ccdffb1bcd41096869fb385c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1758360447, "narHash": "sha256-XDY3A83bclygHDtesRoaRTafUd80Q30D/Daf9KSG6bs=", @@ -189,7 +274,7 @@ "url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz" } }, - "nixpkgs_2": { + "nixpkgs_3": { "locked": { "lastModified": 1760878510, "narHash": "sha256-K5Osef2qexezUfs0alLvZ7nQFTGS9DL2oTVsIXsqLgs=", @@ -207,14 +292,36 @@ }, "root": { "inputs": { + "chaotic": "chaotic", "darwin": "darwin", "ghostty": "ghostty", - "home-manager": "home-manager", + "home-manager": "home-manager_2", "nix-ai-tools": "nix-ai-tools", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "sops-nix": "sops-nix" } }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1761100675, + "narHash": "sha256-LX3TCDBeNpCWTDXtGyRASVcLmRPChSli34bgHnZ1DCw=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "72161c6c53f6e3f8dadaf54b2204a5094c6a16ae", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "sops-nix": { "inputs": { "nixpkgs": [ @@ -265,21 +372,6 @@ "type": "github" } }, - "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "treefmt-nix": { "inputs": { "nixpkgs": [ @@ -332,7 +424,7 @@ }, "zon2nix": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1758405547, diff --git a/flake.nix b/flake.nix index 4284dd9..166a2ad 100644 --- a/flake.nix +++ b/flake.nix @@ -17,10 +17,12 @@ sops-nix.url = "github:Mic92/sops-nix"; sops-nix.inputs.nixpkgs.follows = "nixpkgs"; + + chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable"; }; outputs = inputs@{ self, nixpkgs, darwin, home-manager, ghostty, nix-ai-tools - , sops-nix, ... }: + , sops-nix, chaotic, ... }: let inherit (nixpkgs.lib) genAttrs; lib = nixpkgs.lib; @@ -31,7 +33,7 @@ forEachSystem = f: genAttrs systems (system: f system); - overlaysList = [ ghostty.overlays.default ]; + overlaysList = [ ghostty.overlays.default chaotic.overlays.default ]; mkPkgs = system: import nixpkgs { @@ -41,12 +43,13 @@ }; sharedDarwinModules = [ ./modules/darwin/system.nix ]; - sharedNixosModules = [ ./modules/nixos/system.nix ]; + sharedNixosModules = + [ ./modules/nixos/system.nix chaotic.nixosModules.default ]; user = "rasyidanakbar"; mkDarwin = { system ? "aarch64-darwin", extraModules ? [ ] - , homeFile ? ./modules/darwin/home/default.nix }: + , homeFile ? ./modules/darwin/home/default.nix, }: let pkgs = mkPkgs system; in darwin.lib.darwinSystem { inherit system pkgs; @@ -66,7 +69,7 @@ ]; }; mkNixos = { system ? "x86_64-linux", extraModules ? [ ] - , homeFile ? ./modules/nixos/home/default.nix }: + , homeFile ? ./modules/nixos/home/default.nix, }: let pkgs = mkPkgs system; in lib.nixosSystem { inherit system pkgs; @@ -91,6 +94,11 @@ system = "x86_64-linux"; extraModules = [ ./modules/nixos/hosts/dev-vm.nix ]; }; + desktop = mkNixos { + system = "x86_64-linux"; + extraModules = [ ./modules/nixos/hosts/desktop.nix ]; + homeFile = ./modules/nixos/home/desktop.nix; + }; }; devShells = forEachSystem (system: diff --git a/modules/nixos/desktop/gaming.nix b/modules/nixos/desktop/gaming.nix new file mode 100644 index 0000000..dc9ec24 --- /dev/null +++ b/modules/nixos/desktop/gaming.nix @@ -0,0 +1,76 @@ +{ pkgs, ... }: { + # Gaming configuration module + # Steam, Proton, Vulkan, Wine, and gaming optimizations + + # Steam with Proton support + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + + # Enable Proton compatibility layer + extraCompatPackages = with pkgs; + [ + proton-ge-bin # GloriousEggroll's Proton builds + ]; + }; + + # GameMode for performance optimization + programs.gamemode = { + enable = true; + settings = { + general = { renice = 10; }; + custom = { + start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'"; + end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'"; + }; + }; + }; + + # Enable 32-bit graphics support for games + hardware.graphics = { + enable = true; + enable32Bit = true; + }; + + # Gaming-related packages + environment.systemPackages = with pkgs; [ + # Game launchers + lutris + heroic # Epic Games, GOG launcher + # bottles # Windows app manager + + # Wine for Windows games + wineWowPackages.stable # Both 32 and 64-bit Wine + winetricks + + # Performance monitoring + mangohud # FPS overlay and performance metrics + # gamescope # Gaming compositor/micro-compositor + + # Proton utilities + # protonup-qt # Manage Proton versions + protontricks # Winetricks for Proton games + + # Communication + discord + # teamspeak_client + + # Other gaming tools + # steam-run # Run non-Steam games in Steam runtime + ]; + + # Vulkan support + environment.variables = { + # Enable Vulkan validation layers for debugging (optional) + # VK_LAYER_PATH = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d"; + }; + + # Kernel parameters for gaming performance (optional, adjust as needed) + # boot.kernelParams = [ + # "mitigations=off" # Disable CPU mitigations for performance (less secure) + # ]; + + # Increase file watchers for game modding tools + boot.kernel.sysctl = { "fs.inotify.max_user_watches" = 524288; }; +} diff --git a/modules/nixos/hosts/desktop-dev.nix b/modules/nixos/hosts/desktop-dev.nix deleted file mode 100644 index e27c9f0..0000000 --- a/modules/nixos/hosts/desktop-dev.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ pkgs, ... }: { - # Example desktop development workstation configuration - # Copy and modify for your actual hardware - - # Boot configuration (adjust for your system) - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - # Hostname - networking.hostName = "desktop-dev"; - - # Import desktop environment (choose one) - imports = [ - ../desktops/hyprland.nix - # ../desktops/plasma.nix - # ../desktops/niri.nix - ]; - - # Hardware-specific settings (adjust for your hardware) - # boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" ]; - - # GPU drivers (uncomment if using NVIDIA) - # services.xserver.videoDrivers = [ "nvidia" ]; - # hardware.nvidia = { - # modesetting.enable = true; - # open = false; # Use proprietary driver - # }; - - # Optional: Enable bluetooth - # hardware.bluetooth.enable = true; - - # Development-specific packages - environment.systemPackages = with pkgs; - [ - # Add desktop dev tools here - # docker-compose - # k9s - ]; - - # This value determines the NixOS release compatibility - system.stateVersion = "24.05"; -} diff --git a/modules/nixos/hosts/desktop.nix b/modules/nixos/hosts/desktop.nix new file mode 100644 index 0000000..01d2d32 --- /dev/null +++ b/modules/nixos/hosts/desktop.nix @@ -0,0 +1,67 @@ +{ lib, pkgs, ... }: { + # Unified desktop configuration for gaming and development + # Includes both KDE Plasma and Hyprland - switch at login screen + + # Boot configuration with CachyOS LTS kernel + boot = { + loader.systemd-boot.enable = true; + loader.efi.canTouchEfiVariables = true; + kernelPackages = pkgs.linuxPackages_cachyos-lts; + # Hardware-specific settings (adjust for your hardware) + # initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" ]; + }; + + # Hostname + networking.hostName = "desktop"; + + # Root filesystem configuration (REQUIRED - adjust for your hardware) + # To generate proper config, run: nixos-generate-config --show-hardware-config + fileSystems."/" = lib.mkDefault { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + }; + + fileSystems."/boot" = lib.mkDefault { + device = "/dev/disk/by-label/boot"; + fsType = "vfat"; + }; + + # Swap configuration (optional, adjust as needed) + # swapDevices = [ { device = "/dev/disk/by-label/swap"; } ]; + + # Desktop environments - both available at login screen + imports = [ + ../desktops/plasma.nix # For gaming sessions + ../desktops/hyprland.nix # For development sessions + # ../desktops/niri.nix # Available for future use + ../bluetooth.nix + ../desktop/gaming.nix # Gaming configuration (Steam, Proton, Vulkan, etc.) + ]; + + # GPU drivers (uncomment and adjust for your hardware) + # For NVIDIA: + # services.xserver.videoDrivers = [ "nvidia" ]; + # hardware.nvidia = { + # modesetting.enable = true; + # powerManagement.enable = false; + # open = false; # Use proprietary driver + # package = config.boot.kernelPackages.nvidiaPackages.stable; + # }; + # + # For AMD: + # services.xserver.videoDrivers = [ "amdgpu" ]; + # + # For Intel: + # services.xserver.videoDrivers = [ "modesetting" ]; + + # Additional system packages + environment.systemPackages = with pkgs; + [ + # Add system-wide tools here if needed + # Gaming packages are configured in ../desktop/gaming.nix + # Development tools are better sourced via `nix develop` shells + ]; + + # This value determines the NixOS release compatibility + system.stateVersion = "24.05"; +} diff --git a/modules/nixos/hosts/gaming-rig.nix b/modules/nixos/hosts/gaming-rig.nix deleted file mode 100644 index 0ba42a1..0000000 --- a/modules/nixos/hosts/gaming-rig.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ pkgs, ... }: { - # Example gaming desktop configuration - # Copy and modify for your actual hardware - - # Boot configuration - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - # Hostname - networking.hostName = "gaming-rig"; - - # Import KDE Plasma for gaming - imports = [ ../desktops/plasma.nix ]; - - # Gaming-specific settings - programs.steam = { - enable = true; - remotePlay.openFirewall = true; - dedicatedServer.openFirewall = true; - }; - - # GameMode for performance optimization - programs.gamemode.enable = true; - - # GPU drivers (example: NVIDIA) - # services.xserver.videoDrivers = [ "nvidia" ]; - # hardware.nvidia = { - # modesetting.enable = true; - # powerManagement.enable = false; - # open = false; - # package = config.boot.kernelPackages.nvidiaPackages.stable; - # }; - - # Gaming packages - environment.systemPackages = with pkgs; [ - # Launchers - lutris - heroic - # bottles - - # Tools - mangohud # FPS overlay - # gamescope # Gaming compositor - # protonup-qt # Proton version manager - - # Communication - discord - ]; - - # This value determines the NixOS release compatibility - system.stateVersion = "24.05"; -}