diff --git a/flake.lock b/flake.lock index e310e65..cb59006 100644 --- a/flake.lock +++ b/flake.lock @@ -205,16 +205,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1709145408, - "narHash": "sha256-sS7DOx3nvFUm2p9wFvPGX1pgetLOPg0R1lXMdRQhVnw=", + "lastModified": 1709150264, + "narHash": "sha256-HofykKuisObPUfj0E9CJVfaMhawXkYx3G8UIFR/XQ38=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d4164730d41de41525032cacb2d3139906cb1c03", + "rev": "9099616b93301d5cf84274b184a3a5ec69e94e08", "type": "github" }, "original": { "owner": "NixOS", - "ref": "master", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 42939c2..45c92b4 100644 --- a/flake.nix +++ b/flake.nix @@ -3,11 +3,9 @@ inputs = { # Common - # nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - nixpkgs.url = "github:NixOS/nixpkgs/master"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # Desktop - # kde.url = "github:nix-community/kde2nix"; nix-flatpak.url = "github:gmodena/nix-flatpak"; impermanence.url = "github:nix-community/impermanence"; home-manager.url = "github:nix-community/home-manager"; @@ -30,7 +28,6 @@ modules = [ impermanence.nixosModules.impermanence lanzaboote.nixosModules.lanzaboote - # kde.nixosModules.plasma6 nix-flatpak.nixosModules.nix-flatpak ./hosts/desktop/configuration.nix ./share/impermanence diff --git a/hosts/default.nix b/hosts/default.nix index 820d8df..18cb004 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -4,7 +4,16 @@ in { imports = [ ../modules ../share ]; # Enable nix flakes and nix-command tools - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix = { + settings.experimental-features = [ "nix-command" "flakes" ]; + + # Garbage collect automatically every week + gc.automatic = true; + }; + + # Configure nixpkgs + # Enable non free + nixpkgs.config.allowUnfree = true; # Hardware configs hardware = { @@ -54,4 +63,8 @@ in { magicOrExtension = "\\x7fELF....AI\\x02"; }; }; + + programs = { + fish.enable = true; + }; } diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix index 18f36d9..837a514 100644 --- a/hosts/desktop/configuration.nix +++ b/hosts/desktop/configuration.nix @@ -8,15 +8,6 @@ let password = "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06"; hostname = "matt-nixos"; - # discover-wrapper is needed as of 1/24/24 since PackageKit does not work correctly so this removes error messages. - discover-wrapped = pkgs.symlinkJoin { - name = "discover-flatpak-backend"; - paths = [ pkgs.libsForQt5.discover ]; - buildInputs = [ pkgs.makeWrapper ]; - postBuild = '' - wrapProgram $out/bin/plasma-discover --add-flags "--backends flatpak" - ''; - }; in { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix @@ -30,6 +21,10 @@ in { corectrl.enablePolkit = true; }; + share.gaming.enable = true; + + apps.discover-wrapped.enable = true; + # Configure bootloader with lanzaboot and secureboot boot = { loader = { @@ -61,22 +56,6 @@ in { consoleLogLevel = 3; bootspec.enable = true; - - # Network option required using sysctl to let Ubisoft Connect work as of 7-12-2023 - kernel.sysctl."net.ipv4.tcp_mtu_probing" = 1; - }; - - # Hardware configs - hardware = { - # Xbox controllers - xpadneo.enable = true; - - # Steam udev rules for remote play - steam-hardware.enable = true; - - # opengl.enable = true; - # # Enables support for 32bit libs that steam uses - # opengl.driSupport32Bit = true; }; # Services configs @@ -191,7 +170,6 @@ in { efibootmgr sbctl gparted - discover-wrapped pciutils papirus-icon-theme vulkan-tools @@ -204,51 +182,25 @@ in { ]; }; - # Configure programs - programs = { - fish.enable = true; - java.enable = true; - - # Steam - steam = { - 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 - }; - }; # Configure nixpkgs - nixpkgs = { - config = { - # Enable non free - allowUnfree = true; + nixpkgs.config.permittedInsecurePackages = [ + # allow insecure electron for etcher + "electron-19.1.9" + ]; - permittedInsecurePackages = [ - # allow insecure electron for etcher - "electron-19.1.9" - ]; + # # Configure nixpkgs + # nixpkgs = { + # config = { + # # Enable non free + # allowUnfree = true; - packageOverrides = pkgs: { - steam = pkgs.steam.override { - extraPkgs = pkgs: - with pkgs; [ - xorg.libXcursor - xorg.libXi - xorg.libXinerama - xorg.libXScrnSaver - libpng - libpulseaudio - libvorbis - stdenv.cc.cc.lib - libkrb5 - keyutils - ]; - }; - }; - }; - }; + # permittedInsecurePackages = [ + # # allow insecure electron for etcher + # "electron-19.1.9" + # ]; + # }; + # }; # Define a user account. Don't forget to set a password with ‘passwd’. users.users."${user}" = { diff --git a/hosts/desktop/home.nix b/hosts/desktop/home.nix index 68f37af..ba530e3 100644 --- a/hosts/desktop/home.nix +++ b/hosts/desktop/home.nix @@ -15,8 +15,11 @@ in { home.stateVersion = "23.11"; programs.home-manager.enable = true; - programs.fish.enable = true; - programs.mangohud.enable = true; + programs = { + fish.enable = true; + mangohud.enable = true; + java.enable = true; + }; programs.git = { enable = true; @@ -57,7 +60,4 @@ in { # Other packages vulkan-hdr-layer ]; - - # Garbage collect automatically every week - nix.gc.automatic = true; } diff --git a/modules/apps/discover-wrapped/default.nix b/modules/apps/discover-wrapped/default.nix new file mode 100644 index 0000000..82e1ce5 --- /dev/null +++ b/modules/apps/discover-wrapped/default.nix @@ -0,0 +1,23 @@ +{ config, pkgs, lib, ... }: +with lib; +let + cfg = config.apps.discover-wrapped; + + # discover-wrapper is needed as of 1/24/24 since PackageKit does not work correctly so this removes error messages. + discover-wrapped = pkgs.symlinkJoin { + name = "discover-flatpak-backend"; + paths = [ pkgs.libsForQt5.discover ]; + buildInputs = [ pkgs.makeWrapper ]; + postBuild = '' + wrapProgram $out/bin/plasma-discover --add-flags "--backends flatpak" + ''; + }; +in +{ + imports = [ ./options.nix ]; + + config = mkIf cfg.enable { + # Configure environment + environment.systemPackages = [ discover-wrapped ]; + }; +} diff --git a/modules/apps/discover-wrapped/options.nix b/modules/apps/discover-wrapped/options.nix new file mode 100644 index 0000000..7688a3a --- /dev/null +++ b/modules/apps/discover-wrapped/options.nix @@ -0,0 +1,6 @@ +{ lib, ... }: +with lib; { + options.apps.discover-wrapped = { + enable = mkEnableOption "enable discover with flatpak"; + }; +} diff --git a/modules/default.nix b/modules/default.nix index 4811dc5..110422e 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -3,6 +3,7 @@ ./samba ./apps/collabora # ./apps/dashy + ./apps/discover-wrapped ./apps/jellyfin ./apps/jellyseerr ./apps/mariadb diff --git a/share/default.nix b/share/default.nix index c513fce..3c6aa9d 100644 --- a/share/default.nix +++ b/share/default.nix @@ -1 +1 @@ -{ ... }: { imports = [ ./amd ./nvidia ]; } +{ ... }: { imports = [ ./amd ./nvidia ./gaming ]; } diff --git a/share/gaming/default.nix b/share/gaming/default.nix new file mode 100644 index 0000000..d3114cb --- /dev/null +++ b/share/gaming/default.nix @@ -0,0 +1,48 @@ +{ lib, pkgs, config, ... }: +with lib; +let cfg = config.share.gaming; +in { + imports = [ ./options.nix ]; + + config = mkIf cfg.enable { + # Network option required using sysctl to let Ubisoft Connect work as of 7-12-2023 + boot.kernel.sysctl."net.ipv4.tcp_mtu_probing" = 1; + + # Configure programs + programs.steam = { + enable = true; + # Open ports in the firewall for Steam Remote Play + remotePlay.openFirewall = true; + # Open ports in the firewall for Source Dedicated Server + dedicatedServer.openFirewall = true; + }; + + # Hardware configs + hardware = { + # Xbox controllers + xpadneo.enable = true; + + # Steam udev rules for remote play + steam-hardware.enable = true; + }; + + # Configure nixpkgs + nixpkgs.config.packageOverrides = pkgs: { + steam = pkgs.steam.override { + extraPkgs = pkgs: + with pkgs; [ + xorg.libXcursor + xorg.libXi + xorg.libXinerama + xorg.libXScrnSaver + libpng + libpulseaudio + libvorbis + stdenv.cc.cc.lib + libkrb5 + keyutils + ]; + }; + }; + }; +} diff --git a/share/gaming/options.nix b/share/gaming/options.nix new file mode 100644 index 0000000..f9407fa --- /dev/null +++ b/share/gaming/options.nix @@ -0,0 +1,6 @@ +{ lib, ... }: +with lib; { + options.share.gaming = { + enable = mkEnableOption "enable gaming stuffs"; + }; +}