summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hosts/by-name/apzu/hardware.nix2
-rw-r--r--modules/by-name/ba/backup/module.nix1
-rw-r--r--modules/by-name/fi/fish/keymappings.nix645
-rw-r--r--modules/by-name/fi/fish/module.nix46
-rw-r--r--modules/by-name/ni/nix/module.nix7
-rwxr-xr-xmodules/by-name/ni/nix/nix_wrapper.sh15
-rw-r--r--modules/by-name/ro/rofi/module.nix2
-rw-r--r--pkgs/by-name/ro/rollup/package.unstable.nix3
-rw-r--r--pkgs/by-name/ro/rollup/src/main.rs107
-rwxr-xr-xscripts/build.sh2
10 files changed, 433 insertions, 397 deletions
diff --git a/hosts/by-name/apzu/hardware.nix b/hosts/by-name/apzu/hardware.nix
index 833ed9b0..a90476c5 100644
--- a/hosts/by-name/apzu/hardware.nix
+++ b/hosts/by-name/apzu/hardware.nix
@@ -31,7 +31,7 @@
};
boot = {
- kernelModules = ["kvm-intel" "rtw89"];
+ kernelModules = ["kvm-intel"];
kernelParams = [
# Use the newer experimental xe driver
diff --git a/modules/by-name/ba/backup/module.nix b/modules/by-name/ba/backup/module.nix
index 7ac6e081..c12b62a3 100644
--- a/modules/by-name/ba/backup/module.nix
+++ b/modules/by-name/ba/backup/module.nix
@@ -238,7 +238,6 @@ in {
repository = "rclone: ";
timerConfig = {
- Requires = "network-online.target";
OnActiveSec = "30m";
OnUnitInactiveSec = "2h";
Persistent = true;
diff --git a/modules/by-name/fi/fish/keymappings.nix b/modules/by-name/fi/fish/keymappings.nix
index 187c5d5a..cb4064c6 100644
--- a/modules/by-name/fi/fish/keymappings.nix
+++ b/modules/by-name/fi/fish/keymappings.nix
@@ -1,11 +1,12 @@
{lib, ...}:
lib.fix (self: let
fromInsert = key: self.insert."${key}".cmd;
+
+ escPlus = key: ''\e\[${key}'';
in {
"operator" = {
"escape" = {
cmd = "fish_vi_operator_cancel";
- sets_mode_to = "default";
};
"F" = {
cmd = "";
@@ -13,71 +14,54 @@ in {
};
"d" = {
cmd = "fish_vi_exec_motion --linewise";
- sets_mode_to = "default";
};
"e" = {
cmd = "fish_vi_exec_motion forward-word-end";
- sets_mode_to = "default";
};
"j" = {
cmd = "fish_vi_exec_motion down-line";
- sets_mode_to = "default";
};
"k" = {
cmd = "fish_vi_exec_motion up-line";
- sets_mode_to = "default";
};
"7" = {
cmd = "fish_vi_arg_digit 7";
- sets_mode_to = "default";
};
"h" = {
cmd = "fish_vi_exec_motion backward-char";
- sets_mode_to = "default";
};
"B" = {
cmd = "fish_vi_exec_motion backward-bigword";
- sets_mode_to = "default";
};
"9" = {
cmd = "fish_vi_arg_digit 9";
- sets_mode_to = "default";
};
"5" = {
cmd = "fish_vi_arg_digit 5";
- sets_mode_to = "default";
};
"E" = {
cmd = "fish_vi_exec_motion forward-bigword-end";
- sets_mode_to = "default";
};
"~" = {
cmd = "fish_vi_exec_motion --linewise";
- sets_mode_to = "default";
};
"4" = {
cmd = "fish_vi_arg_digit 4";
- sets_mode_to = "default";
};
"comma" = {
cmd = "fish_vi_exec_motion repeat-jump-reverse";
- sets_mode_to = "default";
};
"^" = {
cmd = "fish_vi_exec_motion beginning-of-line";
- sets_mode_to = "default";
};
- "ctrl-[" = {
+ "ctrl-\\[" = {
cmd = "fish_vi_operator_cancel";
- sets_mode_to = "default";
};
";" = {
cmd = "fish_vi_exec_motion repeat-jump";
- sets_mode_to = "default";
};
"c" = {
cmd = "fish_vi_exec_motion --linewise";
- sets_mode_to = "default";
};
"T" = {
cmd = "";
@@ -89,57 +73,44 @@ in {
};
"2" = {
cmd = "fish_vi_arg_digit 2";
- sets_mode_to = "default";
};
"W" = {
cmd = "fish_vi_exec_motion forward-bigword-vi";
- sets_mode_to = "default";
};
"$" = {
cmd = "fish_vi_exec_motion end-of-line";
- sets_mode_to = "default";
};
"0" = {
cmd = "fish_vi_exec_motion beginning-of-line";
- sets_mode_to = "default";
};
"8" = {
cmd = "fish_vi_arg_digit 8";
- sets_mode_to = "default";
};
"g" = {
"E" = {
cmd = "fish_vi_exec_motion backward-bigword-end";
- sets_mode_to = "default";
};
"e" = {
cmd = "fish_vi_exec_motion backward-word-end";
- sets_mode_to = "default";
};
};
"w" = {
cmd = "fish_vi_exec_motion forward-word-vi";
- sets_mode_to = "default";
};
"b" = {
cmd = "fish_vi_exec_motion backward-word";
- sets_mode_to = "default";
};
"6" = {
cmd = "fish_vi_arg_digit 6";
- sets_mode_to = "default";
};
"y" = {
cmd = "fish_vi_exec_motion --linewise";
- sets_mode_to = "default";
};
"l" = {
cmd = "fish_vi_exec_motion forward-char";
- sets_mode_to = "default";
};
"1" = {
cmd = "fish_vi_arg_digit 1";
- sets_mode_to = "default";
};
"f" = {
cmd = "";
@@ -147,254 +118,175 @@ in {
};
"3" = {
cmd = "fish_vi_arg_digit 3";
- sets_mode_to = "default";
- };
- };
- "T" = {
- "" = {
- cmd = "get-key fish_vi_exec_motion commandline --backward-jump-till=$fish_key set -eg fish_key";
- sets_mode_to = "default";
- };
- };
- "f" = {
- "" = {
- cmd = "get-key fish_vi_exec_motion commandline --forward-jump=$fish_key set -eg fish_key";
- sets_mode_to = "default";
};
};
"insert" = {
"alt-up" = {
cmd = "history-token-search-backward";
- sets_mode_to = "default";
};
"alt-v" = {
cmd = "edit_command_buffer";
- sets_mode_to = "default";
};
"pageup" = {
cmd = "beginning-of-history";
- sets_mode_to = "default";
};
">" = {
- cmd = "self-insert expand-abbr";
- sets_mode_to = "default";
+ cmd = ["self-insert" "expand-abbr"];
};
"left" = {
cmd = "backward-char";
- sets_mode_to = "default";
};
- "\\e\\[1\\;9C" = {
+ ${escPlus "1;9C"} = {
cmd = "nextd-or-forward-word";
- sets_mode_to = "default";
};
"ctrl-k" = {
cmd = "kill-line";
- sets_mode_to = "default";
};
"&" = {
- cmd = "self-insert expand-abbr";
- sets_mode_to = "default";
+ cmd = ["self-insert" "expand-abbr"];
};
"shift-delete" = {
- cmd = "history-delete or backward-delete-char";
- sets_mode_to = "default";
+ cmd = ["history-delete" "or" "backward-delete-char"];
};
"alt-l" = {
cmd = "__fish_list_current_token";
- sets_mode_to = "default";
};
"shift-tab" = {
cmd = "complete-and-search";
- sets_mode_to = "default";
};
"space" = {
- cmd = "self-insert expand-abbr";
- sets_mode_to = "default";
+ cmd = ["self-insert" "expand-abbr"];
};
"up" = {
cmd = "up-or-search";
- sets_mode_to = "default";
};
"alt-#" = {
cmd = "__fish_toggle_comment_commandline";
- sets_mode_to = "default";
};
"tab" = {
cmd = "complete";
- sets_mode_to = "default";
};
"alt-h" = {
cmd = "__fish_man_page";
- sets_mode_to = "default";
};
- "\\e\\[1\\;9A" = {
+ ${escPlus "1;9A"} = {
cmd = "history-token-search-backward";
- sets_mode_to = "default";
};
"ctrl-u" = {
cmd = "backward-kill-line";
- sets_mode_to = "default";
};
"shift-backspace" = {
cmd = "backward-delete-char";
- sets_mode_to = "default";
};
"alt-enter" = {
- cmd = "commandline -i \\n (commandline --search-field >/dev/null && echo --search-field) expand-abbr";
- sets_mode_to = "default";
+ cmd = [
+ ''commandline -i \n (commandline --search-field >/dev/null && echo --search-field)''
+ "expand-abbr"
+ ];
};
"ctrl-w" = {
cmd = "backward-kill-path-component";
- sets_mode_to = "default";
};
"ctrl-right" = {
cmd = "forward-token";
- sets_mode_to = "default";
};
"pagedown" = {
cmd = "end-of-history";
- sets_mode_to = "default";
};
"alt-down" = {
cmd = "history-token-search-forward";
- sets_mode_to = "default";
};
"down" = {
cmd = "down-or-search";
- sets_mode_to = "default";
};
"ctrl-n" = {
cmd = "accept-autosuggestion";
- sets_mode_to = "default";
};
"enter" = {
cmd = "execute";
- sets_mode_to = "default";
};
"ctrl-m" = {
cmd = "execute";
- sets_mode_to = "default";
};
"shift-space" = {
- cmd = ''
- commandline -i " " (commandline --search-field >/dev/null && echo --search-field) expand-abbr
- '';
- sets_mode_to = "default";
+ cmd = [
+ ''
+ commandline -i " " (commandline --search-field >/dev/null && echo --search-field)
+ ''
+ "expand-abbr"
+ ];
};
"ctrl-s" = {
cmd = "pager-toggle-search";
- sets_mode_to = "default";
};
"ctrl-i" = {
cmd = "complete";
- sets_mode_to = "default";
};
"shift-right" = {
cmd = "forward-bigword";
- sets_mode_to = "default";
};
"end" = {
cmd = "end-of-line";
- sets_mode_to = "default";
};
")" = {
- cmd = "self-insert expand-abbr";
- sets_mode_to = "default";
+ cmd = ["self-insert" "expand-abbr"];
};
"ctrl-x" = {
cmd = "fish_clipboard_copy";
- sets_mode_to = "default";
};
- "\\e\\[1\\;9D" = {
+ ${escPlus "1;9D"} = {
cmd = "prevd-or-backward-word";
- sets_mode_to = "default";
};
"alt-e" = {
cmd = "edit_command_buffer";
- sets_mode_to = "default";
};
"alt-p" = {
cmd = "__fish_paginate";
- sets_mode_to = "default";
};
"f1" = {
cmd = "__fish_man_page";
- sets_mode_to = "default";
};
"shift-left" = {
cmd = "backward-bigword";
- sets_mode_to = "default";
};
"ctrl-l" = {
- cmd = "status test-terminal-feature scroll-content-up && commandline -f scrollback-push clear-screen";
- sets_mode_to = "default";
+ cmd = [
+ "status test-terminal-feature scroll-content-up && commandline -f scrollback-push"
+ "clear-screen"
+ ];
};
"alt-y" = {
cmd = "yank-pop";
- sets_mode_to = "default";
};
"<" = {
- cmd = "self-insert expand-abbr";
- sets_mode_to = "default";
+ cmd = ["self-insert" "expand-abbr"];
};
"alt-w" = {
cmd = "__fish_whatis_current_token";
- sets_mode_to = "default";
};
"right" = {
cmd = "forward-char";
- sets_mode_to = "default";
};
"shift-enter" = {
- cmd = "commandline -i \\n (commandline --search-field >/dev/null && echo --search-field) expand-abbr";
- sets_mode_to = "default";
+ cmd = [
+ ''commandline -i \n (commandline --search-field >/dev/null && echo --search-field)''
+ "expand-abbr"
+ ];
};
- "\\e\\[1\\;9B" = {
+ ${escPlus "1;9B"} = {
cmd = "history-token-search-forward";
- sets_mode_to = "default";
- };
- "escape" = {
- cmd = ''
- if commandline -P
- commandline -f cancel
- else
- set fish_bind_mode default
- if test \(count \(commandline --cut-at-cursor \| tail -c2\)\) != 2
- commandline -f backward-char
- end
- commandline -f repaint-mode
- end
- '';
- sets_mode_to = "default";
- };
- "ctrl-\\[" = {
- cmd = ''
- if commandline -P
- commandline -f cancel
- else
- set fish_bind_mode default
- if test \(count \(commandline --cut-at-cursor \| tail -c2\)\) != 2
- commandline -f backward-char
- end
- commandline -f repaint-mode
- end
- '';
};
"|" = {
- cmd = "self-insert expand-abbr";
- sets_mode_to = "default";
+ cmd = ["self-insert" "expand-abbr"];
};
"alt-b" = {
cmd = "prevd-or-backward-word";
- sets_mode_to = "default";
};
"ctrl-enter" = {
cmd = "execute";
- sets_mode_to = "default";
};
"alt-f" = {
cmd = "nextd-or-forward-word";
- sets_mode_to = "default";
};
"alt-s" = {
cmd = ''
@@ -405,54 +297,42 @@ in {
end;
end
'';
- sets_mode_to = "default";
};
"ctrl-space" = {
cmd = ''
test -n "$(commandline)"
&& commandline -i " " (commandline --search-field >/dev/null && echo --search-field)
'';
- sets_mode_to = "default";
};
"ctrl-left" = {
cmd = "backward-token";
- sets_mode_to = "default";
};
"ctrl-y" = {
cmd = "yank";
- sets_mode_to = "default";
};
"alt-." = {
cmd = "history-token-search-backward";
- sets_mode_to = "default";
};
"ctrl-j" = {
cmd = "execute";
- sets_mode_to = "default";
};
"alt-left" = {
cmd = "prevd-or-backward-word";
- sets_mode_to = "default";
};
"ctrl-h" = {
cmd = "backward-delete-char";
- sets_mode_to = "default";
};
"alt-o" = {
cmd = "__fish_preview_current_file";
- sets_mode_to = "default";
};
"delete" = {
cmd = "delete-char";
- sets_mode_to = "default";
};
"" = {
cmd = "self-insert";
- sets_mode_to = "default";
};
"ctrl-d" = {
cmd = "delete-or-exit";
- sets_mode_to = "default";
};
"alt-d" = {
cmd = ''
@@ -462,38 +342,45 @@ in {
commandline -f kill-word;
end
'';
- sets_mode_to = "default";
};
"alt-right" = {
cmd = "nextd-or-forward-word";
- sets_mode_to = "default";
};
"ctrl-v" = {
cmd = "fish_clipboard_paste";
- sets_mode_to = "default";
};
"home" = {
cmd = "beginning-of-line";
- sets_mode_to = "default";
};
";" = {
- cmd = "self-insert expand-abbr";
- sets_mode_to = "default";
+ cmd = ["self-insert" "expand-abbr"];
};
"backspace" = {
cmd = "backward-delete-char";
- sets_mode_to = "default";
};
"ctrl-c" = {
cmd = "clear-commandline";
- sets_mode_to = "default";
};
+ "escape" = {
+ cmd = ''
+ if commandline -P
+ commandline -f cancel
+ else
+ set fish_bind_mode default
+ if test (count (commandline --cut-at-cursor | tail -c2)) != 2
+ commandline -f backward-char
+ end
+ commandline -f repaint-mode
+ end
+ '';
+ };
+ "ctrl-\\[" = self.insert.escape;
};
"default" = {
- # "\\e\\[1\\;9A" = {cmd = "history-token-search-backward";};
- # "\\e\\[1\\;9B" = {cmd = "history-token-search-forward";};
- # "\\e\\[1\\;9C" = {cmd = "nextd-or-forward-word";};
- # "\\e\\[1\\;9D" = {cmd = "prevd-or-backward-word";};
+ # ${escPlus "1;9A"} = {cmd = "history-token-search-backward";};
+ # ${escPlus "1;9B"} = {cmd = "history-token-search-forward";};
+ # ${escPlus "1;9C"} = {cmd = "nextd-or-forward-word";};
+ # ${escPlus "1;9D"} = {cmd = "prevd-or-backward-word";};
"down" = {cmd = "down-or-search";};
"ctrl-y" = {cmd = "yank";};
@@ -532,7 +419,7 @@ in {
"alt-b" = {cmd = fromInsert "alt-b";};
"alt-right" = {cmd = fromInsert "alt-right";};
"alt-y" = {cmd = fromInsert "alt-y";};
- "ctrl-[" = {cmd = "set -g __fish_vi_count";};
+ "ctrl-\\[" = {cmd = "set -g __fish_vi_count";};
"ctrl-i" = {cmd = fromInsert "ctrl-i";};
"home" = {cmd = fromInsert "home";};
"ctrl-s" = {cmd = fromInsert "ctrl-s";};
@@ -547,17 +434,19 @@ in {
"alt-." = {cmd = "history-token-search-backward";};
"ctrl-right" = {cmd = "forward-token";};
"ctrl-c" = {
- cmd = "clear-commandline repaint-mode";
+ cmd = ["clear-commandline" "repaint-mode"];
sets_mode_to = "insert";
};
"alt-o" = {cmd = "__fish_preview_current_file";};
"x" = {cmd = "__fish_vi_delete_char";};
"D" = {cmd = "kill-line";};
- "j" = {cmd = "fish_vi_run_count down-or-search";};
+ "j" = {
+ cmd = "fish_vi_run_count down-or-search";
+ };
"f" = {cmd = "forward-jump";};
"s" = {
- cmd = "delete-char repaint-mode";
+ cmd = ["delete-char" "repaint-mode"];
sets_mode_to = "insert";
};
"%" = {cmd = "jump-to-matching-bracket";};
@@ -571,7 +460,7 @@ in {
"alt-#" = {cmd = "__fish_toggle_comment_commandline";};
"up" = {cmd = "up-or-search";};
"S" = {
- cmd = "kill-inner-line repaint-mode";
+ cmd = ["kill-inner-line" "repaint-mode"];
sets_mode_to = "insert";
};
"ctrl-j" = {
@@ -596,11 +485,25 @@ in {
"y" = {
"y" = {cmd = "fish_clipboard_copy";};
};
- "p" = {cmd = "set -g fish_cursor_end_mode exclusive forward-char set -g fish_cursor_end_mode inclusive fish_clipboard_paste";};
+ "p" = {
+ cmd = [
+ "set -g fish_cursor_end_mode exclusive"
+ "forward-char"
+ "set -g fish_cursor_end_mode inclusive"
+ "fish_clipboard_paste"
+ ];
+ };
"Y" = {cmd = "fish_clipboard_copy";};
};
"*" = {
- "p" = {cmd = "set -g fish_cursor_end_mode exclusive forward-char set -g fish_cursor_end_mode inclusive fish_clipboard_paste";};
+ "p" = {
+ cmd = [
+ "set -g fish_cursor_end_mode exclusive"
+ "forward-char"
+ "set -g fish_cursor_end_mode inclusive"
+ "fish_clipboard_paste"
+ ];
+ };
"P" = {cmd = "fish_clipboard_paste";};
"Y" = {cmd = "fish_clipboard_copy";};
"y" = {
@@ -609,7 +512,9 @@ in {
};
};
"t" = {cmd = "forward-jump-till";};
- "~" = {cmd = "togglecase-char forward-single-char";};
+ "~" = {
+ cmd = ["togglecase-char" "forward-single-char"];
+ };
"i" = {
cmd = "repaint-mode";
sets_mode_to = "insert";
@@ -619,12 +524,16 @@ in {
"l" = {cmd = "fish_vi_run_count forward-char";};
"T" = {cmd = "backward-jump-till";};
"/" = {
- cmd = "history-pager repaint-mode";
+ cmd = ["history-pager" "repaint-mode"];
sets_mode_to = "insert";
};
"8" = {cmd = "fish_vi_arg_digit 8";};
"a" = {
- cmd = "set fish_cursor_end_mode exclusive forward-single-char repaint-mode";
+ cmd = [
+ "set fish_cursor_end_mode exclusive"
+ "forward-single-char"
+ "repaint-mode"
+ ];
sets_mode_to = "insert";
};
"R" = {
@@ -635,7 +544,11 @@ in {
"G" = {cmd = "end-of-buffer";};
"[" = {cmd = "history-token-search-backward";};
"o" = {
- cmd = "set fish_cursor_end_mode exclusive insert-line-under repaint-mode";
+ cmd = [
+ "set fish_cursor_end_mode exclusive"
+ "insert-line-under"
+ "repaint-mode"
+ ];
sets_mode_to = "insert";
};
"W" = {cmd = "fish_vi_run_count forward-bigword-vi";};
@@ -656,103 +569,185 @@ in {
"$" = {cmd = "kill-line";};
"a" = {
"w" = {cmd = "kill-a-word";};
- "b" = {cmd = "jump-to-matching-bracket and jump-to-matching-bracket and begin-selection jump-to-matching-bracket kill-selection end-selection";};
+ "b" = {
+ cmd = [
+ "jump-to-matching-bracket"
+ "and"
+ "jump-to-matching-bracket"
+ "and"
+ "begin-selection"
+ "jump-to-matching-bracket"
+ "kill-selection"
+ "end-selection"
+ ];
+ };
"W" = {cmd = "kill-a-bigword";};
};
"i" = {
"w" = {cmd = "kill-inner-word";};
"W" = {cmd = "kill-inner-bigword";};
- "b" = {cmd = "jump-till-matching-bracket and jump-till-matching-bracket and begin-selection jump-till-matching-bracket kill-selection end-selection";};
+ "b" = {
+ cmd = [
+ "jump-till-matching-bracket"
+ "and"
+ "jump-till-matching-bracket"
+ "and"
+ "begin-selection"
+ "jump-till-matching-bracket"
+ "kill-selection"
+ "end-selection"
+ ];
+ };
};
- "comma" = {cmd = "begin-selection repeat-jump-reverse kill-selection end-selection";};
- ";" = {cmd = "begin-selection repeat-jump kill-selection end-selection";};
+ "comma" = {
+ cmd = [
+ "begin-selection"
+ "repeat-jump-reverse"
+ "kill-selection"
+ "end-selection"
+ ];
+ };
+ ";" = {cmd = ["begin-selection" "repeat-jump" "kill-selection" "end-selection"];};
"0" = {cmd = "backward-kill-line";};
"^" = {cmd = "backward-kill-line";};
};
"1" = {cmd = "fish_vi_arg_digit 1";};
"F" = {cmd = "backward-jump";};
- "Y" = {cmd = "kill-whole-line yank";};
+ "Y" = {cmd = ["kill-whole-line" "yank"];};
"E" = {cmd = "fish_vi_run_count forward-bigword-end";};
"3" = {cmd = "fish_vi_arg_digit 3";};
- "J" = {cmd = "end-of-line delete-char";};
+ "J" = {
+ cmd = ["end-of-line" "delete-char"];
+ };
"u" = {cmd = "undo";};
"c" = {
"^" = {
- cmd = "backward-kill-line repaint-mode";
+ cmd = ["backward-kill-line" "repaint-mode"];
sets_mode_to = "insert";
};
"i" = {
"w" = {
- cmd = "kill-inner-word repaint-mode";
+ cmd = ["kill-inner-word" "repaint-mode"];
sets_mode_to = "insert";
};
"W" = {
- cmd = "kill-inner-bigword repaint-mode";
+ cmd = ["kill-inner-bigword" "repaint-mode"];
sets_mode_to = "insert";
};
"b" = {
- cmd = "jump-till-matching-bracket and jump-till-matching-bracket and begin-selection jump-till-matching-bracket kill-selection end-selection";
+ cmd = [
+ "jump-till-matching-bracket"
+ "and"
+ "jump-till-matching-bracket"
+ "and"
+ "begin-selection"
+ "jump-till-matching-bracket"
+ "kill-selection"
+ "end-selection"
+ ];
sets_mode_to = "insert";
};
};
"a" = {
"W" = {
- cmd = "kill-a-bigword repaint-mode";
+ cmd = ["kill-a-bigword" "repaint-mode"];
sets_mode_to = "insert";
};
"w" = {
- cmd = "kill-a-word repaint-mode";
+ cmd = ["kill-a-word" "repaint-mode"];
sets_mode_to = "insert";
};
"b" = {
- cmd = "jump-to-matching-bracket and jump-to-matching-bracket and begin-selection jump-to-matching-bracket kill-selection end-selection";
+ cmd = [
+ "jump-till-matching-bracket"
+ "and"
+ "jump-till-matching-bracket"
+ "and"
+ "begin-selection"
+ "jump-to-matching-bracket"
+ "kill-selection"
+ "end-selection"
+ ];
sets_mode_to = "insert";
};
};
"$" = {
- cmd = "kill-line repaint-mode";
+ cmd = ["kill-line" "repaint-mode"];
sets_mode_to = "insert";
};
"0" = {
- cmd = "backward-kill-line repaint-mode";
+ cmd = ["backward-kill-line" "repaint-mode"];
sets_mode_to = "insert";
};
};
"_" = {cmd = "beginning-of-line";};
"A" = {
- cmd = "set fish_cursor_end_mode exclusive end-of-line repaint-mode";
+ cmd = [
+ "set fish_cursor_end_mode exclusive"
+ "end-of-line"
+ "repaint-mode"
+ ];
sets_mode_to = "insert";
};
"I" = {
- cmd = "beginning-of-line repaint-mode";
+ cmd = ["beginning-of-line" "repaint-mode"];
sets_mode_to = "insert";
};
"$" = {cmd = "end-of-line";};
"X" = {cmd = "__fish_vi_backward_delete_char";};
"B" = {cmd = "fish_vi_run_count backward-bigword";};
"y" = {
- "0" = {cmd = "backward-kill-line yank";};
+ "0" = {cmd = ["backward-kill-line" "yank"];};
"i" = {
- "W" = {cmd = "kill-inner-bigword yank";};
- "w" = {cmd = "kill-inner-word yank";};
- "b" = {cmd = "jump-till-matching-bracket and jump-till-matching-bracket and begin-selection jump-till-matching-bracket fish_vi_yank_selection end-selection";};
+ "W" = {cmd = ["kill-inner-bigword" "yank"];};
+ "w" = {cmd = ["kill-inner-word" "yank"];};
+ "b" = {
+ cmd = [
+ "jump-till-matching-bracket"
+ "and"
+ "jump-till-matching-bracket"
+ "and"
+ "begin-selection"
+ "jump-till-matching-bracket"
+ "fish_vi_yank_selection"
+ "end-selection"
+ ];
+ };
};
"a" = {
- "W" = {cmd = "kill-a-bigword yank";};
- "b" = {cmd = "jump-to-matching-bracket and jump-to-matching-bracket and begin-selection jump-to-matching-bracket fish_vi_yank_selection end-selection";};
- "w" = {cmd = "kill-a-word yank";};
+ "W" = {cmd = ["kill-a-bigword" "yank"];};
+ "b" = {
+ cmd = [
+ "jump-till-matching-bracket"
+ "and"
+ "jump-till-matching-bracket"
+ "and"
+ "begin-selection"
+ "jump-to-matching-bracket"
+ "fish_vi_yank_selection"
+ "end-selection"
+ ];
+ };
+ "w" = {cmd = ["kill-a-word" "yank"];};
};
- "^" = {cmd = "backward-kill-line yank";};
- "$" = {cmd = "kill-line yank";};
+ "^" = {cmd = ["backward-kill-line" "yank"];};
+ "$" = {cmd = ["kill-line" "yank"];};
+ };
+ "p" = {
+ cmd = [
+ "set -g fish_cursor_end_mode exclusive"
+ "forward-char"
+ "set -g fish_cursor_end_mode inclusive"
+ "yank"
+ ];
};
- "p" = {cmd = "set -g fish_cursor_end_mode exclusive forward-char set -g fish_cursor_end_mode inclusive yank";};
"#" = {cmd = "__fish_toggle_comment_commandline";};
"v" = {
- cmd = "begin-selection repaint-mode";
+ cmd = ["begin-selection" "repaint-mode"];
sets_mode_to = "visual";
};
"O" = {
- cmd = "set fish_cursor_end_mode exclusive insert-line-over repaint-mode";
+ cmd = ["set fish_cursor_end_mode exclusive" "insert-line-over" "repaint-mode"];
sets_mode_to = "insert";
};
"2" = {cmd = "fish_vi_arg_digit 2";};
@@ -769,7 +764,7 @@ in {
};
"7" = {cmd = "fish_vi_arg_digit 7";};
"C" = {
- cmd = "kill-line repaint-mode";
+ cmd = ["kill-line" "repaint-mode"];
sets_mode_to = "insert";
};
"h" = {cmd = "fish_vi_run_count backward-char";};
@@ -777,454 +772,400 @@ in {
"visual" = {
"alt-down" = {
cmd = "history-token-search-forward";
- sets_mode_to = "default";
- };
- "ctrl-c" = {
- cmd = "end-selection repaint-mode";
- sets_mode_to = "default";
};
"alt-h" = {
cmd = "__fish_man_page";
- sets_mode_to = "default";
};
"l" = {
cmd = "forward-char";
- sets_mode_to = "default";
};
"T" = {
cmd = "backward-jump-till";
- sets_mode_to = "default";
};
"e" = {
cmd = "forward-word-end";
- sets_mode_to = "default";
};
"right" = {
cmd = "forward-char";
- sets_mode_to = "default";
};
"t" = {
cmd = "forward-jump-till";
- sets_mode_to = "default";
};
"s" = {
- cmd = "kill-selection end-selection repaint-mode";
+ cmd = ["kill-selection" "end-selection" "repaint-mode"];
sets_mode_to = "insert";
};
"alt-#" = {
cmd = "__fish_toggle_comment_commandline";
- sets_mode_to = "default";
};
"_" = {
cmd = "beginning-of-line";
- sets_mode_to = "default";
};
"%" = {
cmd = "jump-to-matching-bracket";
- sets_mode_to = "default";
};
"ctrl-s" = {
cmd = "pager-toggle-search";
- sets_mode_to = "default";
};
"ctrl-w" = {
cmd = "backward-kill-path-component";
- sets_mode_to = "default";
};
"alt-o" = {
cmd = "__fish_preview_current_file";
- sets_mode_to = "default";
};
"left" = {
cmd = "backward-char";
- sets_mode_to = "default";
};
"shift-left" = {
cmd = "backward-bigword";
- sets_mode_to = "default";
};
"alt-p" = {
cmd = "__fish_paginate";
- sets_mode_to = "default";
};
"F" = {
cmd = "backward-jump";
- sets_mode_to = "default";
};
"ctrl-left" = {
cmd = "backward-token";
- sets_mode_to = "default";
};
"b" = {
cmd = "backward-word";
- sets_mode_to = "default";
};
"f1" = {
cmd = "__fish_man_page";
- sets_mode_to = "default";
};
"shift-delete" = {
- cmd = "history-delete or backward-delete-char";
- sets_mode_to = "default";
+ cmd = ["history-delete" "or" "backward-delete-char"];
};
"\"" = {
"+" = {
"y" = {
- cmd = "fish_clipboard_copy; commandline -f end-selection repaint-mode";
+ cmd = ["fish_clipboard_copy; commandline -f end-selection" "repaint-mode"];
sets_mode_to = "default";
};
};
"*" = {
"y" = {
- cmd = "fish_clipboard_copy; commandline -f end-selection repaint-mode";
+ cmd = ["fish_clipboard_copy; commandline -f end-selection" "repaint-mode"];
sets_mode_to = "default";
};
};
};
"shift-tab" = {
cmd = "complete-and-search";
- sets_mode_to = "default";
};
"alt-b" = {
cmd = "prevd-or-backward-word";
- sets_mode_to = "default";
};
"#" = {
cmd = "__fish_toggle_comment_commandline";
- sets_mode_to = "default";
};
"~" = {
- cmd = "togglecase-selection end-selection repaint-mode";
+ cmd = ["togglecase-selection" "end-selection" "repaint-mode"];
sets_mode_to = "default";
};
"y" = {
- cmd = "fish_vi_yank_selection end-selection repaint-mode";
+ cmd = ["fish_vi_yank_selection" "end-selection" "repaint-mode"];
sets_mode_to = "default";
};
"f" = {
cmd = "forward-jump";
- sets_mode_to = "default";
};
"x" = {
- cmd = "kill-selection end-selection repaint-mode";
+ cmd = ["kill-selection" "end-selection" "repaint-mode"];
+ sets_mode_to = "default";
+ };
+ "X" = {
+ cmd = ["kill-whole-line" "end-selection" "repaint-mode"];
sets_mode_to = "default";
};
"alt-y" = {
cmd = "yank-pop";
- sets_mode_to = "default";
};
"$" = {
cmd = "end-of-line";
- sets_mode_to = "default";
};
";" = {
cmd = "repeat-jump";
- sets_mode_to = "default";
};
"W" = {
cmd = "forward-bigword-vi";
- sets_mode_to = "default";
};
"w" = {
cmd = "forward-word-vi";
- sets_mode_to = "default";
};
"j" = {
cmd = "down-line";
- sets_mode_to = "default";
};
"k" = {
cmd = "up-line";
- sets_mode_to = "default";
};
"end" = {
cmd = "end-of-line";
- sets_mode_to = "default";
};
"down" = {
cmd = "down-or-search";
- sets_mode_to = "default";
};
"alt-up" = {
cmd = "history-token-search-backward";
- sets_mode_to = "default";
};
"i" = {
- cmd = "end-selection repaint-mode";
+ cmd = ["end-selection" "repaint-mode"];
sets_mode_to = "insert";
};
"g" = {
"^" = {
cmd = "beginning-of-line";
- sets_mode_to = "default";
};
"e" = {
cmd = "backward-word-end";
- sets_mode_to = "default";
- };
- "u" = {
- cmd = "downcase-selection end-selection repaint-mode";
- sets_mode_to = "default";
};
"$" = {
cmd = "end-of-line";
- sets_mode_to = "default";
};
"U" = {
- cmd = "upcase-selection end-selection repaint-mode";
+ cmd = ["upcase-selection" "end-selection" "repaint-mode"];
+ sets_mode_to = "default";
+ };
+ "u" = {
+ cmd = ["downcase-selection" "end-selection" "repaint-mode"];
sets_mode_to = "default";
};
"E" = {
cmd = "backward-bigword-end";
- sets_mode_to = "default";
};
};
"I" = {
- cmd = "end-selection beginning-of-line repaint-mode";
+ cmd = ["end-selection" "beginning-of-line" "repaint-mode"];
sets_mode_to = "insert";
};
"alt-." = {
cmd = "history-token-search-backward";
- sets_mode_to = "default";
};
"home" = {
cmd = "beginning-of-line";
- sets_mode_to = "default";
};
"alt-l" = {
cmd = "__fish_list_current_token";
- sets_mode_to = "default";
};
"ctrl-x" = {
cmd = "fish_clipboard_copy";
- sets_mode_to = "default";
};
"alt-s" = {
- cmd = "for cmd in sudo doas please run0; if command -q $cmd; fish_commandline_prepend $cmd; break; end; end";
- sets_mode_to = "default";
+ cmd = ''
+ for cmd in sudo doas please run0;
+ if command -q $cmd;
+ fish_commandline_prepend $cmd;
+ break;
+ end;
+ end
+ '';
};
"o" = {
- cmd = "swap-selection-start-stop repaint-mode";
- sets_mode_to = "default";
+ cmd = ["swap-selection-start-stop" "repaint-mode"];
};
- "ctrl-[" = {
- cmd = "end-selection repaint-mode";
- sets_mode_to = "default";
- };
- "X" = {
- cmd = "kill-whole-line end-selection repaint-mode";
- sets_mode_to = "default";
- };
- "\\e\\[1\\;9B" = {
+ ${escPlus "1;9B"} = {
cmd = "history-token-search-forward";
- sets_mode_to = "default";
};
"pageup" = {
cmd = "beginning-of-history";
- sets_mode_to = "default";
};
"ctrl-l" = {
- cmd = "status test-terminal-feature scroll-content-up && commandline -f scrollback-push clear-screen";
- sets_mode_to = "default";
+ cmd = [
+ "status test-terminal-feature scroll-content-up && commandline -f scrollback-push"
+ "clear-screen"
+ ];
};
"up" = {
cmd = "up-or-search";
- sets_mode_to = "default";
};
"ctrl-u" = {
cmd = "backward-kill-line";
- sets_mode_to = "default";
};
"h" = {
cmd = "backward-char";
- sets_mode_to = "default";
};
"alt-right" = {
cmd = "nextd-or-forward-word";
- sets_mode_to = "default";
};
"ctrl-y" = {
cmd = "yank";
- sets_mode_to = "default";
};
"v" = {
- cmd = "end-selection repaint-mode";
+ cmd = ["end-selection" "repaint-mode"];
sets_mode_to = "default";
};
- "\\e\\[1\\;9D" = {
+ ${escPlus "1;9D"} = {
cmd = "prevd-or-backward-word";
- sets_mode_to = "default";
};
- "\\e\\[1\\;9C" = {
+ ${escPlus "1;9C"} = {
cmd = "nextd-or-forward-word";
- sets_mode_to = "default";
};
"0" = {
cmd = "beginning-of-line";
- sets_mode_to = "default";
};
"ctrl-k" = {
cmd = "kill-line";
- sets_mode_to = "default";
};
"alt-v" = {
cmd = "edit_command_buffer";
- sets_mode_to = "default";
};
"ctrl-v" = {
cmd = "fish_clipboard_paste";
- sets_mode_to = "default";
};
"ctrl-i" = {
cmd = "complete";
- sets_mode_to = "default";
};
"d" = {
- cmd = "kill-selection end-selection backward-char repaint-mode";
+ cmd = [
+ "kill-selection"
+ "end-selection"
+ "backward-char"
+ "repaint-mode"
+ ];
sets_mode_to = "default";
};
"^" = {
cmd = "beginning-of-line";
- sets_mode_to = "default";
};
"alt-f" = {
cmd = "nextd-or-forward-word";
- sets_mode_to = "default";
};
"ctrl-right" = {
cmd = "forward-token";
- sets_mode_to = "default";
};
"alt-w" = {
cmd = "__fish_whatis_current_token";
- sets_mode_to = "default";
};
- "\\e\\[1\\;9A" = {
+ ${escPlus "1;9A"} = {
cmd = "history-token-search-backward";
- sets_mode_to = "default";
};
"shift-right" = {
cmd = "forward-bigword";
- sets_mode_to = "default";
};
"E" = {
cmd = "forward-bigword-end";
- sets_mode_to = "default";
};
"tab" = {
cmd = "complete";
- sets_mode_to = "default";
};
"B" = {
cmd = "backward-bigword";
- sets_mode_to = "default";
};
"alt-e" = {
cmd = "edit_command_buffer";
- sets_mode_to = "default";
};
"alt-d" = {
cmd = fromInsert "alt-d";
- sets_mode_to = "default";
};
"pagedown" = {
cmd = "end-of-history";
- sets_mode_to = "default";
};
"c" = {
- cmd = "kill-selection end-selection repaint-mode";
+ cmd = ["kill-selection" "end-selection" "repaint-mode"];
sets_mode_to = "insert";
};
"alt-left" = {
cmd = "prevd-or-backward-word";
- sets_mode_to = "default";
};
"comma" = {
cmd = "repeat-jump-reverse";
- sets_mode_to = "default";
};
"ctrl-d" = {
cmd = "delete-or-exit";
- sets_mode_to = "default";
};
"escape" = {
- cmd = "end-selection repaint-mode";
+ cmd = ["end-selection" "repaint-mode"];
sets_mode_to = "default";
};
+ "ctrl-\\[" = self.visual.escape;
+ "ctrl-c" = self.visual.escape;
+ };
+ "T" = {
+ "" = {
+ cmd = self.t."".cmd;
+ };
+ };
+ "f" = {
+ "" = {
+ cmd = self.F."".cmd;
+ };
};
"F" = {
"" = {
- cmd = "get-key fish_vi_exec_motion commandline --backward-jump=$fish_key set -eg fish_key";
- sets_mode_to = "default";
+ cmd = [
+ "get-key"
+ "fish_vi_exec_motion commandline --backward-jump=$fish_key"
+ "set -eg fish_key"
+ ];
};
};
"t" = {
"" = {
- cmd = "get-key fish_vi_exec_motion commandline --forward-jump-till=$fish_key set -eg fish_key";
- sets_mode_to = "default";
+ cmd = [
+ "get-key"
+ "fish_vi_exec_motion commandline --forward-jump-till=$fish_key"
+ "set -eg fish_key"
+ ];
};
};
"replace" = {
- "escape" = {
- cmd = "cancel repaint-mode";
- sets_mode_to = "default";
- };
"#" = {
cmd = "__fish_toggle_comment_commandline";
- sets_mode_to = "default";
};
"ctrl-m" = {
- cmd = "execute repaint-mode";
+ cmd = ["execute" "repaint-mode"];
sets_mode_to = "insert";
};
"shift-backspace" = {
cmd = "backward-char";
- sets_mode_to = "default";
- };
- "ctrl-[" = {
- cmd = "cancel repaint-mode";
- sets_mode_to = "default";
};
"enter" = {
- cmd = "execute repaint-mode";
+ cmd = ["execute" "repaint-mode"];
sets_mode_to = "insert";
};
"" = {
- cmd = "delete-char self-insert";
- sets_mode_to = "default";
+ cmd = ["delete-char" "self-insert"];
};
"backspace" = {
cmd = "backward-char";
- sets_mode_to = "default";
};
"ctrl-j" = {
- cmd = "execute repaint-mode";
+ cmd = ["execute" "repaint-mode"];
sets_mode_to = "insert";
};
- };
- "replace_one" = {
+ "ctrl-\\[" = self.replace.escape;
"escape" = {
- cmd = "cancel repaint-mode";
+ cmd = ["cancel" "repaint-mode"];
sets_mode_to = "default";
};
+ };
+ "replace_one" = {
"" = {
- cmd = "set -g fish_cursor_end_mode exclusive delete-char self-insert backward-char repaint-mode set -g fish_cursor_end_mode inclusive";
- sets_mode_to = "default";
- };
- "ctrl-j" = {
- cmd = "set -g fish_cursor_end_mode exclusive commandline -f delete-char; commandline -i \\n; commandline -f backward-char repaint-mode set -g fish_cursor_end_mode inclusive";
+ cmd = [
+ "set -g fish_cursor_end_mode exclusive"
+ "delete-char"
+ "self-insert"
+ "backward-char"
+ "repaint-mode"
+ "set -g fish_cursor_end_mode inclusive"
+ ];
sets_mode_to = "default";
};
"enter" = {
- cmd = "set -g fish_cursor_end_mode exclusive commandline -f delete-char; commandline -i \\n; commandline -f backward-char repaint-mode set -g fish_cursor_end_mode inclusive";
+ cmd = [
+ "set -g fish_cursor_end_mode exclusive"
+ ''commandline -f delete-char; commandline -i \n; commandline -f backward-char''
+ "repaint-mode"
+ "set -g fish_cursor_end_mode inclusive"
+ ];
sets_mode_to = "default";
};
- "ctrl-[" = {
- cmd = "cancel repaint-mode";
- sets_mode_to = "default";
- };
- "ctrl-m" = {
- cmd = "set -g fish_cursor_end_mode exclusive commandline -f delete-char; commandline -i \\n; commandline -f backward-char repaint-mode set -g fish_cursor_end_mode inclusive";
+ "ctrl-j" = self.replace_one.enter;
+ "ctrl-m" = self.replace_one.enter;
+ "ctrl-\\[" = self.replace_one.escape;
+ "escape" = {
+ cmd = ["cancel" "repaint-mode"];
sets_mode_to = "default";
};
};
diff --git a/modules/by-name/fi/fish/module.nix b/modules/by-name/fi/fish/module.nix
index 7f16fc08..7d423bec 100644
--- a/modules/by-name/fi/fish/module.nix
+++ b/modules/by-name/fi/fish/module.nix
@@ -30,25 +30,55 @@
mkBinding = mode: base_key: binding: let
sets_mode_to =
if binding ? sets_mode_to
- then "--sets-mode ${binding.sets_mode_to}"
+ then "--sets-mode ${binding.sets_mode_to} "
else "";
-
- key = lib.escape ["$" "*"] base_key;
in
if binding ? cmd
- then ''
- bind --mode "${mode}" ${sets_mode_to} --preset ${lib.escapeShellArg key} ${lib.escapeShellArg binding.cmd}
+ then let
+ mkCmd = cmd: "'${cmd}'";
+ escaped_key =
+ if base_key == ""
+ then ''""''
+ else
+ lib.escape [
+ "\""
+ "("
+ ")"
+ "$"
+ ";"
+ "*"
+ "&"
+ "|"
+ "~"
+ "<"
+ ">"
+ "^"
+ "#"
+ ]
+ base_key;
+ escaped_cmd =
+ if builtins.isList binding.cmd
+ then builtins.concatStringsSep " " (builtins.map mkCmd binding.cmd)
+ else mkCmd binding.cmd;
+ in ''
+ bind --mode "${mode}" ${sets_mode_to}--preset ${escaped_key} ${escaped_cmd}
''
else
builtins.concatStringsSep "" (lib.mapAttrsToList
- (new_key: value: mkBinding mode "${key + "," + new_key}" value)
+ (new_key: value: mkBinding mode "${base_key + "," + new_key}" value)
binding);
mkMode = mode: attr: builtins.concatStringsSep "" (lib.mapAttrsToList (mkBinding mode) attr);
keymappings =
''
- bind --erase --all
+ function fish_my_key_bindings
+ fish_vi_key_bindings
+ bind --erase --all --preset
''
- + builtins.concatStringsSep "\n" (lib.mapAttrsToList mkMode keymappings_raw);
+ + builtins.concatStringsSep "\n" (lib.mapAttrsToList mkMode keymappings_raw)
+ + ''
+ end
+ set -g fish_key_bindings fish_my_key_bindings
+ '';
in {
options.soispha.programs.fish = {
enable = lib.mkEnableOption "fish";
diff --git a/modules/by-name/ni/nix/module.nix b/modules/by-name/ni/nix/module.nix
index 31977d4c..5fd10541 100644
--- a/modules/by-name/ni/nix/module.nix
+++ b/modules/by-name/ni/nix/module.nix
@@ -24,13 +24,11 @@
pkgs.lixPackageSets.latest.lix;
nixWrapperBase = pkgs.writeShellApplication {
- inherit (lix) name;
+ name = "nix";
text = builtins.readFile ./nix_wrapper.sh;
- inheritPath = false;
runtimeInputs = [
pkgs.lixPackageSets.latest.lix
- pkgs.libnotify
pkgs.btrfs-progs
pkgs.coreutils
pkgs.gnused
@@ -38,6 +36,9 @@
pkgs.bc
];
+ # the wrapped nix command might call random other stuff.
+ inheritPath = true;
+
derivationArgs = {
inherit (lix) meta pname version;
};
diff --git a/modules/by-name/ni/nix/nix_wrapper.sh b/modules/by-name/ni/nix/nix_wrapper.sh
index 55b12dc9..7582ec8a 100755
--- a/modules/by-name/ni/nix/nix_wrapper.sh
+++ b/modules/by-name/ni/nix/nix_wrapper.sh
@@ -1,23 +1,24 @@
#! /usr/bin/env sh
set -eu
+_NIX_WRAPPER_FALLBACK="${_NIX_WRAPPER_FALLBACK-false}"
-notify-send "Running nix via the wrapper."
+me="$(basename "$0")"
if [ "$_NIX_WRAPPER_FALLBACK" = "true" ]; then
# Allow skipping the size check.
- nix "$@"
+ "$me" "$@"
else
usage="$(btrfs filesystem usage /nix --raw 2>/dev/null)"
avail="$(echo "$usage" | grep 'Device size:' | cut -f 3 | sed 's/ //g')"
used="$(echo "$usage" | grep 'Used:' | cut -f 4 | head -n 1 | sed 's/ //g')"
- perc="$(printf "scale=3\n%d / %d\n" "$used" "$avail" | bc)"
- perc="$(printf "%d * 100\n" "$perc" | bc)"
+ perc="$(printf "scale=4\n%d / %d\n" "$used" "$avail" | bc)"
+ perc="$(printf "scale=2\n%s * 100\n" "0$perc" | bc)"
- if test -gt "$perc" "0.2"; then
- nix "$@"
+ if test "$(printf "%s >= 20\n" "$perc" | bc)" = "1"; then
+ "$me" "$@"
else
- echo "Not enough space free, in nix store: Only, $perc is still free."
+ echo "Not enough space free, in nix store: Only, $perc% is still free."
exit 3
fi
fi
diff --git a/modules/by-name/ro/rofi/module.nix b/modules/by-name/ro/rofi/module.nix
index ac23b499..b447ca1e 100644
--- a/modules/by-name/ro/rofi/module.nix
+++ b/modules/by-name/ro/rofi/module.nix
@@ -23,8 +23,8 @@ in {
home-manager.users.soispha = {
programs.rofi = {
enable = true;
- terminal = lib.getExe config.soispha.programs.alacritty.package;
theme = ./nord-twoLines.rasi;
+ settings.terminal = lib.getExe' config.home-manager.users.soispha.programs.foot.package "footclient";
};
};
};
diff --git a/pkgs/by-name/ro/rollup/package.unstable.nix b/pkgs/by-name/ro/rollup/package.unstable.nix
index eabb701a..2fdc7f52 100644
--- a/pkgs/by-name/ro/rollup/package.unstable.nix
+++ b/pkgs/by-name/ro/rollup/package.unstable.nix
@@ -13,6 +13,7 @@
git,
patchutils,
makeWrapper,
+ mktemp,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "rollup";
@@ -30,7 +31,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
postInstall = ''
wrapProgram $out/bin/rollup \
- --set PATH ${lib.makeBinPath [git patchutils]}
+ --set PATH ${lib.makeBinPath [git patchutils mktemp]}
'';
meta = {
diff --git a/pkgs/by-name/ro/rollup/src/main.rs b/pkgs/by-name/ro/rollup/src/main.rs
index 71a54049..cd205586 100644
--- a/pkgs/by-name/ro/rollup/src/main.rs
+++ b/pkgs/by-name/ro/rollup/src/main.rs
@@ -1,11 +1,12 @@
use std::{
+ env::current_dir,
io::Write,
path::PathBuf,
process::{Command, Stdio},
};
use anyhow::{Context, Result, bail};
-use clap::Parser;
+use clap::{Parser, Subcommand};
use crate::parse::{FileDiff, Patch};
@@ -13,17 +14,33 @@ mod parse;
#[derive(Parser)]
struct Cli {
- /// The file to pull the patch to rollup from.
- patch_files: Vec<PathBuf>,
+ #[command(subcommand)]
+ subcommand: Cmd,
+}
+
+#[derive(Subcommand)]
+enum Cmd {
+ /// Apply patches to a rollup target.
+ Apply {
+ /// The files to pull the patches to rollup from.
+ patch_files: Vec<PathBuf>,
+
+ /// Which repository to use as a target for the rollup
+ ///
+ /// The repository needs to be clean.
+ #[arg(short, long)]
+ to: PathBuf,
- /// Which repository to use as a target for the rollup
- ///
- /// Needs to be clean.
- #[arg(short, long)]
- to: PathBuf,
+ /// Show debug information related to the parsing of patch files.
+ #[arg(short, long)]
+ debug_parse: bool,
+ },
- #[arg(short, long)]
- debug: bool,
+ /// Create the patch files (based on the given tag)
+ Create {
+ #[arg(default_value = "CONFIG_APPLIED")]
+ tag: String,
+ },
}
macro_rules! git {
@@ -81,19 +98,63 @@ macro_rules! git {
fn main() -> Result<()> {
let args = Cli::parse();
+ match args.subcommand {
+ Cmd::Apply {
+ patch_files,
+ to,
+ debug_parse,
+ } => apply_patches(patch_files, to, debug_parse)?,
+ Cmd::Create { tag } => create_patches(tag)?,
+ }
+
+ Ok(())
+}
+
+fn create_patches(tag: String) -> Result<()> {
+ let current_dir = current_dir()?;
+
+ let (stdout, _) = git!(in current_dir; "tag", "--contains", "HEAD", tag.as_str());
+ if !stdout.is_empty() {
+ println!(
+ "There are no tags to generate. Tag {} already points to HEAD.",
+ tag
+ );
+ return Ok(());
+ }
+
+ let mktemp = Command::new("mktemp")
+ .args(["-t", "rollup_patches_XXXXXX", "-d"])
+ .output()
+ .context("Failed to run `mktemp -t rollup_patches_XXXXXX -d`")?;
+ if !mktemp.status.success() {
+ bail!("Failed to generate temp-directory for generated patches.");
+ }
+
+ let tempdir = PathBuf::from(String::from_utf8(mktemp.stdout).unwrap().trim());
+
+ git!(in current_dir; "format-patch", format!("{}..", tag).as_str(), "-o", tempdir.display().to_string().as_str());
+ git!(in current_dir; "tag", "--delete", tag.as_str());
+ git!(in current_dir; "tag", "--annotate", tag.as_str(), "-m", "");
+
+ println!("Patches have been generated here: `{}`", tempdir.display());
+
+ Ok(())
+}
+
+fn apply_patches(patch_files: Vec<PathBuf>, to: PathBuf, debug_parse: bool) -> Result<()> {
let mut patches = vec![];
- for file in &args.patch_files {
- patches.push(parse::parse_file(file, args.debug)?);
+ for file in &patch_files {
+ patches.push(parse::parse_file(file, debug_parse)?);
}
eprintln!("Successfully parsed all {} patch files.", patches.len());
{
- let (stdout, _) = git!(in args.to; "status", "--porcelain");
+ let (stdout, _) = git!(in to; "status", "--porcelain");
if !stdout.is_empty() {
bail!(
"`--to` (`{}`) workspace is dirty, refusing to continue.",
- args.to.display()
+ to.display()
);
}
}
@@ -102,21 +163,21 @@ fn main() -> Result<()> {
eprintln!(
"Applying {}. patch: `{}`... ",
idx + 1,
- args.patch_files[idx].display()
+ patch_files[idx].display()
);
let mut final_diffs = vec![];
for file_diff in &patch.files {
match file_diff {
FileDiff::Add { path, .. } => {
- if args.to.join(path).exists() {
+ if to.join(path).exists() {
bail!("A file was added, that already existed. This should be impossible.")
}
final_diffs.push(file_diff.to_owned());
// eprintln!(" > Keeping add of `{}`", path.display());
}
FileDiff::Remove { path, .. } => {
- if args.to.join(path).exists() {
+ if to.join(path).exists() {
final_diffs.push(file_diff.to_owned());
// eprintln!(" > Keeping remove of `{}`", path.display());
} else {
@@ -128,8 +189,8 @@ fn main() -> Result<()> {
}
FileDiff::RenameNoChange { from, to, .. }
| FileDiff::RenameWithChange { from, to, .. } => {
- if args.to.join(from).exists() {
- if args.to.join(to).exists() {
+ if to.join(from).exists() {
+ if to.join(to).exists() {
bail!(
"A rename (`{}` -> `{}`) tried to rename a path to an already existing path. This should be impossible.",
from.display(),
@@ -147,7 +208,7 @@ fn main() -> Result<()> {
}
}
FileDiff::Change { path, .. } => {
- if args.to.join(path).exists() {
+ if to.join(path).exists() {
final_diffs.push(file_diff.to_owned());
} else {
eprintln!(
@@ -169,9 +230,9 @@ fn main() -> Result<()> {
..patch.to_owned()
};
- git!(@set_stdin_to filtered_patch; in args.to; "apply", "-", "--whitespace=nowarn");
- git!(in args.to; "add", ".");
- git!(@set_stdin_to filtered_patch.commit_message; in args.to; "commit", "--file=-", format!("--date={}", filtered_patch.date).as_str(), "--quiet");
+ git!(@set_stdin_to filtered_patch; in to; "apply", "-", "--whitespace=nowarn");
+ git!(in to; "add", ".");
+ git!(@set_stdin_to filtered_patch.commit_message; in to; "commit", "--file=-", format!("--date={}", filtered_patch.date).as_str(), "--quiet");
}
Ok(())
diff --git a/scripts/build.sh b/scripts/build.sh
index b311eb65..6c3d2461 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -23,6 +23,8 @@ remove_symlink() {
link="$1"
if [ -L "$link" ]; then
rm "$link"
+ elif ! [ -e "$link" ]; then
+ : "Not existing file is also okay"
else
echo "ERROR: '$link' is not a symlink. Not removing it." 1>&2
exit 1