nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenvNoCC,
4 fetchFromGitHub,
5 coreutils,
6 makeWrapper,
7 sway-unwrapped,
8 installShellFiles,
9 wl-clipboard,
10 libnotify,
11 slurp,
12 grim,
13 jq,
14 gnugrep,
15 bash,
16
17 python3Packages,
18}:
19
20let
21 version = "0-unstable-2024-03-19";
22 src = fetchFromGitHub {
23 owner = "OctopusET";
24 repo = "sway-contrib";
25 rev = "5d33a290e3cac3f0fed38ff950939da28e3ebfd7";
26 hash = "sha256-2qYxkXowSSzVcpsPO4JoUqaH/VUkOOWu1RKFXp1CXGs=";
27 };
28
29 meta = with lib; {
30 homepage = "https://github.com/OctopusET/sway-contrib";
31 license = licenses.mit;
32 platforms = platforms.all;
33 };
34in
35{
36
37 grimshot = stdenvNoCC.mkDerivation {
38 inherit version src;
39
40 pname = "grimshot";
41
42 dontBuild = true;
43 dontConfigure = true;
44
45 outputs = [
46 "out"
47 "man"
48 ];
49
50 strictDeps = true;
51 nativeBuildInputs = [
52 makeWrapper
53 installShellFiles
54 ];
55 buildInputs = [ bash ];
56 installPhase = ''
57 installManPage grimshot.1
58 installShellCompletion --cmd grimshot grimshot-completion.bash
59
60 install -Dm 0755 grimshot $out/bin/grimshot
61 wrapProgram $out/bin/grimshot --set PATH \
62 "${
63 lib.makeBinPath [
64 sway-unwrapped
65 wl-clipboard
66 coreutils
67 libnotify
68 slurp
69 grim
70 jq
71 gnugrep
72 ]
73 }"
74 '';
75
76 doInstallCheck = true;
77
78 installCheckPhase = ''
79 # check always returns 0
80 if [[ $($out/bin/grimshot check | grep "NOT FOUND") ]]; then false
81 else
82 echo "grimshot check passed"
83 fi
84 '';
85
86 meta =
87 with lib;
88 meta
89 // {
90 description = "Helper for screenshots within sway";
91 maintainers = with maintainers; [ evils ];
92 mainProgram = "grimshot";
93 };
94 };
95
96 inactive-windows-transparency =
97 let
98 # long name is long
99 lname = "inactive-windows-transparency";
100 in
101 python3Packages.buildPythonApplication {
102 inherit version src;
103
104 pname = "sway-${lname}";
105
106 format = "other";
107 dontBuild = true;
108 dontConfigure = true;
109
110 propagatedBuildInputs = [ python3Packages.i3ipc ];
111
112 installPhase = ''
113 install -Dm 0755 $src/${lname}.py $out/bin/${lname}.py
114 '';
115
116 meta =
117 with lib;
118 meta
119 // {
120 description = "It makes inactive sway windows transparent";
121 mainProgram = "${lname}.py";
122 maintainers = with maintainers; [
123 evils # packaged this as a side-effect of grimshot but doesn't use it
124 ];
125 };
126 };
127
128}