forked from flameshot-org/flameshot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
134 lines (115 loc) · 3.82 KB
/
flake.nix
File metadata and controls
134 lines (115 loc) · 3.82 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
{
description = "Powerful yet simple to use screenshot software";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs =
inputs@{
flake-parts,
systems,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = import systems;
imports = [
inputs.treefmt-nix.flakeModule
];
perSystem =
{
pkgs,
lib,
...
}:
let
qtcolorwidgets = pkgs.fetchFromGitLab {
owner = "mattbas";
repo = "Qt-Color-Widgets";
rev = "3.0.0";
hash = "sha256-77G1NU7079pvqhQnSTmMdkd2g1R2hoJxn183WcsWq8c=";
};
kdsingleapplication = pkgs.fetchFromGitHub {
owner = "KDAB";
repo = "KDSingleApplication";
rev = "v1.2.0";
hash = "sha256-rglt89Gw6OHXXVOEwf0TxezDzyHEvWepeGeup7fBlLs=";
};
enableWlrSupport = true;
# Build time
nativeBuildInputs =
with pkgs;
[
cmake
qt6.qttools
qt6.wrapQtAppsHook
makeBinaryWrapper
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
imagemagick
libicns
];
# Run time
buildInputs = with pkgs; [
qt6.qtbase
qt6.qtsvg
qt6.qtwayland
kdePackages.kguiaddons
];
flameshot = pkgs.stdenv.mkDerivation {
pname = "flameshot";
version = "dev";
src = ./.;
inherit nativeBuildInputs;
inherit buildInputs;
preConfigure = ''
mkdir -p build/_deps
cp -r ${qtcolorwidgets} build/_deps/qtcolorwidgets-src
cp -r ${kdsingleapplication} build/_deps/kdsingleapplication-src
chmod -R +w build/_deps
'';
cmakeFlags = [
(lib.cmakeBool "DISABLE_UPDATE_CHECKER" true)
(lib.cmakeBool "USE_WAYLAND_CLIPBOARD" true)
(lib.cmakeBool "USE_WAYLAND_GRIM" enableWlrSupport)
"-DFETCHCONTENT_FULLY_DISCONNECTED=ON"
"-DFETCHCONTENT_SOURCE_DIR_QTCOLORWIDGETS=${qtcolorwidgets}"
"-DFETCHCONTENT_SOURCE_DIR_KDSINGLEAPPLICATION=${kdsingleapplication}"
];
dontWrapQtApps = true;
postFixup = ''
wrapProgram $out/bin/flameshot \
${lib.optionalString enableWlrSupport "--prefix PATH : ${lib.makeBinPath [ pkgs.grim ]}"} \
''${qtWrapperArgs[@]}
'';
meta = {
description = "Powerful yet simple to use screenshot software";
homepage = "https://github.com/flameshot-org/flameshot";
license = pkgs.lib.licenses.gpl3Only;
maintainers = [ "flameshot-org" ];
platforms = pkgs.lib.platforms.unix ++ pkgs.lib.platforms.darwin;
mainProgram = "flameshot";
};
};
in
{
packages = {
default = flameshot;
inherit flameshot;
};
devShells.default = pkgs.mkShell {
name = "flameshot-dev";
inputsFrom = [ flameshot ];
buildInputs = with pkgs; [
gdb
];
};
treefmt = {
programs.nixfmt.enable = pkgs.lib.meta.availableOn pkgs.stdenv.buildPlatform pkgs.nixfmt-rfc-style.compiler;
programs.nixfmt.package = pkgs.nixfmt-rfc-style;
};
};
};
}