blob: 29bb638d81701fb0a74b3ce721c5adab4d12b889 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
{ config, pkgs, lib, ... }:
let
cfg = config.vuizvui.user.aszlig.programs.flameshot;
# TODO: Make configurable via module system.
settings = {
closeAfterScreenshot = true;
disabledTrayIcon = true;
drawColor = "#ff0000";
drawThickness = 2;
saveAfterCopyPath = "$HOME/screenshots";
savePath = "$HOME/screenshots";
savePathFixed = true;
};
in {
options.vuizvui.user.aszlig.programs.flameshot = {
enable = lib.mkEnableOption "Flameshot";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.flameshot.overrideAttrs (drv: {
patches = (drv.patches or []) ++ lib.singleton ./config.patch;
configFile = pkgs.writeText "flameshot.ini" (lib.generators.toINI {} {
General = settings;
});
postPatch = (drv.postPatch or "") + ''
substituteInPlace src/utils/confighandler.cpp --subst-var configFile
'';
});
readOnly = true;
internal = true;
description = "The patched Flameshot package.";
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = lib.singleton cfg.package;
services.dbus.packages = lib.singleton (pkgs.writeTextFile {
name = "flameshot-dbus";
destination = "/share/dbus-1/services/org.flameshot.Flameshot.service";
text = lib.generators.toINI {} {
"D-BUS Service" = {
Name = "org.flameshot.Flameshot";
Exec = "${cfg.package}/bin/flameshot";
};
};
});
};
}
|