From d7202a1af149982326448b19e3b6a51dbde0f232 Mon Sep 17 00:00:00 2001 From: Jay Looney Date: Wed, 8 Oct 2025 11:14:36 -0500 Subject: [PATCH 1/4] feat: add calibre and game virtualization --- hosts/titanium/game-emulation.nix | 57 +++++++++++++++++++ modules/nixos/desktop/calibre.nix | 27 +++++++++ .../{desktop.nix => desktop/default.nix} | 0 3 files changed, 84 insertions(+) create mode 100644 hosts/titanium/game-emulation.nix create mode 100644 modules/nixos/desktop/calibre.nix rename modules/nixos/{desktop.nix => desktop/default.nix} (100%) diff --git a/hosts/titanium/game-emulation.nix b/hosts/titanium/game-emulation.nix new file mode 100644 index 0000000..28b6c99 --- /dev/null +++ b/hosts/titanium/game-emulation.nix @@ -0,0 +1,57 @@ +{ config, lib, pkgs, ... }: +let + retroarchWithCores = ( + pkgs.retroarch.withCores ( + cores: with cores; [ + # Multi-Emulators + mame # Atari / Nintendo / Sega / etc. + + # Sega + genesis-plus-gx # Sega Genesis + + # Nintendo + mesen # NES + bsnes # Super Nintendo + mupen64plus # Nintendo 64 - Maybe simple64 some day. + dolphin # GameCube + mgba # GameBoy / Color / Advance + melonds # Nintendo DS + citra # Nintendo 3DS + + + # Sony + swanstation #duckstation # PlayStation + beetle-psx-hw + pcsx2 # PlayStation 2 -- Is actually "LRPS2" + #rpcs3 # PlayStation 3 + ppsspp # PlayStation Portable + + # Commodore + vice-x64 # C64 + ] + ) + ); +in +{ + environment.systemPackages = [ + retroarchWithCores + #pkgs.emulationstation-de + pkgs.gnome-bluetooth + ]; + + hardware.xone.enable = true; # Xbox Controller Driver + hardware.enableAllFirmware = true; + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + settings = { + General = { + Experimental = true; + FastConnectable = true; + }; + Policy = { + AutoEnable = true; + }; + }; + }; +} diff --git a/modules/nixos/desktop/calibre.nix b/modules/nixos/desktop/calibre.nix new file mode 100644 index 0000000..e4c1c6c --- /dev/null +++ b/modules/nixos/desktop/calibre.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: +{ + imports = []; + + options = { + zw-calibre = { + enable = lib.mkEnableOption "Enable Calibre"; + }; + }; + + config = { + config.allowUnfreePredigate = pkg: builtins.elem (lib.getName pkg) [ + "calibre" + "unrar" + ]; + + environment.systemPackages = with pkgs; [ + (calibre.override { + unrarSupport = true; + }) + unrar + ]; + + services.udisks2.enable = true; + }; + # NOTE: Consider adding https://github.com/nydragon/calibre-plugins +} diff --git a/modules/nixos/desktop.nix b/modules/nixos/desktop/default.nix similarity index 100% rename from modules/nixos/desktop.nix rename to modules/nixos/desktop/default.nix From 5981f4a023ec13b5a374e1be2af01c7b6ab1ad76 Mon Sep 17 00:00:00 2001 From: Jay Looney Date: Sun, 2 Nov 2025 10:10:28 -0600 Subject: [PATCH 2/4] feat: add gitignore for `result/` dirs --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f295f42 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +result +result-* \ No newline at end of file From 836a31c11901a1c49b2c99803449ebb23b867d8e Mon Sep 17 00:00:00 2001 From: Jay Looney Date: Thu, 6 Nov 2025 00:37:26 -0600 Subject: [PATCH 3/4] feat: Add CMake3 overlays to keep game emulation software working. --- overlays/default.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 overlays/default.nix diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..f981c72 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,40 @@ +{ nixpkgs }: + let + fixCmake = pkg: pkg.overrideAttrs (old: { + cmakeFlakes = (old.cmakeFlags or []) ++ [ + (nixpkgs.lib.cmakeFeature "CMAKE_POLICY_VERSION_MINIMUM" "3.10") + ]; + }); + cmake3Overlay = final: prev: + nixpkgs.lib.mapAttrs ( + n: pkg: + pkg.overrideAttrs (old: { + cmakeFlags = old.cmakeFlags or [ ] ++ [ (nixpkgs.lib.cmakeFeature "CMAKE_POLICY_VERSION_MINIMUM" "3.10") ]; + }) + ) { + inherit (prev) hpipm; + }; + libretroCmake3Overlay = final: prev: { + libretro = prev.libretro // { + thepowdertoy = prev.libretro.thepowdertoy.overrideAttrs(old: { + cmakeFlags = old.cmakeFlags or [ ] ++ [ (nixpkgs.lib.cmakeFeature "CMAKE_POLICY_VERSION_MINIMUM" "3.10") ]; + }); + + tic80 = prev.libretro.tic80.overrideAttrs(old: { + cmakeFlags = old.cmakeFlags or [ ] ++ [ (nixpkgs.lib.cmakeFeature "CMAKE_POLICY_VERSION_MINIMUM" "3.10") ]; + }); + + citra = prev.libretro.citra.overrideAttrs(old: { + cmakeFlags = old.cmakeFlags or [ ] ++ [ (nixpkgs.lib.cmakeFeature "CMAKE_POLICY_VERSION_MINIMUM" "3.10") ]; + }); + + dolphin = prev.libretro.dolphin.overrideAttrs(old: { + cmakeFlags = old.cmakeFlags or [ ] ++ [ (nixpkgs.lib.cmakeFeature "CMAKE_POLICY_VERSION_MINIMUM" "3.10") ]; + }); + }; + }; +in +[ + cmake3Overlay + libretroCmake3Overlay +] From fa5323584250be24b47236eb2875689ab735a3fb Mon Sep 17 00:00:00 2001 From: Jay Looney Date: Thu, 6 Nov 2025 00:39:15 -0600 Subject: [PATCH 4/4] feat: Add stylix and expose mkSystem via 'lib' --- flake.lock | 30 +++++++++++++++--------------- flake.nix | 10 ++++++++-- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/flake.lock b/flake.lock index a50ca1f..6886548 100644 --- a/flake.lock +++ b/flake.lock @@ -22,11 +22,11 @@ ] }, "locked": { - "lastModified": 1757508292, - "narHash": "sha256-7lVWL5bC6xBIMWWDal41LlGAG+9u2zUorqo3QCUL4p4=", + "lastModified": 1758287904, + "narHash": "sha256-IGmaEf3Do8o5Cwp1kXBN1wQmZwQN3NLfq5t4nHtVtcU=", "owner": "nix-community", "repo": "disko", - "rev": "146f45bee02b8bd88812cfce6ffc0f933788875a", + "rev": "67ff9807dd148e704baadbd4fd783b54282ca627", "type": "github" }, "original": { @@ -101,11 +101,11 @@ ] }, "locked": { - "lastModified": 1749499854, - "narHash": "sha256-V1BgwiX8NjbRreU6LC2EzmuqFSQAHhoSeNlYJyZ40NE=", + "lastModified": 1760130406, + "narHash": "sha256-GKMwBaFRw/C1p1VtjDz4DyhyzjKUWyi1K50bh8lgA2E=", "owner": "nix-community", "repo": "home-manager", - "rev": "1df816c407d3a5090c8496c9b00170af7891f021", + "rev": "d305eece827a3fe317a2d70138f53feccaf890a1", "type": "github" }, "original": { @@ -142,11 +142,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1749195551, - "narHash": "sha256-W5GKQHgunda/OP9sbKENBZhMBDNu2QahoIPwnsF6CeM=", + "lastModified": 1760106635, + "narHash": "sha256-2GoxVaKWTHBxRoeUYSjv0AfSOx4qw5CWSFz2b+VolKU=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "4602f7e1d3f197b3cb540d5accf5669121629628", + "rev": "9ed85f8afebf2b7478f25db0a98d0e782c0ed903", "type": "github" }, "original": { @@ -157,11 +157,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1749285348, - "narHash": "sha256-frdhQvPbmDYaScPFiCnfdh3B/Vh81Uuoo0w5TkWmmjU=", + "lastModified": 1760038930, + "narHash": "sha256-Oncbh0UmHjSlxO7ErQDM3KM0A5/Znfofj2BSzlHLeVw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3e3afe5174c561dee0df6f2c2b2236990146329f", + "rev": "0b4defa2584313f3b781240b29d61f6f9f7e0df3", "type": "github" }, "original": { @@ -252,11 +252,11 @@ ] }, "locked": { - "lastModified": 1747603214, - "narHash": "sha256-lAblXm0VwifYCJ/ILPXJwlz0qNY07DDYdLD+9H+Wc8o=", + "lastModified": 1759635238, + "narHash": "sha256-UvzKi02LMFP74csFfwLPAZ0mrE7k6EiYaKecplyX9Qk=", "owner": "Mic92", "repo": "sops-nix", - "rev": "8d215e1c981be3aa37e47aeabd4e61bb069548fd", + "rev": "6e5a38e08a2c31ae687504196a230ae00ea95133", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index b4a67f8..57fbeb6 100644 --- a/flake.nix +++ b/flake.nix @@ -11,15 +11,20 @@ sops-nix.inputs.nixpkgs.follows = "nixpkgs"; disko.url = "github:nix-community/disko"; disko.inputs.nixpkgs.follows = "nixpkgs"; + stylix.url = "github:nix-community/stylix"; + stylix.inputs.nixpkgs.follows = "nixpkgs"; }; # https://nix.dev/tutorials/nix-language.html#named-attribute-set-argument - outputs = inputs@{self, nixpkgs, nixos-hardware, home-manager, sops-nix, lanzaboote, disko, ...}: + outputs = inputs@{self, nixpkgs, nixos-hardware, home-manager, sops-nix, lanzaboote, disko, stylix, ...}: let mkSystem = (import ./lib { inherit nixpkgs home-manager inputs; }).mkSystem; in { + lib = { + mkSystem = mkSystem; + }; # NOTE: Run `nix flake show` to see what this flake has to offer. # TODO: Enable automated formatting with something like numtide/treefmt-nix nixosConfigurations = { @@ -40,7 +45,8 @@ users = [ "jml" ]; - extraModules = []; + #extraModules = [ (import ./overlays) ]; + extraModules = [ stylix.nixosModules.stylix ]; }; # `nix build .#nixosConfigurations.installIso.config.system.build.isoImage` # https://github.com/nix-community/nixos-generators