about summary refs log tree commit diff
path: root/modules/games/steam-run.nix
blob: 9e3c962098417d538a56e5046ffb7bd1b1db4bd9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
  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
    ];
  };
}

Consider giving Nix/NixOS a try! <3