fork
Configure Feed
Select the types of activity you want to include in your feed.
nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
fork
Configure Feed
Select the types of activity you want to include in your feed.
1{
2 lib,
3 bash,
4 coreutils,
5 fetchFromGitHub,
6 gawk,
7 gnugrep,
8 gnused,
9 help2man,
10 resholve,
11 xrandr,
12}:
13
14resholve.mkDerivation {
15 pname = "mons";
16 version = "unstable-2020-03-20";
17
18 src = fetchFromGitHub {
19 owner = "Ventto";
20 repo = "mons";
21 rev = "375bbba3aa700c8b3b33645a7fb70605c8b0ff0c";
22 sha256 = "19r5y721yrxhd9jp99s29jjvm0p87vl6xfjlcj38bljq903f21cl";
23 fetchSubmodules = true;
24 };
25
26 /*
27 Remove reference to `%LIBDIR%/liblist.sh`. This would be linked to the
28 non-resholved of the library in the final derivation.
29
30 Patching out the library check; it's bad on multiple levels:
31 1. The check literally breaks if it fails.
32 See https://github.com/Ventto/mons/pull/49
33 2. It doesn't need to do this; source would fail with a
34 sensible message if the script was missing.
35 3. resholve can't wrestle with test/[] (at least until
36 https://github.com/abathur/resholve/issues/78)
37 */
38 postPatch = ''
39 substituteInPlace mons.sh \
40 --replace "lib='%LIBDIR%/liblist.sh'" "" \
41 --replace '[ ! -r "$lib" ] && { "$lib: library not found."; exit 1; }' ""
42 '';
43
44 solutions = {
45 mons = {
46 scripts = [
47 "bin/mons"
48 "lib/libshlist/liblist.sh"
49 ];
50 interpreter = "${bash}/bin/sh";
51 inputs = [
52 bash
53 coreutils
54 gawk
55 gnugrep
56 gnused
57 xrandr
58 ];
59 fix = {
60 "$lib" = [ "lib/libshlist/liblist.sh" ];
61 "$XRANDR" = [ "xrandr" ];
62 };
63 keep = {
64 /*
65 has a whole slate of *flag variables that it sets to either
66 the true or false builtin and then executes...
67 */
68 "$aFlag" = true;
69 "$dFlag" = true;
70 "$eFlag" = true;
71 "$mFlag" = true;
72 "$nFlag" = true;
73 "$oFlag" = true;
74 "$sFlag" = true;
75 "$OFlag" = true;
76 "$SFlag" = true;
77 "$pFlag" = true;
78 "$iFlag" = true;
79 "$xFlag" = true;
80 "$is_flag" = true;
81 };
82 };
83 };
84
85 nativeBuildInputs = [ help2man ];
86
87 makeFlags = [
88 "DESTDIR=$(out)"
89 "PREFIX="
90 ];
91
92 meta = with lib; {
93 description = "POSIX Shell script to quickly manage 2-monitors display";
94 homepage = "https://github.com/Ventto/mons.git";
95 license = licenses.mit;
96 maintainers = with maintainers; [ thiagokokada ];
97 platforms = platforms.unix;
98 mainProgram = "mons";
99 };
100}