summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authorlassulus <git@lassul.us>2023-01-31 00:34:07 +0100
committerlassulus <git@lassul.us>2023-01-31 00:34:07 +0100
commit62bd490d1e7217898bc793afc20de853ac1e6622 (patch)
tree454b9cbf6f72c54b993487ebc1f8deeb1cbb6506 /krebs
parent369fa6b7eb3f0fa3e1034bcad438eeda017949f8 (diff)
parenta85de9a0deb81f8b8759bfc6a54db0d823ab7a19 (diff)
Merge remote-tracking branch 'ni/master'
Diffstat (limited to 'krebs')
-rw-r--r--krebs/3modules/tinc.nix30
-rw-r--r--krebs/5pkgs/override/default.nix14
-rw-r--r--krebs/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch35
-rw-r--r--krebs/5pkgs/simple/q-power_supply.nix45
4 files changed, 42 insertions, 82 deletions
diff --git a/krebs/3modules/tinc.nix b/krebs/3modules/tinc.nix
index f6727e4d4..52cdafe67 100644
--- a/krebs/3modules/tinc.nix
+++ b/krebs/3modules/tinc.nix
@@ -26,10 +26,7 @@ with import <stockholm/lib>;
Port = ${toString tinc.config.host.nets.${netname}.tinc.port}
${tinc.config.extraConfig}
'';
- "tinc-up" = pkgs.writeDash "${netname}-tinc-up" ''
- ${tinc.config.iproutePackage}/sbin/ip link set ${netname} up
- ${tinc.config.tincUp}
- '';
+ "tinc-up" = pkgs.writeDash "${netname}-tinc-up" tinc.config.tincUp;
});
};
@@ -60,7 +57,8 @@ with import <stockholm/lib>;
default = let
net = tinc.config.host.nets.${netname};
iproute = tinc.config.iproutePackage;
- in ''
+ in /* sh */ ''
+ ${tinc.config.iproutePackage}/sbin/ip link set ${netname} up
${optionalString (net.ip4 != null) /* sh */ ''
${iproute}/sbin/ip -4 addr add ${net.ip4.addr} dev ${netname}
${iproute}/sbin/ip -4 route add ${net.ip4.prefix} dev ${netname}
@@ -69,14 +67,13 @@ with import <stockholm/lib>;
${iproute}/sbin/ip -6 addr add ${net.ip6.addr} dev ${netname}
${iproute}/sbin/ip -6 route add ${net.ip6.prefix} dev ${netname}
''}
- ${tinc.config.tincUpExtra}
'';
- defaultText = ''
- ip -4 addr add ‹net.ip4.addr› dev ${netname}
- ip -4 route add ‹net.ip4.prefix› dev ${netname}
- ip -6 addr add ‹net.ip6.addr› dev ${netname}
- ip -6 route add ‹net.ip6.prefix› dev ${netname}
- ${tinc.config.tincUpExtra}
+ defaultText = /* sh */ ''
+ ip link set ‹netname› up
+ ip -4 addr add ‹net.ip4.addr› dev ‹netname›
+ ip -4 route add ‹net.ip4.prefix› dev ‹netname›
+ ip -6 addr add ‹net.ip6.addr› dev ‹netname›
+ ip -6 route add ‹net.ip6.prefix› dev ‹netname›
'';
description = ''
tinc-up script to be used. Defaults to setting the
@@ -85,11 +82,6 @@ with import <stockholm/lib>;
'';
};
- tincUpExtra = mkOption {
- type = types.str;
- default = "";
- };
-
tincPackage = mkOption {
type = types.package;
default = pkgs.tinc_pre;
@@ -128,9 +120,9 @@ with import <stockholm/lib>;
default =
pkgs.write "${tinc.config.netname}-tinc-hosts"
(mapAttrs'
- (_: host: (nameValuePair "/${host.name}" {
+ (_: host: nameValuePair "/${host.name}" {
text = host.nets.${tinc.config.netname}.tinc.config;
- }))
+ })
tinc.config.hosts);
defaultText = "‹netname›-tinc-hosts";
description = ''
diff --git a/krebs/5pkgs/override/default.nix b/krebs/5pkgs/override/default.nix
index ae42bc1a3..f85f3f678 100644
--- a/krebs/5pkgs/override/default.nix
+++ b/krebs/5pkgs/override/default.nix
@@ -9,20 +9,6 @@ self: super: {
};
});
- flameshot = super.flameshot.overrideAttrs (old: rec {
- name = "flameshot-${version}";
- version = "0.10.2";
- src = self.fetchFromGitHub {
- owner = "flameshot-org";
- repo = "flameshot";
- rev = "v${version}";
- sha256 = "sha256-rZUiaS32C77tFJmEkw/9MGbVTVscb6LOCyWaWO5FyR4=";
- };
- patches = old.patches or [] ++ [
- ./flameshot/flameshot_imgur_0.10.2.patch
- ];
- });
-
# https://github.com/proot-me/PRoot/issues/106
proot = self.writeDashBin "proot" ''
export PROOT_NO_SECCOMP=1
diff --git a/krebs/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch b/krebs/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch
deleted file mode 100644
index c4c0bf38a..000000000
--- a/krebs/5pkgs/override/flameshot/flameshot_imgur_0.10.2.patch
+++ /dev/null
@@ -1,35 +0,0 @@
---- a/src/tools/imgur/imguruploader.cpp
-+++ b/src/tools/imgur/imguruploader.cpp
-@@ -31,6 +31,7 @@
- #include <QTimer>
- #include <QUrlQuery>
- #include <QVBoxLayout>
-+#include <stdlib.h>
-
- ImgurUploader::ImgurUploader(const QPixmap& capture, QWidget* parent)
- : QWidget(parent)
-@@ -79,8 +80,11 @@ void ImgurUploader::handleReply(QNetworkReply* reply)
- m_imageURL.setUrl(data[QStringLiteral("link")].toString());
-
- auto deleteToken = data[QStringLiteral("deletehash")].toString();
-+ char *deleteImageURLPattern = secure_getenv("IMGUR_DELETE_URL");
-+ if (deleteImageURLPattern == NULL)
-+ deleteImageURLPattern = "https://imgur.com/delete/%1";
- m_deleteImageURL.setUrl(
-- QStringLiteral("https://imgur.com/delete/%1").arg(deleteToken));
-+ QString::fromUtf8(deleteImageURLPattern).arg(deleteToken));
-
- // save history
- QString imageName = m_imageURL.toString();
-@@ -133,7 +137,10 @@ void ImgurUploader::upload()
- QString description = FileNameHandler().parsedPattern();
- urlQuery.addQueryItem(QStringLiteral("description"), description);
-
-- QUrl url(QStringLiteral("https://api.imgur.com/3/image"));
-+ char *createImageURLPattern = secure_getenv("IMGUR_CREATE_URL");
-+ if (createImageURLPattern == NULL)
-+ createImageURLPattern = "https://api.imgur.com/3/image";
-+ QUrl url(QString::fromUtf8(createImageURLPattern));
- url.setQuery(urlQuery);
- QNetworkRequest request(url);
- request.setHeader(QNetworkRequest::ContentTypeHeader,
diff --git a/krebs/5pkgs/simple/q-power_supply.nix b/krebs/5pkgs/simple/q-power_supply.nix
index 87f900194..627e3f905 100644
--- a/krebs/5pkgs/simple/q-power_supply.nix
+++ b/krebs/5pkgs/simple/q-power_supply.nix
@@ -8,7 +8,7 @@ writeDashBin "q-power_supply" ''
s/^\([A-Z_]\+=[0-9A-Za-z_-]*\)$/export \1/p
' $uevent)"
case $POWER_SUPPLY_NAME in
- AC)
+ AC|Mains)
exit # not battery
;;
esac
@@ -24,24 +24,41 @@ writeDashBin "q-power_supply" ''
return sprintf("%dh%dm", h, m)
}
- function print_bar(n, r, t1, t2, t_col) {
- t1 = int(r * n)
- t2 = n - t1
- if (r >= .42) t_col = "1;32"
- else if (r >= 23) t_col = "1;33"
- else if (r >= 11) t_col = "1;31"
- else t_col = "5;1;31"
- return sgr(t_col) strdup("■", t1) sgr(";30") strdup("■", t2) sgr()
+ function print_bar(r) {
+ return \
+ (r >= .1 ? bar_gradient[0] : bar_background) "■" \
+ (r >= .2 ? bar_gradient[1] : bar_background) "■" \
+ (r >= .3 ? bar_gradient[2] : bar_background) "■" \
+ (r >= .4 ? bar_gradient[3] : bar_background) "■" \
+ (r >= .5 ? bar_gradient[4] : bar_background) "■" \
+ (r >= .6 ? bar_gradient[5] : bar_background) "■" \
+ (r >= .7 ? bar_gradient[6] : bar_background) "■" \
+ (r >= .8 ? bar_gradient[7] : bar_background) "■" \
+ (r >= .9 ? bar_gradient[8] : bar_background) "■" \
+ (r >= 1 ? bar_gradient[9] : bar_background) "■" \
+ sgr()
+ }
+
+ function rgb(r, g, b) {
+ return sgr("38;2;" r ";" g ";" b)
}
function sgr(p) {
return "\x1b[" p "m"
}
- function strdup(s,n,t) {
- t = sprintf("%"n"s","")
- gsub(/ /,s,t)
- return t
+ BEGIN {
+ bar_gradient[0] = rgb(216, 100, 83)
+ bar_gradient[1] = rgb(210, 113, 72)
+ bar_gradient[2] = rgb(201, 125, 65)
+ bar_gradient[3] = rgb(190, 137, 63)
+ bar_gradient[4] = rgb(178, 148, 67)
+ bar_gradient[5] = rgb(166, 158, 75)
+ bar_gradient[6] = rgb(153, 167, 88)
+ bar_gradient[7] = rgb(140, 174, 104)
+ bar_gradient[8] = rgb(127, 181, 122)
+ bar_gradient[9] = rgb(116, 187, 141)
+ bar_background = rgb( 64, 64, 64)
}
END {
@@ -101,7 +118,7 @@ writeDashBin "q-power_supply" ''
charge_ratio = charge_now / charge_full
out = out name
- out = out sprintf(" %s", print_bar(10, charge_ratio))
+ out = out sprintf(" %s", print_bar(charge_ratio))
out = out sprintf(" %d%", charge_ratio * 100)
out = out sprintf(" %.2f%s", charge_now, charge_unit)
if (current_now != 0) {