Skip to content

Commit

Permalink
fix(nix): simplify protontweaks config setup
Browse files Browse the repository at this point in the history
  • Loading branch information
cecilia-sanare committed Mar 22, 2024
1 parent 0f4245c commit 6de4ec7
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions nix/home-manager.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,29 @@
let
cfg = config.services.protontweaks;

inherit (lib) mkIf mkEnableOption;
in
{
options.services.protontweaks = {
enable = mkEnableOption "protontweaks";
inherit (lib) mkIf mkEnableOption mkOption types;
inherit (types) nullOr;

gamemode = mkEnableOption "automatic gamemode initialization" // {
default = true;
};
protontweaksConfig = with types; submodule
{
options = {
gamemode = mkEnableOption "automatic gamemode initialization" // {
default = true;
};

mangohud = mkEnableOption "automatic mangohud initialization" // {
default = false;
mangohud = mkEnableOption "automatic mangohud initialization" // {
default = false;
};
};
};
in
{
options.services.protontweaks.config = mkOption {
description = "The protontweaks config";
type = nullOr (protontweaksConfig);
};

config = mkIf (cfg.enable) {
home.file.".config/protontweaks.json".text = builtins.toJSON ({
gamemode = cfg.gamemode;
mangohud = cfg.mangohud;
});
config = mkIf (cfg.config != null) {
home.file.".config/protontweaks.json".text = builtins.toJSON cfg.config;
};
}

0 comments on commit 6de4ec7

Please sign in to comment.