# MANUAL: echo 80 | sudo tee /sys/class/hwmon/hwmon3/max_battery_charge_level
{
  description = "My system configuration";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    nixgl = {
      url = "github:nix-community/nixGL";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    impermanence = {
      url = "github:nix-community/impermanence";
    };
  };
  outputs =
    {
      nixpkgs,
      nixgl,
      home-manager,
      impermanence,
      ...
    }:
    let
      forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
      system = "x86_64-linux";
      pkgs = import nixpkgs {
        inherit system;
        overlays = [ nixgl.overlay ];
        # Cannot set arch/tune with stand-alone home manager: https://github.com/nix-community/home-manager/issues/2954#issuecomment-1765433433
      };
    in
    # pkgs = nixpkgs.legacyPackages.${system};
    {
      defaultPackage.${system} = home-manager.packages.${system}.default;
      homeConfigurations."deck" = home-manager.lib.homeManagerConfiguration {
        inherit pkgs;

        extraSpecialArgs = {
          inherit nixgl;
          inherit home-manager;
        };

        modules = [
          { nixpkgs.overlays = [ nixgl.overlay ]; }
          impermanence.homeManagerModules.impermanence
          ./hosts/deck
          ./home.nix
        ];
      };
    };
}
