mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 22:50:39 +00:00
flameshot: extend module with package-option
This commit is contained in:
parent
8230decb3f
commit
8a16d62e95
1 changed files with 9 additions and 4 deletions
|
@ -6,8 +6,6 @@ let
|
||||||
|
|
||||||
cfg = config.services.flameshot;
|
cfg = config.services.flameshot;
|
||||||
|
|
||||||
package = pkgs.flameshot;
|
|
||||||
|
|
||||||
iniFormat = pkgs.formats.ini { };
|
iniFormat = pkgs.formats.ini { };
|
||||||
|
|
||||||
iniFile = iniFormat.generate "flameshot.ini" cfg.settings;
|
iniFile = iniFormat.generate "flameshot.ini" cfg.settings;
|
||||||
|
@ -18,6 +16,13 @@ in {
|
||||||
options.services.flameshot = {
|
options.services.flameshot = {
|
||||||
enable = mkEnableOption "Flameshot";
|
enable = mkEnableOption "Flameshot";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.flameshot;
|
||||||
|
defaultText = literalExpression "pkgs.flameshot";
|
||||||
|
description = "Package providing <command>flameshot</command>.";
|
||||||
|
};
|
||||||
|
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
type = iniFormat.type;
|
type = iniFormat.type;
|
||||||
default = { };
|
default = { };
|
||||||
|
@ -41,7 +46,7 @@ in {
|
||||||
lib.platforms.linux)
|
lib.platforms.linux)
|
||||||
];
|
];
|
||||||
|
|
||||||
home.packages = [ package ];
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
xdg.configFile = mkIf (cfg.settings != { }) {
|
xdg.configFile = mkIf (cfg.settings != { }) {
|
||||||
"flameshot/flameshot.ini".source = iniFile;
|
"flameshot/flameshot.ini".source = iniFile;
|
||||||
|
@ -60,7 +65,7 @@ in {
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
Environment = "PATH=${config.home.profileDirectory}/bin";
|
Environment = "PATH=${config.home.profileDirectory}/bin";
|
||||||
ExecStart = "${package}/bin/flameshot";
|
ExecStart = "${cfg.package}/bin/flameshot";
|
||||||
Restart = "on-abort";
|
Restart = "on-abort";
|
||||||
|
|
||||||
# Sandboxing.
|
# Sandboxing.
|
||||||
|
|
Loading…
Reference in a new issue