games: Conditionally add emulators

This uses a crude arbitrary number to only install them onto machines
that can actually run them.
This commit is contained in:
Simon Bruder 2021-07-26 20:43:52 +02:00
parent a90fef89c0
commit 8b9eb54806
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
5 changed files with 37 additions and 6 deletions

View file

@ -8,7 +8,10 @@
]; ];
sbruder = { sbruder = {
games.enable = true; games = {
enable = true;
performanceIndex = 2;
};
gui.enable = true; gui.enable = true;
media-proxy.enable = true; media-proxy.enable = true;
mullvad.enable = true; mullvad.enable = true;

View file

@ -8,7 +8,10 @@
]; ];
sbruder = { sbruder = {
games.enable = true; games = {
enable = true;
performanceIndex = 8;
};
gui.enable = true; gui.enable = true;
media-proxy.enable = true; media-proxy.enable = true;
mullvad.enable = true; mullvad.enable = true;

View file

@ -12,7 +12,22 @@
default = true; default = true;
}; };
gui.enable = lib.mkEnableOption "gui"; gui.enable = lib.mkEnableOption "gui";
games.enable = lib.mkEnableOption "games"; games = {
enable = lib.mkEnableOption "games";
performanceIndex = lib.mkOption {
type = lib.types.int;
description = ''
Arbitrary number specifying how powerful the machine is. To be
replaced by taking into account single- and multi-core CPU and GPU
metrics separately should this system not map to my machines in
practice.
* 2: ~ 2014 ultrabook
* 8: ~ 2016 quad-core workstation with mid-range GPU
'';
default = 1;
};
};
}; };
# All modules are imported but non-essential modules are activated by # All modules are imported but non-essential modules are activated by

View file

@ -25,6 +25,8 @@ in
"corefonts" "corefonts"
"vista-fonts" "vista-fonts"
"wallpaper-unfree" # defined in users/simon/modules/sway.nix "wallpaper-unfree" # defined in users/simon/modules/sway.nix
"yuzu-ea"
"yuzu-mainline" # derivation of icons is not allowed
] ++ lib.optionals cfg.allowSoftware [ ] ++ lib.optionals cfg.allowSoftware [
"cups-kyocera-ecosys-m552x-p502x" # exception: the file header says MIT license, but explicitly forbids modifications WTF? "cups-kyocera-ecosys-m552x-p502x" # exception: the file header says MIT license, but explicitly forbids modifications WTF?
"drone-runner-exec" # exception: same as drone.io "drone-runner-exec" # exception: same as drone.io

View file

@ -1,5 +1,13 @@
{ lib, nixosConfig, pkgs, ... }: { lib, nixosConfig, pkgs, ... }:
lib.mkIf nixosConfig.sbruder.games.enable { let
home.packages = [ ] cfg = nixosConfig.sbruder.games;
++ lib.optional nixosConfig.sbruder.unfree.allowSoftware pkgs.unstable.osu-lazer-sandbox; inherit (nixosConfig.sbruder) unfree;
in
lib.mkIf cfg.enable {
home.packages = with pkgs; [ ]
++ lib.optionals (cfg.performanceIndex >= 4) [
desmume
dolphinEmuMaster
] ++ lib.optional (unfree.allowAssets && cfg.performanceIndex >= 8) unstable.yuzu-ea
++ lib.optional unfree.allowSoftware unstable.osu-lazer-sandbox;
} }