From d6fe9e9f5fa0fdda7f2a24ec27544f2878779f6c Mon Sep 17 00:00:00 2001 From: alsaiduq-lab Date: Thu, 3 Apr 2025 19:24:22 -0600 Subject: [PATCH] should be the last stage --- flake.lock | 6 +++--- flake.nix | 28 +++++++++++++++++++--------- home-manager/cobray.nix | 7 ++++++- home-manager/modules/emulators.nix | 16 +--------------- hosts/configuration.nix | 4 +--- modules/home-manager.nix | 8 ++++++-- 6 files changed, 36 insertions(+), 33 deletions(-) diff --git a/flake.lock b/flake.lock index d1a4060..d90e7e1 100644 --- a/flake.lock +++ b/flake.lock @@ -25,11 +25,11 @@ ] }, "locked": { - "lastModified": 1743648554, - "narHash": "sha256-23JFd+zd2GamTTdnGuFVeIg8x8C3hLpQJRh/PGTORzo=", + "lastModified": 1743717835, + "narHash": "sha256-LJm6FoIcUoBw3w25ty12/sBfut4zZuNGdN0phYj/ekU=", "owner": "nix-community", "repo": "home-manager", - "rev": "107352dde4ff3c01cb5a0b3fe17f5beef37215bc", + "rev": "66a6ec65f84255b3defb67ff45af86c844dd451b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 44f59e9..baf84a0 100644 --- a/flake.nix +++ b/flake.nix @@ -123,14 +123,15 @@ "-DUSE_PULSEAUDIO=ON" "-DUSE_LIBEVDEV=ON" "-DUSE_SYSTEM_ZSTD=ON" + "-DUSE_DISCORD_RPC=ON" "-DCMAKE_VERBOSE_MAKEFILE=ON" - "-DCMake_MESSAGE_LOG_LEVEL=TRACE" + "-DCMAKE_MESSAGE_LOG_LEVEL=TRACE" ]; preConfigure = '' echo "Verifying submodule directories:" >&2 - ls -l 3rdparty/hidapi/hidapi 3rdparty/glslang/glslang 3rdparty/yaml-cpp/yaml-cpp 3rdparty/zstd/zstd >&2 - if [ ! -f 3rdparty/hidapi/hidapi/CMakeLists.txt ]; then - echo "ERROR: hidapi submodule not fetched correctly" >&2 + ls -l 3rdparty/hidapi/hidapi 3rdparty/glslang/glslang 3rdparty/yaml-cpp/yaml-cpp 3rdparty/zstd/zstd 3rdparty/discord-rpc >&2 + if [ ! -f 3rdparty/hidapi/hidapi/CMakeLists.txt ] || [ ! -f 3rdparty/discord-rpc/CMakeLists.txt ]; then + echo "ERROR: Submodules (hidapi or discord-rpc) not fetched correctly" >&2 exit 1 fi echo "Original 3rdparty/CMakeLists.txt:" >&2 @@ -144,7 +145,7 @@ echo "Patched 3rdparty/CMakeLists.txt:" >&2 cat 3rdparty/CMakeLists.txt >&2 echo "Checking submodules:" >&2 - ls -lR 3rdparty/hidapi 3rdparty/glslang 3rdparty/yaml-cpp 3rdparty/cubeb 3rdparty/zstd >&2 + ls -lR 3rdparty/hidapi 3rdparty/glslang 3rdparty/yaml-cpp 3rdparty/cubeb 3rdparty/zstd 3rdparty/discord-rpc >&2 ''; }); }; @@ -158,27 +159,36 @@ rpcs3_latest = pkgs.rpcs3.overrideAttrs (oldAttrs: { src = pkgs.fetchgit { url = "https://github.com/RPCS3/rpcs3.git"; - rev = inputs.rpcs3-latest.rev; # Should be 37dbd77628f44cdef3228bdfc03127365ec7383b per flake.lock - sha256 = "sha256-Yx0Qsc0r+5C0BqqsbJCv47QPeaNbaIut8s6Hcysy2mo="; # Confirmed for 37dbd77628f44cdef3228bdfc03127365ec7383b with submodules + rev = inputs.rpcs3-latest.rev; + sha256 = "Yx0Qsc0r+5C0BqqsbJCv47QPeaNbaIut8s6Hcysy2mo="; fetchSubmodules = true; }; + nativeBuildInputs = oldAttrs.nativeBuildInputs; + buildInputs = oldAttrs.buildInputs; + cmakeFlags = + oldAttrs.cmakeFlags + ++ [ + "-DUSE_DISCORD_RPC=ON" + ]; preUnpack = '' echo "Source rev: ${inputs.rpcs3-latest.rev}" >&2 echo "Expected rev: 37dbd77628f44cdef3228bdfc03127365ec7383b" >&2 ''; }); in { + packages.${system} = { + rpcs3_latest = rpcs3_latest; + }; nixosConfigurations = { nixos = lib.nixosSystem { inherit system; - specialArgs = {inherit inputs;}; + specialArgs = {inherit inputs rpcs3_latest;}; modules = [ {nixpkgs.overlays = [customPkgsOverlay];} ./hosts/configuration.nix ]; }; }; - homeConfigurations = { "cobray" = home-manager.lib.homeManagerConfiguration { inherit pkgs; diff --git a/home-manager/cobray.nix b/home-manager/cobray.nix index f6c2ef3..ceae72f 100644 --- a/home-manager/cobray.nix +++ b/home-manager/cobray.nix @@ -1,4 +1,8 @@ -{pkgs, ...}: { +{ + pkgs, + rpcs3_latest, + ... +}: { imports = [ ./modules/dunst.nix ./modules/fish.nix @@ -30,5 +34,6 @@ btop nvtopPackages.full arandr + rpcs3_latest ]; } diff --git a/home-manager/modules/emulators.nix b/home-manager/modules/emulators.nix index 84f575b..202382d 100644 --- a/home-manager/modules/emulators.nix +++ b/home-manager/modules/emulators.nix @@ -1,12 +1,4 @@ -{ - pkgs, - inputs, - ... -}: let - rpcs3_latest = pkgs.rpcs3.overrideAttrs (oldAttrs: { - src = inputs.rpcs3-latest; - }); -in { +{pkgs, ...}: { home.packages = with pkgs; [ mgba desmume @@ -18,11 +10,5 @@ in { retroarch mednafen joycond - # uses latest commit, but in case of errors (if there were any in the first place) to fallback to snapshot nix package in case it failed (even if not) - ( - if (builtins.tryEval rpcs3_latest).success - then rpcs3_latest - else rpcs3 - ) ]; } diff --git a/hosts/configuration.nix b/hosts/configuration.nix index a0aad19..6f6e365 100644 --- a/hosts/configuration.nix +++ b/hosts/configuration.nix @@ -1,9 +1,7 @@ # 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'). -{ - ... -}: { +{...}: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix diff --git a/modules/home-manager.nix b/modules/home-manager.nix index 2ab0065..bd3ca97 100644 --- a/modules/home-manager.nix +++ b/modules/home-manager.nix @@ -1,4 +1,8 @@ -{inputs, ...}: { +{ + inputs, + rpcs3_latest, + ... +}: { imports = [ inputs.home-manager.nixosModules.home-manager ]; @@ -6,7 +10,7 @@ useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = { - inherit inputs; + inherit inputs rpcs3_latest; }; users.cobray = import ../home-manager/cobray.nix; };