some formatting
This commit is contained in:
parent
c91faa5aaf
commit
57c3bb3e61
21 changed files with 472 additions and 360 deletions
|
|
@ -1,12 +1,25 @@
|
|||
# A fast, GPU-accelerated terminal emulator.
|
||||
{pkgs, ...}: {
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
settings = {
|
||||
env = {
|
||||
TERM = "xterm-256color";
|
||||
};
|
||||
font = {
|
||||
normal = {
|
||||
family = lib.mkForce "Monaspace Krypton";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
home.packages = with pkgs; [ueberzugpp];
|
||||
home.packages = with pkgs; [
|
||||
ueberzugpp
|
||||
monaspace
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./atuin.nix
|
||||
./bat.nix
|
||||
|
|
@ -18,7 +19,8 @@
|
|||
];
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
home.packages = with pkgs;
|
||||
home.packages =
|
||||
with pkgs;
|
||||
[
|
||||
# Editors
|
||||
# neovim # Improved version of vim, often used with overlays.
|
||||
|
|
@ -56,6 +58,7 @@
|
|||
age
|
||||
portal
|
||||
atac
|
||||
dblab
|
||||
|
||||
# TUI Apps
|
||||
#ncdu_2
|
||||
|
|
|
|||
|
|
@ -3,11 +3,15 @@
|
|||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
cfg = config.programs.discord;
|
||||
|
||||
discordPatcherBin = pkgs.writers.writePython3Bin "discord-krisp-patcher" {
|
||||
libraries = with pkgs.python3Packages; [pyelftools capstone];
|
||||
libraries = with pkgs.python3Packages; [
|
||||
pyelftools
|
||||
capstone
|
||||
];
|
||||
flakeIgnore = [
|
||||
"E265" # from nix-shell shebang
|
||||
"E501" # line too long (82 > 79 characters)
|
||||
|
|
@ -27,19 +31,16 @@
|
|||
# link fix
|
||||
nss = pkgs.nss_latest;
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.programs.discord = {
|
||||
enable = lib.mkEnableOption "Discord";
|
||||
wrapDiscord = lib.mkEnableOption "wrap the Discord binary with a patching each time";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages =
|
||||
[discordPatcherBin]
|
||||
++ (
|
||||
if cfg.wrapDiscord
|
||||
then [wrapDiscordBinary]
|
||||
else [pkgs.discord]
|
||||
);
|
||||
home.packages = [
|
||||
discordPatcherBin
|
||||
] ++ (if cfg.wrapDiscord then [ wrapDiscordBinary ] else [ pkgs.discord ]);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import sys
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
from elftools.elf.elffile import ELFFile
|
||||
from capstone import *
|
||||
from capstone.x86 import *
|
||||
from elftools.elf.elffile import ELFFile
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print(f"Usage: {sys.argv[0]} [path to discord_krisp.node]")
|
||||
|
|
@ -13,14 +13,18 @@ if len(sys.argv) < 2:
|
|||
executable = sys.argv[1]
|
||||
|
||||
elf = ELFFile(open(executable, "rb"))
|
||||
symtab = elf.get_section_by_name('.symtab')
|
||||
symtab = elf.get_section_by_name(".symtab")
|
||||
|
||||
krisp_initialize_address = symtab.get_symbol_by_name("_ZN7discord15KrispInitializeEv")[0].entry.st_value
|
||||
isSignedByDiscord_address = symtab.get_symbol_by_name("_ZN7discord4util17IsSignedByDiscordERKNSt2Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE")[0].entry.st_value
|
||||
krisp_initialize_address = symtab.get_symbol_by_name("_ZN7discord15KrispInitializeEv")[
|
||||
0
|
||||
].entry.st_value
|
||||
isSignedByDiscord_address = symtab.get_symbol_by_name(
|
||||
"_ZN7discord4util17IsSignedByDiscordERKNSt2Cr12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE"
|
||||
)[0].entry.st_value
|
||||
|
||||
text = elf.get_section_by_name('.text')
|
||||
text_start = text['sh_addr']
|
||||
text_start_file = text['sh_offset']
|
||||
text = elf.get_section_by_name(".text")
|
||||
text_start = text["sh_addr"]
|
||||
text_start_file = text["sh_offset"]
|
||||
# This seems to always be zero (.text starts at the right offset in the file). Do it just in case?
|
||||
address_to_file = text_start_file - text_start
|
||||
|
||||
|
|
@ -72,9 +76,9 @@ if je_location:
|
|||
print(f"Found patch location: 0x{je_location:x}")
|
||||
|
||||
shutil.copyfile(executable, executable + ".orig")
|
||||
f = open(executable, 'rb+')
|
||||
f = open(executable, "rb+")
|
||||
f.seek(je_location - address_to_file)
|
||||
f.write(b'\x66\x90') # Two byte NOP
|
||||
f.write(b"\x66\x90") # Two byte NOP
|
||||
f.close()
|
||||
else:
|
||||
if found_already_patched:
|
||||
|
|
|
|||
|
|
@ -1,123 +1,126 @@
|
|||
{...}: {
|
||||
{ ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins.bufferline = let
|
||||
mouse = {
|
||||
right =
|
||||
# Lua
|
||||
"'vertical sbuffer %d'";
|
||||
close =
|
||||
# Lua
|
||||
''
|
||||
function(bufnum)
|
||||
require("mini.bufremove").delete(bufnum)
|
||||
end
|
||||
'';
|
||||
};
|
||||
in {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
options = {
|
||||
mode = "buffers";
|
||||
always_show_bufferline = true;
|
||||
buffer_close_icon = "";
|
||||
close_command.__raw = mouse.close;
|
||||
close_icon = "";
|
||||
diagnostics = "nvim_lsp";
|
||||
diagnostics_indicator =
|
||||
plugins.bufferline =
|
||||
let
|
||||
mouse = {
|
||||
right =
|
||||
# Lua
|
||||
"'vertical sbuffer %d'";
|
||||
close =
|
||||
# Lua
|
||||
''
|
||||
function(count, level, diagnostics_dict, context)
|
||||
local s = ""
|
||||
for e, n in pairs(diagnostics_dict) do
|
||||
local sym = e == "error" and " "
|
||||
or (e == "warning" and " " or "" )
|
||||
if(sym ~= "") then
|
||||
s = s .. " " .. n .. sym
|
||||
end
|
||||
end
|
||||
return s
|
||||
function(bufnum)
|
||||
require("mini.bufremove").delete(bufnum)
|
||||
end
|
||||
'';
|
||||
# Will make sure all names in bufferline are unique
|
||||
enforce_regular_tabs = false;
|
||||
};
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
|
||||
groups = {
|
||||
options = {
|
||||
toggle_hidden_on_enter = true;
|
||||
settings = {
|
||||
options = {
|
||||
mode = "buffers";
|
||||
always_show_bufferline = true;
|
||||
buffer_close_icon = "";
|
||||
close_command.__raw = mouse.close;
|
||||
close_icon = "";
|
||||
diagnostics = "nvim_lsp";
|
||||
diagnostics_indicator =
|
||||
# Lua
|
||||
''
|
||||
function(count, level, diagnostics_dict, context)
|
||||
local s = ""
|
||||
for e, n in pairs(diagnostics_dict) do
|
||||
local sym = e == "error" and " "
|
||||
or (e == "warning" and " " or "" )
|
||||
if(sym ~= "") then
|
||||
s = s .. " " .. n .. sym
|
||||
end
|
||||
end
|
||||
return s
|
||||
end
|
||||
'';
|
||||
# Will make sure all names in bufferline are unique
|
||||
enforce_regular_tabs = false;
|
||||
|
||||
groups = {
|
||||
options = {
|
||||
toggle_hidden_on_enter = true;
|
||||
};
|
||||
|
||||
items = [
|
||||
{
|
||||
name = "Tests";
|
||||
highlight = {
|
||||
underline = true;
|
||||
fg = "#a6da95";
|
||||
sp = "#494d64";
|
||||
};
|
||||
priority = 2;
|
||||
# icon = "";
|
||||
matcher.__raw = ''
|
||||
function(buf)
|
||||
return buf.name:match('%test') or buf.name:match('%.spec')
|
||||
end
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "Docs";
|
||||
highlight = {
|
||||
undercurl = true;
|
||||
fg = "#ffffff";
|
||||
sp = "#494d64";
|
||||
};
|
||||
auto_close = false;
|
||||
matcher.__raw = ''
|
||||
function(buf)
|
||||
return buf.name:match('%.md') or buf.name:match('%.txt')
|
||||
end
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
items = [
|
||||
indicator = {
|
||||
style = "icon";
|
||||
icon = "▎";
|
||||
};
|
||||
|
||||
left_trunc_marker = "";
|
||||
max_name_length = 18;
|
||||
max_prefix_length = 15;
|
||||
modified_icon = "●";
|
||||
|
||||
numbers.__raw = ''
|
||||
function(opts)
|
||||
return string.format('%s·%s', opts.raise(opts.id), opts.lower(opts.ordinal))
|
||||
end
|
||||
'';
|
||||
|
||||
persist_buffer_sort = true;
|
||||
right_mouse_command.__raw = mouse.right;
|
||||
right_trunc_marker = "";
|
||||
separator_style = "slant";
|
||||
show_buffer_close_icons = true;
|
||||
show_buffer_icons = true;
|
||||
show_close_icon = true;
|
||||
show_tab_indicators = true;
|
||||
sort_by = "extension";
|
||||
tab_size = 18;
|
||||
|
||||
offsets = [
|
||||
{
|
||||
name = "Tests";
|
||||
highlight = {
|
||||
underline = true;
|
||||
fg = "#a6da95";
|
||||
sp = "#494d64";
|
||||
};
|
||||
priority = 2;
|
||||
# icon = "";
|
||||
matcher.__raw = ''
|
||||
function(buf)
|
||||
return buf.name:match('%test') or buf.name:match('%.spec')
|
||||
end
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "Docs";
|
||||
highlight = {
|
||||
undercurl = true;
|
||||
fg = "#ffffff";
|
||||
sp = "#494d64";
|
||||
};
|
||||
auto_close = false;
|
||||
matcher.__raw = ''
|
||||
function(buf)
|
||||
return buf.name:match('%.md') or buf.name:match('%.txt')
|
||||
end
|
||||
'';
|
||||
filetype = "neo-tree";
|
||||
text = "File Explorer";
|
||||
text_align = "center";
|
||||
highlight = "Directory";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
indicator = {
|
||||
style = "icon";
|
||||
icon = "▎";
|
||||
};
|
||||
|
||||
left_trunc_marker = "";
|
||||
max_name_length = 18;
|
||||
max_prefix_length = 15;
|
||||
modified_icon = "●";
|
||||
|
||||
numbers.__raw = ''
|
||||
function(opts)
|
||||
return string.format('%s·%s', opts.raise(opts.id), opts.lower(opts.ordinal))
|
||||
end
|
||||
'';
|
||||
|
||||
persist_buffer_sort = true;
|
||||
right_mouse_command.__raw = mouse.right;
|
||||
right_trunc_marker = "";
|
||||
separator_style = "slant";
|
||||
show_buffer_close_icons = true;
|
||||
show_buffer_icons = true;
|
||||
show_close_icon = true;
|
||||
show_tab_indicators = true;
|
||||
sort_by = "extension";
|
||||
tab_size = 18;
|
||||
|
||||
offsets = [
|
||||
{
|
||||
filetype = "neo-tree";
|
||||
text = "File Explorer";
|
||||
text_align = "center";
|
||||
highlight = "Directory";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
programs.nixvim = {
|
||||
extraConfigLuaPre =
|
||||
# lua
|
||||
|
|
@ -10,22 +11,22 @@
|
|||
local slow_format_filetypes = {}
|
||||
|
||||
vim.api.nvim_create_user_command("FormatDisable", function(args)
|
||||
if args.bang then
|
||||
if args.bang then
|
||||
-- FormatDisable! will disable formatting just for this buffer
|
||||
vim.b.disable_autoformat = true
|
||||
else
|
||||
vim.g.disable_autoformat = true
|
||||
end
|
||||
end, {
|
||||
desc = "Disable autoformat-on-save",
|
||||
bang = true,
|
||||
})
|
||||
desc = "Disable autoformat-on-save",
|
||||
bang = true,
|
||||
})
|
||||
vim.api.nvim_create_user_command("FormatEnable", function()
|
||||
vim.b.disable_autoformat = false
|
||||
vim.g.disable_autoformat = false
|
||||
end, {
|
||||
desc = "Re-enable autoformat-on-save",
|
||||
})
|
||||
desc = "Re-enable autoformat-on-save",
|
||||
})
|
||||
vim.api.nvim_create_user_command("FormatToggle", function(args)
|
||||
if args.bang then
|
||||
-- Toggle formatting for current buffer
|
||||
|
|
@ -35,9 +36,9 @@
|
|||
vim.g.disable_autoformat = not vim.g.disable_autoformat
|
||||
end
|
||||
end, {
|
||||
desc = "Toggle autoformat-on-save",
|
||||
bang = true,
|
||||
})
|
||||
desc = "Toggle autoformat-on-save",
|
||||
bang = true,
|
||||
})
|
||||
'';
|
||||
|
||||
plugins = {
|
||||
|
|
@ -63,7 +64,7 @@
|
|||
end
|
||||
|
||||
return { timeout_ms = 200, lsp_fallback = true }, on_format
|
||||
end
|
||||
end
|
||||
'';
|
||||
|
||||
format_after_save =
|
||||
|
|
@ -97,40 +98,40 @@
|
|||
"shellharden"
|
||||
"shfmt"
|
||||
];
|
||||
bicep = ["bicep"];
|
||||
c = ["clang_format"];
|
||||
cmake = ["cmake-format"];
|
||||
cpp = ["clang_format"];
|
||||
cs = ["csharpier"];
|
||||
css = ["stylelint"];
|
||||
fish = ["fish_indent"];
|
||||
fsharp = ["fantomas"];
|
||||
go = ["gofmt"];
|
||||
haskell = ["ormolu"];
|
||||
bicep = [ "bicep" ];
|
||||
c = [ "clang_format" ];
|
||||
cmake = [ "cmake-format" ];
|
||||
cpp = [ "clang_format" ];
|
||||
cs = [ "csharpier" ];
|
||||
css = [ "stylelint" ];
|
||||
fish = [ "fish_indent" ];
|
||||
fsharp = [ "fantomas" ];
|
||||
go = [ "gofmt" ];
|
||||
haskell = [ "ormolu" ];
|
||||
javascript = [
|
||||
[
|
||||
"prettierd"
|
||||
"prettier"
|
||||
]
|
||||
];
|
||||
json = ["jq"];
|
||||
lua = ["stylua"];
|
||||
markdown = ["deno_fmt"];
|
||||
nix = ["nixfmt"];
|
||||
json = [ "jq" ];
|
||||
lua = [ "stylua" ];
|
||||
markdown = [ "deno_fmt" ];
|
||||
nix = [ "nixfmt" ];
|
||||
python = [
|
||||
"isort"
|
||||
"black"
|
||||
];
|
||||
rust = ["rustfmt"];
|
||||
rust = [ "rustfmt" ];
|
||||
sh = [
|
||||
"shellcheck"
|
||||
"shellharden"
|
||||
"shfmt"
|
||||
];
|
||||
sql = ["sqlfluff"];
|
||||
swift = ["swift_format"];
|
||||
terraform = ["terraform_fmt"];
|
||||
toml = ["taplo"];
|
||||
sql = [ "sqlfluff" ];
|
||||
swift = [ "swift_format" ];
|
||||
terraform = [ "terraform_fmt" ];
|
||||
toml = [ "taplo" ];
|
||||
typescript = [
|
||||
[
|
||||
"prettierd"
|
||||
|
|
@ -141,8 +142,8 @@
|
|||
"xmlformat"
|
||||
"xmllint"
|
||||
];
|
||||
yaml = ["yamlfmt"];
|
||||
zig = ["zigfmt"];
|
||||
yaml = [ "yamlfmt" ];
|
||||
zig = [ "zigfmt" ];
|
||||
"_" = [
|
||||
"squeeze_blanks"
|
||||
"trim_whitespace"
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
{...}: {
|
||||
{ ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
mini = {
|
||||
enable = true;
|
||||
|
||||
modules = {
|
||||
bufremove = {};
|
||||
bufremove = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -44,7 +45,7 @@
|
|||
|
||||
local get_listed_bufs = function()
|
||||
return vim.tbl_filter(function(bufnr)
|
||||
return vim.api.nvim_buf_get_option(bufnr, "buflisted")
|
||||
return vim.api.nvim_buf_get_option(bufnr, "buflisted")
|
||||
end, vim.api.nvim_list_bufs())
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{...}: {
|
||||
{ ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins.noice = {
|
||||
enable = true;
|
||||
|
|
@ -51,7 +52,7 @@
|
|||
pattern = "^:%s*he?l?p?%s+";
|
||||
icon = "";
|
||||
};
|
||||
input = {};
|
||||
input = { };
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -105,9 +106,9 @@
|
|||
local servers = { 'jdtls' }
|
||||
|
||||
for index, value in ipairs(servers) do
|
||||
if value == client then
|
||||
return true
|
||||
end
|
||||
if value == client then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{pkgs, ...}: {
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
extraPlugins = [pkgs.vimPlugins.precognition-nvim];
|
||||
extraPlugins = [ pkgs.vimPlugins.precognition-nvim ];
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
|
|
@ -9,9 +10,9 @@
|
|||
action.__raw = ''
|
||||
function()
|
||||
if require("precognition").toggle() then
|
||||
vim.notify("precognition on")
|
||||
vim.notify("precognition on")
|
||||
else
|
||||
vim.notify("precognition off")
|
||||
vim.notify("precognition off")
|
||||
end
|
||||
end
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
# A highly customizable status bar for Sway and other Wayland-based compositors.
|
||||
{pkgs, ...}: let
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
networkInterface.eth = "wlp3s0";
|
||||
hwmon = "/sys/class/hwmon/hwmon0/temp1_input";
|
||||
in {
|
||||
in
|
||||
{
|
||||
programs.waybar.enable = true;
|
||||
|
||||
programs.waybar.settings = {
|
||||
|
|
@ -10,9 +12,25 @@ in {
|
|||
layer = "bottom";
|
||||
position = "top";
|
||||
height = 24;
|
||||
modules-left = ["hyprland/workspaces" "sway/mode"];
|
||||
modules-center = ["hyprland/window" "gamemode"];
|
||||
modules-right = ["network" "pulseaudio" "cpu" "custom/cpu_freq" "temperature" "memory" "battery" "tray" "clock"];
|
||||
modules-left = [
|
||||
"hyprland/workspaces"
|
||||
"sway/mode"
|
||||
];
|
||||
modules-center = [
|
||||
"hyprland/window"
|
||||
"gamemode"
|
||||
];
|
||||
modules-right = [
|
||||
"network"
|
||||
"pulseaudio"
|
||||
"cpu"
|
||||
"custom/cpu_freq"
|
||||
"temperature"
|
||||
"memory"
|
||||
"battery"
|
||||
"tray"
|
||||
"clock"
|
||||
];
|
||||
|
||||
"hyprland/workspaces".sort-by-number = true;
|
||||
|
||||
|
|
@ -34,16 +52,14 @@ in {
|
|||
"custom/cpu_freq" = {
|
||||
format = "{}MHz ";
|
||||
interval = 5;
|
||||
exec =
|
||||
pkgs.writeShellScript "cpuFreq"
|
||||
''
|
||||
${pkgs.busybox}/bin/cat /proc/cpuinfo | \
|
||||
${pkgs.busybox}/bin/grep MHz | \
|
||||
${pkgs.busybox}/bin/cut -c 12-15 | \
|
||||
${pkgs.busybox}/bin/tr '\n' ' ' | \
|
||||
${pkgs.busybox}/bin/awk '{s+=$1}END{print "",s/NR}' RS=" " | \
|
||||
${pkgs.busybox}/bin/cut -c 2-5
|
||||
'';
|
||||
exec = pkgs.writeShellScript "cpuFreq" ''
|
||||
${pkgs.busybox}/bin/cat /proc/cpuinfo | \
|
||||
${pkgs.busybox}/bin/grep MHz | \
|
||||
${pkgs.busybox}/bin/cut -c 12-15 | \
|
||||
${pkgs.busybox}/bin/tr '\n' ' ' | \
|
||||
${pkgs.busybox}/bin/awk '{s+=$1}END{print "",s/NR}' RS=" " | \
|
||||
${pkgs.busybox}/bin/cut -c 2-5
|
||||
'';
|
||||
};
|
||||
|
||||
"battery" = {
|
||||
|
|
@ -55,7 +71,13 @@ in {
|
|||
};
|
||||
"format" = "{capacity}% {icon} ";
|
||||
"format-full" = "";
|
||||
"format-icons" = ["" "" "" "" ""];
|
||||
"format-icons" = [
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
];
|
||||
};
|
||||
|
||||
"memory"."format" = "{used:0.1f}G/{total:0.1f}G ";
|
||||
|
|
@ -81,7 +103,10 @@ in {
|
|||
"phone" = "";
|
||||
"portable" = "";
|
||||
"car" = "";
|
||||
"default" = ["" ""];
|
||||
"default" = [
|
||||
""
|
||||
""
|
||||
];
|
||||
};
|
||||
"on-click" = "pavucontrol";
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue