aboutsummaryrefslogtreecommitdiff
path: root/snowfall/modules/home/apps/steam/default.nix
blob: 9148b9d7efeddb2fcc8c5cf34fbb2cb3cc63bbdd (plain)
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
{ options, config, osConfig, lib, pkgs, namespace, ... }:

#NOTE: steam must be installed system-wide.
# This module does nothing unless steam is enabled at the
# system level as well. This is only a separate toggle so
# that not every user gets steam files in their home.
with lib; with lib.${namespace}; let
  cfg = config.${namespace}.apps.steam;
  oscfg = osConfig.${namespace}.apps.steam;
  impermanence = config.${namespace}.impermanence;
in {
  options.${namespace}.apps.steam = with types; {
    enable = mkEnableOption "steam";
  };

  config = mkIf (cfg.enable && oscfg.enable) {
    home.persistence.${impermanence.location} = {
      directories = [{
        directory = ".local/share/Steam";
        method = "symlink";
      }];
    };

    home.file = {
      "Links/Steam Games".source = config.lib.file.mkOutOfStoreSymlink (
        "${config.home.homeDirectory}/.local/share/Steam/steamapps/common"
      );
    };
  };
}