summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2023-03-08 19:27:59 +0100
committermakefu <github@syntax-fehler.de>2023-03-08 19:27:59 +0100
commitcaa8f83e79f7373bf234874b8614117c3f7a0710 (patch)
tree9167f06d093d44a662536aa4b5e3d32c271ccca0 /krebs
parent8b4c488bff6b61e2e3ed7c75d96b161a66f5a8c4 (diff)
parent2168f3961298b661fd010add7972a86af77f81de (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'krebs')
-rw-r--r--krebs/1systems/hotdog/config.nix4
-rw-r--r--krebs/1systems/news/config.nix11
-rw-r--r--krebs/2configs/hotdog-host.nix9
-rw-r--r--krebs/2configs/news-host.nix9
-rw-r--r--krebs/2configs/news.nix3
-rw-r--r--krebs/3modules/sync-containers3.nix4
-rw-r--r--krebs/3modules/urlwatch.nix15
-rw-r--r--krebs/5pkgs/haskell/flameshot-once.nix20
-rw-r--r--krebs/5pkgs/haskell/much.nix8
-rw-r--r--krebs/5pkgs/haskell/pager.nix17
-rw-r--r--krebs/5pkgs/simple/flameshot-once/config.nix416
-rw-r--r--krebs/5pkgs/simple/flameshot-once/default.nix161
-rw-r--r--krebs/5pkgs/simple/flameshot-once/flameshot/default.nix16
-rw-r--r--krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.history.patch28
-rw-r--r--krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.imgur.patch43
-rw-r--r--krebs/5pkgs/simple/flameshot-once/profile.nix235
-rw-r--r--krebs/5pkgs/simple/fzfmenu/default.nix9
-rw-r--r--krebs/5pkgs/simple/htgen-imgur/default.nix2
-rw-r--r--krebs/5pkgs/simple/htgen-imgur/src/htgen-imgur2
-rw-r--r--krebs/5pkgs/simple/nixos-format-error.nix107
-rw-r--r--krebs/5pkgs/simple/pager.nix64
-rw-r--r--krebs/5pkgs/simple/xwaitforwindow.nix15
22 files changed, 838 insertions, 360 deletions
diff --git a/krebs/1systems/hotdog/config.nix b/krebs/1systems/hotdog/config.nix
index 9849937d5..70307a96b 100644
--- a/krebs/1systems/hotdog/config.nix
+++ b/krebs/1systems/hotdog/config.nix
@@ -26,4 +26,8 @@
boot.isContainer = true;
networking.useDHCP = false;
+ krebs.sync-containers3.inContainer = {
+ enable = true;
+ pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM20tYHHvwIgrJZzR35ATzH9AlTrM1enNKEQJ7IP6lBh";
+ };
}
diff --git a/krebs/1systems/news/config.nix b/krebs/1systems/news/config.nix
index 620e6249e..b27fc3737 100644
--- a/krebs/1systems/news/config.nix
+++ b/krebs/1systems/news/config.nix
@@ -17,13 +17,8 @@
boot.isContainer = true;
networking.useDHCP = lib.mkForce true;
- krebs.bindfs = {
- "/var/lib/brockman" = {
- source = "/var/state/brockman";
- options = [
- "-m ${toString config.users.users.brockman.uid}:${toString config.users.users.nginx.uid}"
- ];
- clearTarget = true;
- };
+ krebs.sync-containers3.inContainer = {
+ enable = true;
+ pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMBVZomw68WDQy0HsHhNbWK1KpzaR5aRUG1oioE7IgCv";
};
}
diff --git a/krebs/2configs/hotdog-host.nix b/krebs/2configs/hotdog-host.nix
new file mode 100644
index 000000000..95d70376b
--- /dev/null
+++ b/krebs/2configs/hotdog-host.nix
@@ -0,0 +1,9 @@
+{
+ krebs.sync-containers3.containers.hotdog = {
+ sshKey = "${toString <secrets>}/hotdog.sync.key";
+ };
+ containers.hotdog.bindMounts."/var/lib" = {
+ hostPath = "/var/lib/sync-containers3/hotdog/state";
+ isReadOnly = false;
+ };
+}
diff --git a/krebs/2configs/news-host.nix b/krebs/2configs/news-host.nix
index 07674c86e..71793e518 100644
--- a/krebs/2configs/news-host.nix
+++ b/krebs/2configs/news-host.nix
@@ -1,10 +1,5 @@
{
- krebs.sync-containers.containers.news = {
- peers = [
- "shodan"
- "mors"
- "styx"
- ];
- format = "plain";
+ krebs.sync-containers3.containers.news = {
+ sshKey = "${toString <secrets>}/news.sync.key";
};
}
diff --git a/krebs/2configs/news.nix b/krebs/2configs/news.nix
index d6c6371da..9d9470727 100644
--- a/krebs/2configs/news.nix
+++ b/krebs/2configs/news.nix
@@ -74,7 +74,7 @@
limits.identlen = 100;
history.enabled = false;
};
- systemd.services.brockman.bindsTo = [ "ergo.service" ];
+ systemd.services.brockman.bindsTo = [ "ergochat.service" ];
systemd.services.brockman.serviceConfig.LimitNOFILE = 16384;
systemd.services.brockman.environment.BROCKMAN_LOG_LEVEL = "DEBUG";
krebs.brockman = {
@@ -87,6 +87,7 @@
nick = "brockman";
extraChannels = [ "#all" ];
};
+ statePath = "/var/state/brockman/brockman.json";
bots = {};
};
};
diff --git a/krebs/3modules/sync-containers3.nix b/krebs/3modules/sync-containers3.nix
index 4a00b23ab..ed147b30e 100644
--- a/krebs/3modules/sync-containers3.nix
+++ b/krebs/3modules/sync-containers3.nix
@@ -104,7 +104,9 @@ in {
consul lock sync_${ctr.name} ${pkgs.writers.writeDash "${ctr.name}-sync" ''
set -efux
if /run/wrappers/bin/ping -c 1 ${ctr.name}.r; then
- nice --adjustment=30 rsync -a -e "ssh -i $CREDENTIALS_DIRECTORY/ssh_key" --timeout=30 container_sync@${ctr.name}.r:disk "$HOME"/disk
+ nice --adjustment=30 rsync -a -e "ssh -i $CREDENTIALS_DIRECTORY/ssh_key" --timeout=30 --inplace --sparse container_sync@${ctr.name}.r:disk "$HOME"/disk.rsync
+ touch "$HOME"/incomplete
+ nice --adjustment=30 rsync --inplace "$HOME"/disk.rsync "$HOME"/disk
rm -f "$HOME"/incomplete
fi
''}
diff --git a/krebs/3modules/urlwatch.nix b/krebs/3modules/urlwatch.nix
index 2e336de21..113f6e65d 100644
--- a/krebs/3modules/urlwatch.nix
+++ b/krebs/3modules/urlwatch.nix
@@ -71,7 +71,7 @@ let
description = "URL to watch.";
example = [
https://nixos.org/channels/nixos-unstable/git-revision
- { url = http://localhost ; filter = "grep:important.*stuff"; }
+ { url = http://localhost ; filter = [ (grep "important.*stuff") ]; }
];
apply = map (x: getAttr (typeOf x) {
set = x;
@@ -177,12 +177,15 @@ let
echo Date: $(date -R)
echo From: ${shell.escape cfg.from}
echo Subject: $(
- sed -n 's/^\(CHANGED\|ERROR\|NEW\): //p' changes \
- | tr '\n' ' '
+ sed -nr 's/^(CHANGED|ERROR|NEW): //p' changes |
+ sed '1!s/^ //'
)
echo To: ${shell.escape cfg.mailto}
+ echo Mime-Version: 1.0
+ echo Content-Type: text/plain\; charset=UTF-8
+ echo Content-Transfer-Encoding: base64
echo
- cat changes
+ base64 changes
} | /run/wrappers/bin/sendmail -t
fi
''}
@@ -211,7 +214,9 @@ let
};
filter = mkOption {
default = null;
- type = with types; nullOr str; # TODO nullOr subtypes.filter
+ type =
+ with types;
+ nullOr (either str (listOf (pkgs.formats.json {}).type));
};
ignore_cached = mkOption {
default = null;
diff --git a/krebs/5pkgs/haskell/flameshot-once.nix b/krebs/5pkgs/haskell/flameshot-once.nix
deleted file mode 100644
index c8007ce9e..000000000
--- a/krebs/5pkgs/haskell/flameshot-once.nix
+++ /dev/null
@@ -1,20 +0,0 @@
-{ mkDerivation, async, base, blessings, bytestring, dbus, fetchgit
-, iso8601-time, lib, process, random, text, time, unagi-chan, unix
-}:
-mkDerivation {
- pname = "flameshot-once";
- version = "1.4.0";
- src = fetchgit {
- url = "https://cgit.krebsco.de/flameshot-once";
- sha256 = "13szgsiwn29aixm5xvs1m7128y5km5xss0ry5ii5y068rc2vysw8";
- rev = "4475893c2081b3d9db4b7a54d0ce38d0914a17bf";
- fetchSubmodules = true;
- };
- isLibrary = false;
- isExecutable = true;
- executableHaskellDepends = [
- async base blessings bytestring dbus iso8601-time process random
- text time unagi-chan unix
- ];
- license = lib.licenses.mit;
-}
diff --git a/krebs/5pkgs/haskell/much.nix b/krebs/5pkgs/haskell/much.nix
index 5045465e6..865294daf 100644
--- a/krebs/5pkgs/haskell/much.nix
+++ b/krebs/5pkgs/haskell/much.nix
@@ -7,13 +7,13 @@
, servant-server, split, terminal-size, text, time, transformers
, transformers-compat, unix, vector, wai, warp
}:
-mkDerivation {
+mkDerivation rec {
pname = "much";
- version = "1.3.1";
+ version = "1.3.2";
src = fetchgit {
url = "https://cgit.krebsco.de/much";
- sha256 = "0gwyhqcvg9ywna8fhb9hnx97qh5inglj3l0pcwkgwcvm27mfpcqa";
- rev = "77357335a3a88a4b93f91a46ab939a1a9b192977";
+ hash = "sha256-q65EYO1d3NYVv2NECkGWPb1TyHGdARNi/GX4pgQmljc=";
+ rev = "refs/tags/${version}";
fetchSubmodules = true;
};
isLibrary = true;
diff --git a/krebs/5pkgs/haskell/pager.nix b/krebs/5pkgs/haskell/pager.nix
index 2f4a71f34..36709788c 100644
--- a/krebs/5pkgs/haskell/pager.nix
+++ b/krebs/5pkgs/haskell/pager.nix
@@ -1,21 +1,22 @@
-{ mkDerivation, base, blessings, bytestring, containers
-, data-default, hack, lib, optparse-applicative, probability
-, scanner, speculate, split, terminal-size, text, unix, X11
-, fetchgit
+{ mkDerivation, aeson, base, blessings, bytestring, containers
+, data-default, extra, fetchgit, hack, lib, optparse-applicative
+, probability, scanner, speculate, split, terminal-size, text, unix
+, utf8-string, X11
}:
mkDerivation {
pname = "pager";
version = "1.0.0";
src = fetchgit {
url = "https://cgit.krebsco.de/pager";
- sha256 = "1qlkhqidaa6w02ix9ambfdsm7lfyx30ap481b9ic1ppyfkhqzfp6";
- rev = "fc6105a5e7d1e3a07bf07ea85e7902dd8e9fc849";
+ sha256 = "07wjlhnb27vfhkqq5vhi768mlrcpwl4b2yfk04v3lw047q6pmby0";
+ rev = "dfa3ff346d22d332ffbadd46963f1cc5cb2a4939";
fetchSubmodules = true;
};
- isLibrary = false;
+ isLibrary = true;
isExecutable = true;
+ libraryHaskellDepends = [ base extra utf8-string X11 ];
executableHaskellDepends = [
- base blessings bytestring containers data-default hack
+ aeson base blessings bytestring containers data-default hack
optparse-applicative probability scanner speculate split
terminal-size text unix X11
];
diff --git a/krebs/5pkgs/simple/flameshot-once/config.nix b/krebs/5pkgs/simple/flameshot-once/config.nix
new file mode 100644
index 000000000..24df403aa
--- /dev/null
+++ b/krebs/5pkgs/simple/flameshot-once/config.nix
@@ -0,0 +1,416 @@
+{ config, pkgs, ... }:
+with pkgs.stockholm.lib;
+
+let
+ # Encode integer to C-escaped string of bytes, little endian / LSB 0
+ le = rec {
+ x1 = i: let
+ i0 = mod i 16;
+ i1 = i / 16;
+ in
+ if i == 0 then
+ "\\0"
+ else if i < 16 then
+ "\\x${elemAt hexchars i0}"
+ else
+ "\\x${elemAt hexchars i1}${elemAt hexchars i0}";
+
+ x2 = i: let
+ i0 = mod i 256;
+ i1 = i / 256;
+ in
+ "${x1 i1}${x1 i0}";
+
+ x4 = i: let
+ i0 = mod i 65536;
+ i1 = i / 65536;
+ in
+ "${x2 i1}${x2 i0}";
+ };
+
+ toQList = t: xs:
+ assert t == "int";
+ "QList<${t}>${le.x4 0}${le.x1 (length xs)}${concatMapStrings le.x4 xs}";
+in
+
+{
+ options = {
+ imgur = mkOption {
+ default = {};
+ type = types.submodule {
+ options = {
+ enable = mkEnableOption "imgur";
+ createUrl = mkOption {
+ example = "http://p.r/image";
+ type = types.str;
+ };
+ deleteUrl = mkOption {
+ example = "http://p.r/image/delete/%1";
+ type = types.str;
+ };
+ xdg-open = mkOption {
+ default = {};
+ type = types.submodule {
+ options = {
+ enable = mkEnableOption "imgur.xdg-open" // {
+ default = true;
+ };
+ browser = mkOption {
+ default = "${pkgs.coreutils}/bin/false";
+ type = types.str;
+ };
+ createPrefix = mkOption {
+ default = config.imgur.createUrl;
+ type = types.str;
+ };
+ deletePrefix = mkOption {
+ default = removeSuffix "/%1" config.imgur.deleteUrl;
+ type = types.str;
+ };
+ };
+ };
+ };
+ };
+ };
+ };
+ package = mkOption {
+ type = types.package;
+ default = import ./flameshot { inherit pkgs; };
+ };
+ settings = {
+ # Options without a description are not documented in flameshot's README.
+ # Compare with:
+ # nix-shell -p flameshot-once.dev --run get-recognizedGeneralOptions
+ General = mapAttrs (_: recursiveUpdate { default = null; }) {
+ allowMultipleGuiInstances = mkOption {
+ description = ''
+ Allow multiple instances of `flameshot gui` to run at the same time
+ '';
+ type = with types; nullOr bool;
+ };
+ antialiasingPinZoom = mkOption {
+ description = ''
+ Anti-aliasing image when zoom the pinned image
+ '';
+ type = with types; nullOr bool;
+ };
+ autoCloseIdleDaemon = mkOption {
+ description = ''
+ Automatically close daemon when it's not needed
+ '';
+ type = with types; nullOr bool;
+ };
+ buttons = let
+ buttonTypes = {
+ # Generated with:
+ # nix-shell -p flameshot-once.dev --run get-buttonTypes
+ TYPE_PENCIL = 0;
+ TYPE_DRAWER = 1;
+ TYPE_ARROW = 2;
+ TYPE_SELECTION = 3;
+ TYPE_RECTANGLE = 4;
+ TYPE_CIRCLE = 5;
+ TYPE_MARKER = 6;
+ TYPE_SELECTIONINDICATOR = 7;
+ TYPE_MOVESELECTION = 8;
+ TYPE_UNDO = 9;
+ TYPE_COPY = 10;
+ TYPE_SAVE = 11;
+ TYPE_EXIT = 12;
+ TYPE_IMAGEUPLOADER = 13;
+ TYPE_OPEN_APP = 14;
+ TYPE_PIXELATE = 15;
+ TYPE_REDO = 16;
+ TYPE_PIN = 17;
+ TYPE_TEXT = 18;
+ TYPE_CIRCLECOUNT = 19;
+ TYPE_SIZEINCREASE = 20;
+ TYPE_SIZEDECREASE = 21;
+ TYPE_INVERT = 22;
+ TYPE_ACCEPT = 23;
+ };
+ iterableButtonTypes = [
+ # Generated with:
+ # nix-shell -p flameshot-once.dev --run get-iterableButtonTypes
+ "TYPE_ACCEPT"
+ "TYPE_ARROW"
+ "TYPE_CIRCLE"
+ "TYPE_CIRCLECOUNT"
+ "TYPE_COPY"
+ "TYPE_DRAWER"
+ "TYPE_EXIT"
+ "TYPE_IMAGEUPLOADER"
+ "TYPE_MARKER"
+ "TYPE_MOVESELECTION"
+ "TYPE_OPEN_APP"
+ "TYPE_PENCIL"
+ "TYPE_PIN"
+ "TYPE_PIXELATE"
+ "TYPE_RECTANGLE"
+ "TYPE_REDO"
+ "TYPE_SAVE"
+ "TYPE_SELECTION"
+ "TYPE_SIZEDECREASE"
+ "TYPE_SIZEINCREASE"
+ "TYPE_TEXT"
+ "TYPE_UNDO"
+ ];
+ in mkOption {
+ apply = names:
+ if names != null then let
+ values = map (name: buttonTypes.${name}) names;
+ in
+ ''@Variant(\0\0\0\x7f\0\0\0\v${toQList "int" values})''
+ else
+ null;
+ description = ''
+ Configure which buttons to show after drawing a selection
+ '';
+ type = with types; nullOr (listOf (enum iterableButtonTypes));
+ };
+ checkForUpdates = mkOption {
+ type = with types; nullOr bool;
+ };
+ contrastOpacity = mkOption {
+ description = ''
+ Opacity of area outside selection
+ '';
+ type = with types; nullOr (boundedInt 0 255);
+ };
+ contrastUiColor = mkOption {
+ description = ''
+ Contrast UI color
+ '';
+ type = with types; nullOr flameshot.color;
+ };
+ copyAndCloseAfterUpload = mkOption {
+ type = with types; nullOr bool;
+ };
+ copyOnDoubleClick = mkOption {
+ type = with types; nullOr bool;
+ };
+ copyPathAfterSave = mkOption {
+ description = ''
+ Copy path to image after save
+ '';
+ type = with types; nullOr bool;
+ };
+ copyURLAfterUpload = mkOption {
+ description = ''
+ On successful upload, close the dialog and copy URL to clipboard
+ '';
+ type = with types; nullOr bool;
+ };
+ disabledTrayIcon = mkOption {
+ description = ''
+ Whether the tray icon is disabled
+ '';
+ type = with types; nullOr bool;
+ };
+ drawColor = mkOption {
+ description = ''
+ Last used color
+ '';
+ type = with types; nullOr flameshot.color;
+ };
+ drawFontSize = mkOption {
+ type = with types; nullOr positive;
+ };
+ drawThickness = mkOption {
+ description = ''
+ Last used tool thickness
+ '';
+ type = with types; nullOr positive;
+ };
+ filenamePattern = mkOption {
+ description = ''
+ Filename pattern using C++ strftime formatting
+ '';
+ type =
+ # This is types.filename extended by [%:][%:+]*
+ with types;
+ nullOr (addCheck str (test "[%:0-9A-Za-z._][%:+0-9A-Za-z._-]*"));
+ };
+ fontFamily = mkOption {
+ type = with types; nullOr str;
+ };
+ historyConfirmationToDelete = mkOption {
+ type = with types; nullOr bool;
+ };
+ ignoreUpdateToVersion = mkOption {
+ description = ''
+ Ignore updates to versions less than this value
+ '';
+ type = with types; nullOr str;
+ };
+ keepOpenAppLauncher = mkOption {
+ description = ''
+ Keep the App Launcher open after selecting an app
+ '';
+ type = with types; nullOr bool;
+ };
+ predefinedColorPaletteLarge = mkOption {
+ description = ''
+ Use larger color palette as the default one
+ '';
+ type = with types; nullOr bool;
+ };
+ saveAfterCopy = mkOption {
+ description = ''
+ Save image after copy
+ '';
+ type = with types; nullOr bool;
+ };
+ saveAsFileExtension = mkOption {
+ description = ''
+ Default file extension for screenshots
+ '';
+ type = with types; nullOr (addCheck filename (hasPrefix "."));
+ };
+ safeLastRegion = mkOption {
+ type = with types; nullOr bool;
+ };
+ savePath = mkOption {
+ description = ''
+ Image Save Path
+ '';
+ type = with types; nullOr absolute-pathname;
+ };
+ savePathFixed = mkOption {
+ description = ''
+ Whether the savePath is a fixed path
+ '';
+ type = with types; nullOr bool;
+ };
+ showDesktopNotification = mkOption {
+ description = ''
+ Show desktop notifications
+ '';
+ type = with types; nullOr bool;
+ };
+ showHelp = mkOption {
+ description = ''
+ Show the help screen on startup
+ '';
+ type = with types; nullOr bool;
+ };
+ showMagnifier = mkOption {
+ type = with types; nullOr bool;
+ };
+ showSelectionGeometry = mkOption {
+ type = with types; nullOr (boundedInt 0 5);
+ };
+ showSelectionGeometryHideTime = mkOption {
+ type = with types; nullOr uint;
+ };
+ showSidePanelButton = mkOption {
+ description = ''
+ Show the side panel button
+ '';
+ type = with types; nullOr bool;
+ };
+ showStartupLaunchMessage = mkOption {
+ type = with types; nullOr bool;
+ };
+ squareMagnifier = mkOption {
+ type = with types; nullOr bool;
+ };
+ startupLaunch = mkOption {
+ description = ''
+ Launch at startup
+ '';
+ type = with types; nullOr bool;
+ };
+ uiColor = mkOption {
+ description = ''
+ Main UI color
+ '';
+ type = with types; nullOr flameshot.color;
+ };
+ undoLimit = mkOption {
+ type = with types; nullOr (boundedInt 0 999);
+ };
+ uploadClientSecret = mkOption {
+ type = with types; nullOr str;
+ };
+ uploadHistoryMax = mkOption {
+ type = with types; nullOr uint;
+ };
+ uploadWithoutConfirmation = mkOption {
+ description = ''
+ Upload to imgur without confirmation
+ '';
+ type = with types; nullOr bool;
+ };
+ useJpgForClipboard = mkOption {
+ description = ''
+ Use JPG format instead of PNG
+ '';
+ type = with types; nullOr bool;
+ };
+ userColors = mkOption {
+ apply = value:
+ if value != null then
+ concatStringsSep ", " value
+ else
+ null;
+ description = ''
+ List of colors for color picker
+ The colors are arranged counter-clockwise with the first being set
+ to the right of the cursor. "picker" adds a custom color picker.
+ '';
+ type =
+ with types;
+ nullOr (listOf (either flameshot.color (enum ["picker"])));
+ };
+ };
+ Shortcuts = genAttrs [
+ # Generated with:
+ # nix-shell -p flameshot-once.dev --run get-Shortcuts
+ "TYPE_ACCEPT"
+ "TYPE_ARROW"
+ "TYPE_CIRCLE"
+ "TYPE_CIRCLECOUNT"
+ "TYPE_COMMIT_CURRENT_TOOL"
+ "TYPE_COPY"
+ "TYPE_DELETE_CURRENT_TOOL"
+ "TYPE_DRAWER"
+ "TYPE_EXIT"
+ "TYPE_IMAGEUPLOADER"
+ "TYPE_INVERT"
+ "TYPE_MARKER"
+ "TYPE_MOVESELECTION"
+ "TYPE_MOVE_DOWN"
+ "TYPE_MOVE_LEFT"
+ "TYPE_MOVE_RIGHT"
+ "TYPE_MOVE_UP"
+ "TYPE_OPEN_APP"
+ "TYPE_PENCIL"
+ "TYPE_PIN"
+ "TYPE_PIXELATE"
+ "TYPE_RECTANGLE"
+ "TYPE_REDO"
+ "TYPE_RESIZE_DOWN"
+ "TYPE_RESIZE_LEFT"
+ "TYPE_RESIZE_RIGHT"
+ "TYPE_RESIZE_UP"
+ "TYPE_SAVE"
+ "TYPE_SELECTION"
+ "TYPE_SELECTIONINDICATOR"
+ "TYPE_SELECT_ALL"
+ "TYPE_SIZEDECREASE"
+ "TYPE_SIZEINCREASE"
+ "TYPE_SYM_RESIZE_DOWN"
+ "TYPE_SYM_RESIZE_LEFT"
+ "TYPE_SYM_RESIZE_RIGHT"
+ "TYPE_SYM_RESIZE_UP"
+ "TYPE_TEXT"
+ "TYPE_TOGGLE_PANEL"
+ "TYPE_UNDO"
+ ] (name: mkOption {
+ default = null;
+ type = with types; nullOr str;
+ });
+ };
+ };
+}
diff --git a/krebs/5pkgs/simple/flameshot-once/default.nix b/krebs/5pkgs/simple/flameshot-once/default.nix
index 0524c2cfa..3626409f3 100644
--- a/krebs/5pkgs/simple/flameshot-once/default.nix
+++ b/krebs/5pkgs/simple/flameshot-once/default.nix
@@ -1,28 +1,149 @@
-{ pkgs, stockholm, ... }@args:
-with stockholm.lib;
+{ name ? "flameshot-once", pkgs, ... }@args:
+with pkgs.stockholm.lib;
let
# config cannot be declared in the input attribute set because that would
# cause callPackage to inject the wrong config. Instead, get it from ...
# via args.
config = args.config or {};
-in
- pkgs.symlinkJoin {
- name = "flameshot-once-wrapper";
- paths = [
- (pkgs.writeDashBin "flameshot-once" ''
- export PATH=${makeBinPath [
- pkgs.flameshot
- pkgs.qt5.qtbase
- pkgs.xclip
- pkgs.xwaitforwindow
- ]}
- ${optionalString (config != null) /* sh */ ''
- . ${import ./profile.nix { inherit config pkgs; }}
- ''}
- exec ${pkgs.haskellPackages.flameshot-once}/bin/flameshot-once "$@"
- '')
- pkgs.haskellPackages.flameshot-once
+ cfg = evalModulesConfig (singleton {
+ _file = toString ./default.nix;
+ _module.args.pkgs = pkgs;
+ imports = [
+ config
+ ./config.nix
];
- }
+ });
+in
+
+pkgs.symlinkJoin {
+ inherit name;
+ paths = [
+ (pkgs.write "flameshot-once" {
+ "/bin/flameshot-once" = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ export PATH=${makeBinPath [
+ pkgs.qt5.qtbase
+ ]}:''${PATH+:$PATH}
+ ${optionalString (config != null) /* sh */ ''
+ export XDG_CONFIG_HOME=${placeholder "out"}/etc
+ ${optionalString cfg.imgur.enable /* sh */ ''
+ export IMGUR_CREATE_URL=${shell.escape cfg.imgur.createUrl}
+ export IMGUR_DELETE_URL=${shell.escape cfg.imgur.deleteUrl}
+ ${optionalString cfg.imgur.xdg-open.enable /* sh */ ''
+ export PATH=${placeholder "out"}/lib/imgur/bin''${PATH+:$PATH}
+ ''}
+ ''}
+ ''}
+ ${cfg.package}/bin/flameshot &
+ exec ${cfg.package}/bin/flameshot gui
+ '';
+ };
+ "/etc/flameshot/flameshot.ini".text =
+ lib.generators.toINI {} (stripAttr cfg.settings);
+ ${if cfg.imgur.enable then "/lib/imgur/bin/xdg-open" else null} = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ set -efu
+ uri=$1
+ prefix=$(${pkgs.coreutils}/bin/dirname "$uri")
+ case $prefix in
+ (${shell.escape cfg.imgur.xdg-open.createPrefix})
+ echo "opening image in browser: $uri" >&2
+ exec ${config.imgur.xdg-open.browser} "$uri"
+ ;;
+ (${shell.escape cfg.imgur.xdg-open.deletePrefix})
+ echo "deleting image: $uri" >&2
+ exec ${pkgs.curl}/bin/curl -fsS -X DELETE "$uri"
+ ;;
+ (*)
+ echo "don't know how to open URI: $uri" >&2
+ exit 1
+ esac
+ '';
+ };
+ })
+ ];
+}
+// {
+ dev = pkgs.write "flameshot-once-tools" {
+ "/bin/get-buttonTypes" = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ indent=$(${placeholder "out"}/bin/indent-of buttonTypes)
+ src=${cfg.package.src}/src/tools/capturetool.h
+ ${pkgs.coreutils}/bin/cat "$src" |
+ ${pkgs.gnused}/bin/sed -nr '
+ s/^\s*(TYPE_\S+)\s*=\s*([0-9]+),/\1 = \2;/p
+ ' |
+ ${placeholder "out"}/bin/prefix " $indent"
+ '';
+ };
+ "/bin/get-iterableButtonTypes" = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ indent=$(${placeholder "out"}/bin/indent-of iterableButtonTypes)
+ src=${cfg.package.src}/src/widgets/capture/capturetoolbutton.cpp
+ ${pkgs.coreutils}/bin/cat "$src" |
+ ${pkgs.gnused}/bin/sed -n '/\<iterableButtonTypes = {/,/^}/p' |
+ ${pkgs.gcc}/bin/cpp |
+ ${pkgs.coreutils}/bin/tr , \\n |
+ ${pkgs.gnused}/bin/sed -rn 's/^ *CaptureTool::(TYPE_[A-Z_]+).*/"\1"/p' |
+ ${pkgs.coreutils}/bin/sort |
+ ${placeholder "out"}/bin/prefix " $indent"
+ '';
+ };
+ "/bin/get-recognizedGeneralOptions" = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ src=${cfg.package.src}/src/utils/confighandler.cpp
+ ${pkgs.coreutils}/bin/cat "$src" |
+ ${pkgs.gnused}/bin/sed -n '/\<recognizedGeneralOptions = {/,/^};/p' |
+ ${pkgs.gcc}/bin/cpp |
+ ${pkgs.gnugrep}/bin/grep -F OPTION |
+ ${pkgs.coreutils}/bin/sort
+ '';
+ };
+ "/bin/get-Shortcuts" = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ indent=$(${placeholder "out"}/bin/indent-of Shortcuts)
+ src=${cfg.package.src}/src/utils/confighandler.cpp
+ ${pkgs.coreutils}/bin/cat "$src" |
+ ${pkgs.gnused}/bin/sed -n '/recognizedShortcuts = {/,/^};/p ' |
+ ${pkgs.gcc}/bin/cpp |
+ ${pkgs.gnused}/bin/sed -nr 's/^\s*SHORTCUT\("(TYPE_[^"]+).*/"\1"/p' |
+ ${pkgs.coreutils}/bin/sort |
+ ${placeholder "out"}/bin/prefix " $indent"
+ '';
+ };
+ "/bin/indent-of" = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ # usage: indent-of NAME NIX_FILE
+ exec ${pkgs.gawk}/bin/awk -v name="$1" '
+ $1 == name && $2 == "=" {
+ sub("[^ ].*", "")
+ print
+ }
+ ' ${./config.nix}
+ '';
+ };
+ "/bin/prefix" = {
+ executable = true;
+ text = /* sh */ ''
+ #! ${pkgs.dash}/bin/dash
+ ${pkgs.gawk}/bin/awk -v prefix="$1" '{ print prefix $0 }'
+ '';
+ };
+ };
+}
diff --git a/krebs/5pkgs/simple/flameshot-once/flameshot/default.nix b/krebs/5pkgs/simple/flameshot-once/flameshot/default.nix
new file mode 100644
index 000000000..f60acef08
--- /dev/null
+++ b/krebs/5pkgs/simple/flameshot-once/flameshot/default.nix
@@ -0,0 +1,16 @@
+{ pkgs }:
+
+pkgs.flameshot.overrideAttrs (old: rec {
+ name = "flameshot-${version}";
+ version = "12.1.0-pre";
+ src = pkgs.fetchFromGitHub {
+ owner = "flameshot-org";
+ repo = "flameshot";
+ rev = "f7e41f4d708e50eeaec892408069da25a28e04a2";
+ hash = "sha256-fZquXY0xSaN1hJgCh16MocIlvxHe1c2Nt+fGF2NIOVw=";
+ };
+ patches = old.patches or [] ++ [
+ ./flameshot-12.imgur.patch
+ ./flameshot-12.history.patch
+ ];
+})
diff --git a/krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.history.patch b/krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.history.patch
new file mode 100644
index 000000000..66f28a661
--- /dev/null
+++ b/krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.history.patch
@@ -0,0 +1,28 @@
+diff --git a/src/utils/history.cpp b/src/utils/history.cpp
+index f3ee09d0..7c85c34b 100644
+--- a/src/utils/history.cpp
++++ b/src/utils/history.cpp
+@@ -76,9 +76,9 @@ const HistoryFileName& History::unpackFileName(const QString& fileNamePacked)
+ int nPathIndex = fileNamePacked.lastIndexOf("/");
+ QStringList unpackedFileName;
+ if (nPathIndex == -1) {
+- unpackedFileName = fileNamePacked.split("-");
++ unpackedFileName = fileNamePacked.split("|");
+ } else {
+- unpackedFileName = fileNamePacked.mid(nPathIndex + 1).split("-");
++ unpackedFileName = fileNamePacked.mid(nPathIndex + 1).split("|");
+ }
+
+ switch (unpackedFileName.length()) {
+@@ -109,9 +109,9 @@ const QString& History::packFileName(const QString& storageType,
+ if (storageType.length() > 0) {
+ if (deleteToken.length() > 0) {
+ m_packedFileName =
+- storageType + "-" + deleteToken + "-" + m_packedFileName;
++ storageType + "|" + deleteToken + "|" + m_packedFileName;
+ } else {
+- m_packedFileName = storageType + "-" + m_packedFileName;
++ m_packedFileName = storageType + "|" + m_packedFileName;
+ }
+ }
+ return m_packedFileName;
diff --git a/krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.imgur.patch b/krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.imgur.patch
new file mode 100644
index 000000000..b6c3f497a
--- /dev/null
+++ b/krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.imgur.patch
@@ -0,0 +1,43 @@
+diff --git a/src/tools/imgupload/storages/imgur/imguruploader.cpp b/src/tools/imgupload/storages/imgur/imguruploader.cpp
+index d6748b5a..5bb8d7de 100644
+--- a/src/tools/imgupload/storages/imgur/imguruploader.cpp
++++ b/src/tools/imgupload/storages/imgur/imguruploader.cpp
+@@ -16,6 +16,7 @@
+ #include <QNetworkRequest>
+ #include <QShortcut>
+ #include <QUrlQuery>
++#include <stdlib.h>
+
+ ImgurUploader::ImgurUploader(const QPixmap& capture, QWidget* parent)
+ : ImgUploaderBase(capture, parent)
+@@ -70,7 +71,13 @@ void ImgurUploader::upload()
+ QString description = FileNameHandler().parsedPattern();
+ urlQuery.addQueryItem(QStringLiteral("description"), description);
+
+- QUrl url(QStringLiteral("https://api.imgur.com/3/image"));
++ const char *IMGUR_CREATE_URL = secure_getenv("IMGUR_CREATE_URL");
++ QString createUrlPattern =
++ IMGUR_CREATE_URL != NULL
++ ? QString::fromUtf8(IMGUR_CREATE_URL)
++ : QStringLiteral("https://api.imgur.com/3/image")
++ ;
++ QUrl url(createUrlPattern);
+ url.setQuery(urlQuery);
+ QNetworkRequest request(url);
+ request.setHeader(QNetworkRequest::ContentTypeHeader,
+@@ -87,8 +94,14 @@ void ImgurUploader::deleteImage(const QString& fileName,
+ const QString& deleteToken)
+ {
+ Q_UNUSED(fileName)
++ const char *IMGUR_DELETE_URL = secure_getenv("IMGUR_DELETE_URL");
++ QString deleteImageURLPattern =
++ IMGUR_DELETE_URL != NULL
++ ? QString::fromUtf8(IMGUR_DELETE_URL)
++ : QStringLiteral("https://imgur.com/delete/%1")
++ ;
+ bool successful = QDesktopServices::openUrl(
+- QUrl(QStringLiteral("https://imgur.com/delete/%1").arg(deleteToken)));
++ QUrl(deleteImageURLPattern.arg(deleteToken)));
+ if (!successful) {
+ notification()->showMessage(tr("Unable to open the URL."));
+ }
diff --git a/krebs/5pkgs/simple/flameshot-once/profile.nix b/krebs/5pkgs/simple/flameshot-once/profile.nix
deleted file mode 100644
index 269f13a66..000000000
--- a/krebs/5pkgs/simple/flameshot-once/profile.nix
+++ /dev/null
@@ -1,235 +0,0 @@
-{ config, pkgs }:
-with pkgs.stockholm.lib;
-with generators;
-let
-
- # Refs https://github.com/lupoDharkael/flameshot/blob/master/src/widgets/capture/capturebutton.h
- ButtonType = {
- PENCIL = 0;
- DRAWER = 1;
- ARROW = 2;
- SELECTION = 3;
- RECTANGLE = 4;
- CIRCLE = 5;
- MARKER = 6;
- SELECTIONINDICATOR = 7;
- MOVESELECTION = 8;
- UNDO = 9;
- COPY = 10;
- SAVE = 11;
- EXIT = 12;
- IMAGEUPLOADER = 13;
- OPEN_APP = 14;
- BLUR = 15;
- REDO = 16;
- PIN = 17;
- TEXT = 18;
- CIRCLECOUNT = 19;
- };
-
- cfg = eval.config;
-
- eval = evalModules {
- modules = singleton {
- _file = toString ./profile.nix;
- imports = singleton config;
- options = {
- buttons = mkOption {
- apply = map (name: ButtonType.${name});
- default = [
- "PENCIL"
- "DRAWER"
- "ARROW"
- "SELECTION"
- "RECTANGLE"
- "CIRCLE"
- "MARKER"
- "SELECTIONINDICATOR"
- "MOVESELECTION"
- "UNDO"
- "SAVE"
- "EXIT"
- "BLUR"
- "CIRCLECOUNT"
- ]
- ++ optional cfg.imgur.enable "IMAGEUPLOADER"
- ;
- type = types.listOf (types.enum (attrNames ButtonType));
- };
- copyAndCloseAfterUpload = mkOption {
- default = false;
- type = types.bool;
- };
- disabledTrayIcon = mkOption {
- default = true;
- type = types.bool;
- };
- drawColor = mkOption {
- default = "#ff0000";
- type =
- types.addCheck types.str (test "#[0-9A-Fa-f]{6}");
- };
- drawThickness = mkOption {
- default = 8;
- type = types.positive;
- };
- filenamePattern = mkOption {
- default = "%FT%T%z_flameshot";
- type =
- # This is types.filename extended by [%:][%:+]*
- types.addCheck types.str (test "[%:0-9A-Za-z._][%:+0-9A-Za-z._-]*");
- };
- imgur = mkOption {
- default = {};
- type = types.submodule {
- options = {
- enable = mkEnableOption "imgur";
- createUrl = mkOption {
- example = "http://p.r/image";
- type = types.str;
- };
- deleteUrl = mkOption {
- example = "http://p.r/image/delete/%1";
- type = types.str;
- };
- xdg-open = mkOption {
- default = {};
- type = types.submodule {
- options = {
- enable = mkEnableOption "imgur.xdg-open" // {
- default = true;
- };
- browser = mkOption {
- default = "${pkgs.coreutils}/bin/false";
- type = types.str;
- };
- createPrefix = mkOption {
- default = cfg.imgur.createUrl;
- type = types.str;
- };
- deletePrefix = mkOption {
- default = removeSuffix "/%1" cfg.imgur.deleteUrl;
- type = types.str;
- };
- };
- };
- };
- };
- };
- };
- savePath = mkOption {
- default = "/tmp";
- type = types.absolute-pathname;
- };
- showDesktopNotification = mkOption {
- default = false;
- type = types.bool;
- };
- showHelp = mkOption {
- default = false;
- type = types.bool;
- };
- showSidePanelButton = mkOption {
- default = false;
- type = types.bool;
- };
- showStartupLaunchMessage = mkOption {
- default = false;
- type = types.bool;
- };
- timeout = mkOption {
- default = 200;
- description = ''
- Maximum time in milliseconds allowed for the flameshot daemon to
- react.
- '';
- type = types.positive;
- };
- };
- };
- };
-
- hexchars = stringToCharacters "0123456789abcdef";
-
- # Encode integer to C-escaped string of bytes, little endian / LSB 0
- le = rec {
- x1 = i: let
- i0 = mod i 16;
- i1 = i / 16;
- in
- "\\x${elemAt hexchars i1}${elemAt hexchars i0}";
-
- x2 = i: let
- i0 = mod i 256;
- i1 = i / 256;
- in
- "${x1 i0}${x1 i1}";
-
- x4 = i: let
- i0 = mod i 65536;
- i1 = i / 65536;
- in
- "${x2 i0}${x2 i1}";
- };
-
- toQList = t: xs:
- assert t == "int";
- "QList<${t}>${le.x4 0}${le.x4 (length xs)}${concatMapStrings le.x4 xs}";
-
- XDG_CONFIG_HOME = pkgs.write "flameshot-config" {
- "/flameshot/flameshot.ini".text =
- toINI {} {
- General = {
- buttons = ''@Variant(\0\0\0\x7f\0\0\0\v${toQList "int" cfg.buttons})'';
- disabledTrayIcon = cfg.disabledTrayIcon;
- checkForUpdates = false;
- copyAndCloseAfterUpload = cfg.copyAndCloseAfterUpload;
- drawColor = cfg.drawColor;
- drawThickness = cfg.drawThickness;
- filenamePattern = cfg.filenamePattern;
- savePath = cfg.savePath;
- showDesktopNotification = cfg.showDesktopNotification;
- showHelp = cfg.showHelp;
- showSidePanelButton = cfg.showSidePanelButton;
- showStartupLaunchMessage = cfg.showStartupLaunchMessage;
- startupLaunch = false;
- };
- Shortcuts = {
- TYPE_COPY = "Return";
- };
- };
- };
-
-in
-
- pkgs.writeDash "flameshot.profile" ''
- export FLAMESHOT_CAPTURE_PATH=${cfg.savePath}
- export FLAMESHOT_ONCE_TIMEOUT=${toString cfg.timeout}
- export XDG_CONFIG_HOME=${XDG_CONFIG_HOME}
- ${optionalString cfg.imgur.enable /* sh */ ''
- export IMGUR_CREATE_URL=${shell.escape cfg.imgur.createUrl}
- export IMGUR_DELETE_URL=${shell.escape cfg.imgur.deleteUrl}
- ${optionalString cfg.imgur.xdg-open.enable /* sh */ ''
- PATH=$PATH:${makeBinPath [
- (pkgs.writeDashBin "xdg-open" ''
- set -efu
- uri=$1
- prefix=$(${pkgs.coreutils}/bin/dirname "$uri")
- case $prefix in
- (${shell.escape cfg.imgur.xdg-open.createPrefix})
- echo "opening image in browser: $uri" >&2
- exec ${config.imgur.xdg-open.browser} "$uri"
- ;;
- (${shell.escape cfg.imgur.xdg-open.deletePrefix})
- echo "deleting image: $uri" >&2
- exec ${pkgs.curl}/bin/curl -fsS -X DELETE "$uri"
- ;;
- (*)
- echo "don't know how to open URI: $uri" >&2
- exit 1
- esac
- '')
- ]}
- ''}
- ''}
- ''
diff --git a/krebs/5pkgs/simple/fzfmenu/default.nix b/krebs/5pkgs/simple/fzfmenu/default.nix
index 4527ad90b..fe5d5e27a 100644
--- a/krebs/5pkgs/simple/fzfmenu/default.nix
+++ b/krebs/5pkgs/simple/fzfmenu/default.nix
@@ -48,10 +48,11 @@ pkgs.writeDashBin "fzfmenu" ''
exec 4>&1
export FZFMENU_INPUT_FD=3
export FZFMENU_OUTPUT_FD=4
- exec ${pkgs.rxvt-unicode}/bin/urxvt \
- -name ${cfg.appName} \
- -title ${shell.escape cfg.windowTitle} \
- -e "$0" "$@"
+ exec ${pkgs.alacritty}/bin/alacritty \
+ --config-file /var/theme/config/alacritty.yaml \
+ --class ${cfg.appName} \
+ --title ${shell.escape cfg.windowTitle} \
+ --command "$0" "$@"
else
exec 0<&''${FZFMENU_INPUT_FD-0}
exec 1>&''${FZFMENU_OUTPUT_FD-1}
diff --git a/krebs/5pkgs/simple/htgen-imgur/default.nix b/krebs/5pkgs/simple/htgen-imgur/default.nix
index e6b60be49..379150a85 100644
--- a/krebs/5pkgs/simple/htgen-imgur/default.nix
+++ b/krebs/5pkgs/simple/htgen-imgur/default.nix
@@ -1,7 +1,7 @@
{ attr, coreutils, exiv2, findutils, gnugrep, jq, nix, stockholm, util-linux, stdenv }:
stdenv.mkDerivation rec {
pname = "htgen-imgur";
- version = "1.0.0";
+ version = "1.2.0";
src = ./src;
diff --git a/krebs/5pkgs/simple/htgen-imgur/src/htgen-imgur b/krebs/5pkgs/simple/htgen-imgur/src/htgen-imgur
index af092d007..696d1c00d 100644
--- a/krebs/5pkgs/simple/htgen-imgur/src/htgen-imgur
+++ b/krebs/5pkgs/simple/htgen-imgur/src/htgen-imgur
@@ -99,7 +99,7 @@ case "$Method $path" in
if item=$(find_item $base32short); then
- deletehash=$(uuidgen)
+ deletehash=$(uuidgen | tr -d -)
info=$(
exiv2 print "$item" |
diff --git a/krebs/5pkgs/simple/nixos-format-error.nix b/krebs/5pkgs/simple/nixos-format-error.nix
new file mode 100644
index 000000000..a28f7245f
--- /dev/null
+++ b/krebs/5pkgs/simple/nixos-format-error.nix
@@ -0,0 +1,107 @@
+{ pkgs }:
+
+pkgs.writeGawkBin "nixos-format-error" ''
+ # usage: nixos-rebuild ... 2>&1 | nixos-format-error
+
+ function out() {
+ print
+ next
+ }
+
+ BEGIN {
+ IDLE = 0
+ ACTIVE = 1
+ PASSIVE = 2
+ ERROR = 3
+
+ start_state = IDLE
+
+ state = start_state
+ }
+
+ END {
+ if (trace_count)
+ for (i = trace_count - 1; i >= 0; i--)
+ print trace[i]
+ }
+
+ state == PASSIVE {
+ out()
+ }
+
+ state == IDLE {
+ if ($0 ~ /^building the system configuration\.\.\. ?$/) {
+ state = ACTIVE
+ }
+ out()
+ }
+
+ state == ACTIVE {
+ if ($1 ~ /(\[[0-9;]+m)?error:(\[[0-9;]m)?/) {
+ state = ERROR
+ sub(/^/,"\x1b[31;1m"); sub(/$/,"\x1b[m")
+ trace[trace_count++] = $0
+
+ "stty -F /dev/tty size" |& getline
+ COLUMNS = gensub(/.* ([0-9]+)$/, "\\1", "1")
+
+ next
+ }
+ if ($0 ~ /^these [0-9]+ derivations will be built:/) {
+ state = PASSIVE
+ }
+ if ($0 == "activating the configuration...") {
+ state = PASSIVE
+ }
+ out()
+ }
+
+ state == ERROR {
+ sub(/ $/, "")
+ gsub(/\[[0-9;]*m/, "")
+
+ if ($0 ~ /^\s*at /) {
+ location = gensub(/^\s*at (.*):$/,"\\1","1")
+ content = ""
+ lnumcol = gensub(/^.*:([0-9]+:[0-9]+)$/,"\\1","1",location)
+ lnum = gensub(/:.*/,"","1",lnumcol)
+ col = gensub(/.*:/,"","1",lnumcol)
+ next
+ }
+
+ if ($1 == lnum "|") {
+ content = gensub(/^\s*[0-9]+\|(.*)/,"\\1","1")
+
+ location = sprintf("%50s", location)
+
+ preview_size = COLUMNS - length(location " ")
+
+ prefix = gensub(/^\s*/,"","1",substr(content, 1, col))
+ infix = gensub(/^([0-9a-zA-Z]+|.).*$/, "\\1", "1", substr(content, col + 1))
+ suffix = substr(content, col + length(infix) + 1)
+
+ if (length(prefix infix suffix) > preview_size) {
+ n = (preview_size - length(infix)) / 2 - length(" ")
+ prefix = substr(prefix, length(prefix) - n + 1)
+ if (prefix != "") { prefix = "…" prefix }
+ suffix = substr(suffix, 1, n)
+ if (suffix != "") { suffix = suffix "…" }
+ }
+
+ preview = \
+ "\x1b[38;5;244m" prefix "\x1b[m" \
+ "\x1b[38;5;230m" infix "\x1b[m" \
+ "\x1b[38;5;244m" suffix "\x1b[m"
+
+ trace[trace_count++] = location " " preview
+ next
+ }
+
+ if ($0 == "") next
+ if ($0 ~ /^\s*… (from|while)/) next
+ if ($0 ~ /^\s*([0-9]*)\|/) next
+
+ trace[trace_count++] = $0
+ next
+ }
+''
diff --git a/krebs/5pkgs/simple/pager.nix b/krebs/5pkgs/simple/pager.nix
index ed740490d..952b5ee1e 100644
--- a/krebs/5pkgs/simple/pager.nix
+++ b/krebs/5pkgs/simple/pager.nix
@@ -1,36 +1,40 @@
{ pkgs }:
-pkgs.writeDashBin "pager" ''
- # usage: pager {view,shift,shiftview}
- #
- # Environment variables
- #
- # PAGER_NAME (default: Pager)
- # The environment variables specifies the application name under which
- # resources are to be obtained. PAGER_NAME should not contain “.” or “*”
- # characters.
- #
- set -efu
+pkgs.symlinkJoin {
+ name = "pager-wrapper";
+ paths = [
+ (pkgs.writeDashBin "pager" ''
+ # usage: pager {view,shift,shiftview}
+ #
+ # Environment variables
+ #
+ # PAGER_NAME (default: Pager)
+ # The environment variables specifies the application name under
+ # which resources are to be obtained. PAGER_NAME should not contain
+ # “.” or “*” characters.
+ #
+ set -efu
- pidfile=$XDG_RUNTIME_DIR/pager.lock
- name=''${PAGER_NAME-Pager}
+ pidfile=$XDG_RUNTIME_DIR/pager.lock
+ name=''${PAGER_NAME-Pager}
- if test -e "$pidfile" &&
- ${pkgs.procps}/bin/pgrep --pidfile="$pidfile" >/dev/null
- then
- ${pkgs.procps}/bin/pkill --pidfile="$pidfile"
- ${pkgs.coreutils}/bin/rm "$pidfile"
- exit
- fi
+ if test -e "$pidfile" &&
+ ${pkgs.procps}/bin/pgrep --pidfile="$pidfile" >/dev/null
+ then
+ ${pkgs.procps}/bin/pkill --pidfile="$pidfile"
+ ${pkgs.coreutils}/bin/rm "$pidfile"
+ exit
+ fi
- echo $$ > "$pidfile"
+ echo $$ > "$pidfile"
- exec ${pkgs.xterm}/bin/xterm \
- -name "$name" \
- -ti vt340 \
- -xrm 'Pager*geometry: 32x10' \
- -xrm 'Pager*internalBorder: 2' \
- -xrm 'Pager*background: #050505' \
- -xrm 'Pager*foreground: #d0d7d0' \
- -e ${pkgs.haskellPackages.pager}/bin/pager "$@"
-''
+ exec ${pkgs.xterm}/bin/xterm \
+ -name "$name" \
+ -ti vt340 \
+ -xrm '*geometry: 32x10' \
+ -xrm '*internalBorder: 2' \
+ -e ${pkgs.haskellPackages.pager}/bin/pager "$@"
+ '')
+ pkgs.haskellPackages.pager
+ ];
+}
diff --git a/krebs/5pkgs/simple/xwaitforwindow.nix b/krebs/5pkgs/simple/xwaitforwindow.nix
deleted file mode 100644
index 41ce65022..000000000
--- a/krebs/5pkgs/simple/xwaitforwindow.nix
+++ /dev/null
@@ -1,15 +0,0 @@
-{ writeDashBin, xdotool, xorg }:
-writeDashBin "xwaitforwindow" ''
- # usage: xwaitforwindow ARGS
- # see xdotool search for possible ARGS
- # example: xwaitforwindow -name WINDOWNAME
- set -efu
-
- if id=$(${xdotool}/bin/xdotool search "$@"); then
- printf 'waiting for window %#x\n' "$id" >&2
- exec ${xorg.xprop}/bin/xprop -spy -id "$id" >/dev/null
- else
- printf 'no window found with xdotool search %s\n' "$*" >&2
- exit 1
- fi
-''
[cgit] Unable to lock slot /tmp/cgit/7a000000.lock: No such file or directory (2)