1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-01 20:43:34 +02:00

flameshot: extend module with package-option

This commit is contained in:
Sebastian Sellmeier 2021-11-19 01:46:34 +01:00 committed by Robert Helgesson
parent 8230decb3f
commit 8a16d62e95
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89

View File

@ -6,8 +6,6 @@ let
cfg = config.services.flameshot;
package = pkgs.flameshot;
iniFormat = pkgs.formats.ini { };
iniFile = iniFormat.generate "flameshot.ini" cfg.settings;
@ -18,6 +16,13 @@ in {
options.services.flameshot = {
enable = mkEnableOption "Flameshot";
package = mkOption {
type = types.package;
default = pkgs.flameshot;
defaultText = literalExpression "pkgs.flameshot";
description = "Package providing <command>flameshot</command>.";
};
settings = mkOption {
type = iniFormat.type;
default = { };
@ -41,7 +46,7 @@ in {
lib.platforms.linux)
];
home.packages = [ package ];
home.packages = [ cfg.package ];
xdg.configFile = mkIf (cfg.settings != { }) {
"flameshot/flameshot.ini".source = iniFile;
@ -60,7 +65,7 @@ in {
Service = {
Environment = "PATH=${config.home.profileDirectory}/bin";
ExecStart = "${package}/bin/flameshot";
ExecStart = "${cfg.package}/bin/flameshot";
Restart = "on-abort";
# Sandboxing.