{ config, lib, pkgs, ... }: let cfg = config.nixfiles.modules.games.steam-run; in { options.nixfiles.modules.games.steam-run = { enable = lib.mkEnableOption "native Steam runtime"; quirks = { blackIsleStudios = lib.mkEnableOption "fixes for games from Black Isle Studios"; cryptOfTheNecrodancer = lib.mkEnableOption ''fixes for "Crypt of the NecroDancer" issues''; mountAndBladeWarband = lib.mkEnableOption ''fixes for "Mount & Blade: Warband" issues''; }; }; config = lib.mkIf cfg.enable { nixfiles.modules = { games.steam.enable = true; common.nix.allowedUnfreePackages = lib.optionals cfg.quirks.mountAndBladeWarband [ "fmod" # proprietary ]; }; hm.home.packages = [ (pkgs.steam.override { extraEnv.MANGOHUD = 1; extraLibraries = _: lib.optionals cfg.quirks.blackIsleStudios [ pkgs.openssl_1_0_0 ] ++ lib.optionals cfg.quirks.cryptOfTheNecrodancer [ (lib.packages.fromRev "d1c3fea7ecbed758168787fe4e4a3157e52bc808" "sha256-3muuhz3fjtF1bz32UXOYCho51E8JSeEwo2iDZFQJdXo=") .flac ] ++ lib.optionals cfg.quirks.mountAndBladeWarband [ (pkgs.fmodex.overrideAttrs (oldAttrs: { postInstall = '' ln -s $out/lib/libfmodex64.so $out/lib/libfmodex-${oldAttrs.version}.so ''; })) ]; }).run ]; }; }