1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00
home-manager/modules/programs/hyprshot.nix
Austin Horstman 9f2912e3a6 hyprshot: add platform assertion
Only available on linux.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-10-05 17:19:26 -05:00

44 lines
1.1 KiB
Nix

{
config,
pkgs,
lib,
...
}:
let
cfg = config.programs.hyprshot;
in
{
meta.maintainers = with lib.hm.maintainers; [
joker9944
];
options.programs.hyprshot = {
enable = lib.mkEnableOption "Hyprshot the Hyprland screenshot utility";
package = lib.mkPackageOption pkgs "hyprshot" { nullable = true; };
saveLocation = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
example = "$HOME/Pictures/Screenshots";
description = ''
Set the `$HYPRSHOT_DIR` environment variable to the given location.
Hypershot will save screenshots to the first expression that resolves:
- `$HYPRSHOT_DIR`
- `$XDG_PICTURES_DIR`
- `$(xdg-user-dir PICTURES)`
'';
};
};
config = lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "programs.hyprshot" pkgs lib.platforms.linux)
];
home = {
packages = lib.mkIf (cfg.package != null) [ cfg.package ];
sessionVariables = lib.mkIf (cfg.saveLocation != null) { HYPRSHOT_DIR = cfg.saveLocation; };
};
};
}