Skip to content

Commit

Permalink
feat(nix): add support for creating the config via home-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
cecilia-sanare committed Mar 22, 2024
1 parent d9e8cc4 commit 0f4245c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
10 changes: 10 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
# deprecated in Nix 2.8
nixosModule = self.nixosModules.default;

homeManagerModules =
let
protontweaks = import ./nix/home-manager.nix;
in
{
protontweaks = protontweaks;
default = protontweaks;
};
homeManagerModule = self.homeManagerModules.default;

overlay = final: prev: {
protontweaks = prev.callPackage ./nix/pkgs/protontweaks.nix { };
};
Expand Down
26 changes: 26 additions & 0 deletions nix/home-manager.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{ lib, config, pkgs, ... }:
let
cfg = config.services.protontweaks;

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

gamemode = mkEnableOption "automatic gamemode initialization" // {
default = true;
};

mangohud = mkEnableOption "automatic mangohud initialization" // {
default = false;
};
};

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

0 comments on commit 0f4245c

Please sign in to comment.