diff --git a/nix/configuration/configuration.nix b/nix/configuration/configuration.nix index faa014a..a18d814 100644 --- a/nix/configuration/configuration.nix +++ b/nix/configuration/configuration.nix @@ -32,6 +32,7 @@ ./roles/graphics ./roles/hydra ./roles/iso + ./roles/iso_mount ./roles/kanshi ./roles/kodi ./roles/kubernetes diff --git a/nix/configuration/hosts/odo/default.nix b/nix/configuration/hosts/odo/default.nix index 5b3546b..11be98b 100644 --- a/nix/configuration/hosts/odo/default.nix +++ b/nix/configuration/hosts/odo/default.nix @@ -75,6 +75,7 @@ me.gpg.enable = true; me.graphical = true; me.graphics_card_type = "amd"; + me.iso_mount.enable = true; me.kanshi.enable = false; me.kubernetes.enable = true; me.latex.enable = true; diff --git a/nix/configuration/hosts/quark/default.nix b/nix/configuration/hosts/quark/default.nix index a19a0d4..30a5233 100644 --- a/nix/configuration/hosts/quark/default.nix +++ b/nix/configuration/hosts/quark/default.nix @@ -66,6 +66,7 @@ me.gpg.enable = true; me.graphical = true; me.graphics_card_type = "amd"; + me.iso_mount.enable = true; me.kanshi.enable = false; me.kubernetes.enable = true; me.latex.enable = true; diff --git a/nix/configuration/roles/iso_mount/default.nix b/nix/configuration/roles/iso_mount/default.nix new file mode 100644 index 0000000..32c0af6 --- /dev/null +++ b/nix/configuration/roles/iso_mount/default.nix @@ -0,0 +1,45 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + iso_mount = + (pkgs.writeScriptBin "iso_mount" (builtins.readFile ./files/iso_mount.bash)).overrideAttrs + (old: { + buildCommand = "${old.buildCommand}\n patchShebangs $out"; + + }); + iso_unmount = + (pkgs.writeScriptBin "iso_unmount" (builtins.readFile ./files/iso_unmount.bash)).overrideAttrs + (old: { + buildCommand = "${old.buildCommand}\n patchShebangs $out"; + + }); + +in +{ + imports = [ ]; + + options.me = { + iso_mount.enable = lib.mkOption { + type = lib.types.bool; + default = false; + example = true; + description = "Whether we want to install iso_mount."; + }; + }; + + config = lib.mkIf config.me.iso_mount.enable ( + lib.mkMerge [ + { + environment.systemPackages = [ + iso_mount + iso_unmount + ]; + } + ] + ); +} diff --git a/nix/configuration/roles/iso_mount/files/iso_mount.bash b/nix/configuration/roles/iso_mount/files/iso_mount.bash new file mode 100644 index 0000000..143e14d --- /dev/null +++ b/nix/configuration/roles/iso_mount/files/iso_mount.bash @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# +# Mount a full-disk image as a loopback device so you can mount individual partitions from inside of it. +set -euo pipefail +IFS=$'\n\t' +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +exec udisksctl loop-setup -r -f "${@}" diff --git a/nix/configuration/roles/iso_mount/files/iso_unmount.bash b/nix/configuration/roles/iso_mount/files/iso_unmount.bash new file mode 100644 index 0000000..1771e21 --- /dev/null +++ b/nix/configuration/roles/iso_mount/files/iso_unmount.bash @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# +# Mount a full-disk image as a loopback device so you can mount individual partitions from inside of it. +set -euo pipefail +IFS=$'\n\t' +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +exec udisksctl loop-delete "${@}" diff --git a/nix/configuration/roles/rpcs3/default.nix b/nix/configuration/roles/rpcs3/default.nix index 6990584..fbb6d9a 100644 --- a/nix/configuration/roles/rpcs3/default.nix +++ b/nix/configuration/roles/rpcs3/default.nix @@ -5,6 +5,14 @@ ... }: +let + rpcs3_config_yaml = ( + pkgs.writeTextFile { + name = "config.yml"; + text = lib.generators.toYAML { } config.me.rpcs3.config; + } + ); +in { imports = [ ]; @@ -15,6 +23,29 @@ example = true; description = "Whether we want to install rpcs3."; }; + + rpcs3.config = lib.mkOption { + type = lib.types.nullOr lib.types.attrs; + default = { + VFS = { + "Enable /host_root/" = false; + }; + Video = { + "Write Color Buffers" = false; + VSync = true; + "Performance Overlay" = { + Enabled = true; + }; + }; + Miscellaneous = { + "Pause emulation on RPCS3 focus loss" = true; + "Start games in fullscreen mode" = true; + "Pause Emulation During Home Menu" = true; + }; + }; + example = null; + description = "RPCS3's config.yml in nix form."; + }; }; config = lib.mkIf config.me.rpcs3.enable ( @@ -39,8 +70,21 @@ } ]; - # .config/rpcs3/config.yml - # .config/rpcs3/GuiConfigs/CurrentSettings.ini + me.rpcs3.config.Core."Use LLVM CPU" = + lib.mkIf (config.me.optimizations.enable) config.me.optimizations.arch; + + home-manager.users.talexander = + { pkgs, ... }: + { + home.file.".config/rpcs3/config.yml" = lib.mkIf (config.me.rpcs3.config != null) { + source = rpcs3_config_yaml; + }; + home.file.".config/rpcs3/GuiConfigs/CurrentSettings.ini" = { + source = ./files/CurrentSettings.ini; + }; + }; + + # TODO?: .config/rpcs3/GuiConfigs/CurrentSettings.ini environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) { hideMounts = true; @@ -84,6 +128,13 @@ group = "talexander"; mode = "0755"; } + { + # Controller config. + directory = ".config/rpcs3/input_configs"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } ]; }; }; diff --git a/nix/configuration/roles/rpcs3/files/CurrentSettings.ini b/nix/configuration/roles/rpcs3/files/CurrentSettings.ini new file mode 100644 index 0000000..b6354c4 --- /dev/null +++ b/nix/configuration/roles/rpcs3/files/CurrentSettings.ini @@ -0,0 +1,5 @@ +[Meta] +currentStylesheet=Darker Style by TheMitoSan + +[main_window] +infoBoxEnabledWelcome=false