diff --git a/flake.nix b/flake.nix index 942a7bd..09facdd 100755 --- a/flake.nix +++ b/flake.nix @@ -37,42 +37,44 @@ outputs = { self, nixpkgs, home-manager, catppuccin, lanzaboote, stablepkgs , bleedingpkgs, lix-module, nix-darwin, nix-homebrew, ... }@inputs: rec { formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt; - nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs; }; - system = "x86_64-linux"; - modules = [ - ./modules/nixos/nixos-configuration.nix - ./modules/nixos/secureboot.nix - ./modules/nixos/gaming.nix - ./modules/nixos/audio.nix - ./modules/nixos/nvidia.nix - ./modules/nixos/networking.nix - ./modules/common/fonts.nix - ./machines/nixos/hardware-configuration.nix + nixosConfigurations = { + nixos = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs; }; + system = "x86_64-linux"; + modules = [ + ./modules/nixos/nixos-configuration.nix + ./modules/nixos/secureboot.nix + ./modules/nixos/gaming.nix + ./modules/nixos/audio.nix + ./modules/nixos/nvidia.nix + ./modules/nixos/networking.nix + ./modules/common/fonts.nix + ./machines/nixos/hardware-configuration.nix - catppuccin.nixosModules.catppuccin + catppuccin.nixosModules.catppuccin - lix-module.nixosModules.default + lix-module.nixosModules.default - lanzaboote.nixosModules.lanzaboote + lanzaboote.nixosModules.lanzaboote - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.backupFileExtension = "backup"; - home-manager.users.youwen = { - imports = [ - ./modules/home-manager/linux/linux-home.nix - ./modules/home-manager/linux/desktop.nix - ./modules/home-manager/linux/programs.nix - ./modules/home-manager/common/core.nix - ./modules/home-manager/linux/catppuccin.nix - inputs.catppuccin.homeManagerModules.catppuccin - ]; - }; - } - ]; + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.backupFileExtension = "backup"; + home-manager.users.youwen = { + imports = [ + ./users/youwen/home-manager/linux/linux-home.nix + ./users/youwen/home-manager/linux/desktop.nix + ./users/youwen/home-manager/linux/programs.nix + ./users/youwen/home-manager/common/core.nix + ./users/youwen/home-manager/linux/catppuccin.nix + inputs.catppuccin.homeManagerModules.catppuccin + ]; + }; + } + ]; + }; }; formatter.aarch64-darwin = nixpkgs.legacyPackages.aarch64-darwin.nixfmt; # Build darwin flake using: diff --git a/modules/nixos/gaming.nix b/modules/nixos/gaming.nix index cee6b8d..0432980 100644 --- a/modules/nixos/gaming.nix +++ b/modules/nixos/gaming.nix @@ -22,6 +22,10 @@ libvorbis stdenv.cc.cc.lib libkrb5 + (writeShellScriptBin "launch-gamescope" '' + (sleep 1; pgrep gamescope| xargs renice -n -11 -p)& + exec gamescope "$@" + '') keyutils ]; }; diff --git a/modules/nixos/nixos-configuration.nix b/modules/nixos/nixos-configuration.nix index a36a326..d401f9d 100755 --- a/modules/nixos/nixos-configuration.nix +++ b/modules/nixos/nixos-configuration.nix @@ -87,14 +87,41 @@ users.users.youwen = { isNormalUser = true; description = "Youwen Wu"; - extraGroups = [ "networkmanager" "wheel" "nixos" ]; + extraGroups = [ "networkmanager" "wheel" "nixos" "realtime" ]; }; + users.groups.realtime = { }; + nix.settings = { trusted-users = [ "root" "youwen" ]; experimental-features = [ "nix-command" "flakes" ]; }; + services.udev.extraRules = '' + KERNEL=="cpu_dma_latency", GROUP="realtime" + ''; + + security.pam.loginLimits = [ + { + domain = "@realtime"; + type = "-"; + item = "rtprio"; + value = 98; + } + { + domain = "@realtime"; + type = "-"; + item = "memlock"; + value = "unlimited"; + } + { + domain = "@realtime"; + type = "-"; + item = "nice"; + value = -11; + } + ]; + # Allow unfree packages nixpkgs.config.allowUnfree = true; diff --git a/modules/home-manager/common/core.nix b/users/youwen/common/core.nix similarity index 100% rename from modules/home-manager/common/core.nix rename to users/youwen/common/core.nix diff --git a/modules/home-manager/darwin/darwin-home.nix b/users/youwen/darwin/darwin-home.nix similarity index 100% rename from modules/home-manager/darwin/darwin-home.nix rename to users/youwen/darwin/darwin-home.nix diff --git a/modules/home-manager/linux/catppuccin.nix b/users/youwen/linux/catppuccin.nix similarity index 100% rename from modules/home-manager/linux/catppuccin.nix rename to users/youwen/linux/catppuccin.nix diff --git a/modules/home-manager/linux/desktop.nix b/users/youwen/linux/desktop.nix similarity index 100% rename from modules/home-manager/linux/desktop.nix rename to users/youwen/linux/desktop.nix diff --git a/modules/home-manager/linux/hyprland-conf.nix b/users/youwen/linux/hyprland-conf.nix similarity index 100% rename from modules/home-manager/linux/hyprland-conf.nix rename to users/youwen/linux/hyprland-conf.nix diff --git a/modules/home-manager/linux/linux-home.nix b/users/youwen/linux/linux-home.nix similarity index 100% rename from modules/home-manager/linux/linux-home.nix rename to users/youwen/linux/linux-home.nix diff --git a/modules/home-manager/linux/programs.nix b/users/youwen/linux/programs.nix similarity index 100% rename from modules/home-manager/linux/programs.nix rename to users/youwen/linux/programs.nix diff --git a/modules/home-manager/linux/waybar/waybar-conf.nix b/users/youwen/linux/waybar/waybar-conf.nix similarity index 100% rename from modules/home-manager/linux/waybar/waybar-conf.nix rename to users/youwen/linux/waybar/waybar-conf.nix diff --git a/modules/home-manager/linux/waybar/waybar.css b/users/youwen/linux/waybar/waybar.css similarity index 100% rename from modules/home-manager/linux/waybar/waybar.css rename to users/youwen/linux/waybar/waybar.css