This commit is contained in:
Elisiei Yehorov 2025-11-16 01:03:19 +01:00
commit b891aeeb46
Signed by: elisiei
GPG key ID: BA1D158DCE3DF089
67 changed files with 4178 additions and 0 deletions

77
Makefile Normal file
View file

@ -0,0 +1,77 @@
###############################################################################
# 🛠️ NixOS & System Management Commands
#
# These commands help manage the system configuration using Nix flakes.
###############################################################################
.PHONY: copy-config deploy home upgrade debug up upp test history repl clean gc-sudo gc gcboot
# 🛑 Utility function: copy ~/nixos to /etc/nixos
copy-config:
sudo rm -rf /etc/nixos/*
sudo cp -r ~/nixos/* /etc/nixos/
# 🚀 Deploy the current system configuration and make it the default on boot.
# Usage: make deploy
deploy: copy-config
sudo nixos-rebuild switch --flake /etc/nixos
# 🏡 Same as `deploy`, but with a custom flake target (e.g., for home-manager).
# Usage: make home
home: copy-config
sudo nixos-rebuild switch --flake /etc/nixos#nixos
# ⬆️ Upgrade system packages and apply the latest flake changes.
# Usage: make upgrade
upgrade: copy-config
sudo nixos-rebuild switch --upgrade --flake /etc/nixos
# 🐛 Like `deploy`, but with verbose logs and error traces for debugging.
# Usage: make debug
debug: copy-config
sudo nixos-rebuild switch --flake /etc/nixos --show-trace --verbose
# 🌐 Update all flake inputs to their latest versions.
# Usage: make up
up:
nix flake update /etc/nixos
# 🔍 Update a specific flake input (e.g., `make upp i=home-manager`)
# Usage: make upp i=home-manager
upp:
nix flake update ~/nixos/${i}
# 🧪 Test the configuration without setting it as the default boot entry.
# Usage: make test
test: copy-config
sudo nixos-rebuild test --flake /etc/nixos
# 🕓 Show system profile history.
# Usage: make history
history:
nix profile history --profile /nix/var/nix/profiles/system
# 💻 Launch the Nix REPL with nixpkgs from the flake.
# Usage: make repl
repl:
nix repl -f flake:nixpkgs
# 🧹 Clean up system profile history older than 1 day.
# Usage: make clean
clean:
sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 1d
# 🧼 Collect and delete old garbage as root.
# Usage: make gc-sudo
gc-sudo:
sudo nix-collect-garbage -d
# 🧽 Same as above, but for the current user.
# Usage: make gc
gc:
nix-collect-garbage -d
# 🥾 Boot into a specific configuration without switching immediately.
# Usage: make gcboot
gcboot:
sudo /run/current-system/bin/switch-to-configuration boot

243
flake.lock generated Normal file
View file

@ -0,0 +1,243 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1754487366,
"narHash": "sha256-pHYj8gUBapuUzKV/kN/tR3Zvqc7o6gdFB9XKXIp1SQ8=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "af66ad14b28a127c5c0f3bbb298218fc63528a18",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1754950654,
"narHash": "sha256-30f9MF+zIKLodQRuSLyY4OSDZSOy5O+/FslgPt/prbc=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "d19f3213e51469321835a9188adfa20391ff9371",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"ixx": {
"inputs": {
"flake-utils": [
"nixvim",
"nuschtosSearch",
"flake-utils"
],
"nixpkgs": [
"nixvim",
"nuschtosSearch",
"nixpkgs"
]
},
"locked": {
"lastModified": 1748294338,
"narHash": "sha256-FVO01jdmUNArzBS7NmaktLdGA5qA3lUMJ4B7a05Iynw=",
"owner": "NuschtOS",
"repo": "ixx",
"rev": "cc5f390f7caf265461d4aab37e98d2292ebbdb85",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"ref": "v0.0.8",
"repo": "ixx",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1754882787,
"narHash": "sha256-Y2nY1s+ZS3vkVS72SsEa/zJe+j9JuwLbev4grzcHTA8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "59ca61e5a844a0c35cdc272bc671c5d9b6840741",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable-small",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1754725699,
"narHash": "sha256-iAcj9T/Y+3DBy2J0N+yF9XQQQ8IEb5swLFzs23CdP88=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "85dbfc7aaf52ecb755f87e577ddbe6dbbdbc1054",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixvim": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": [
"nixpkgs"
],
"nuschtosSearch": "nuschtosSearch",
"systems": "systems_2"
},
"locked": {
"lastModified": 1754921951,
"narHash": "sha256-KY+/livAp6l3fI8SdNa+CLN/AA4Z038yL/pQL2PaW7g=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "7b53322d75a1c66f84fb145e4b5f0f411d9edc6b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixvim",
"type": "github"
}
},
"nuschtosSearch": {
"inputs": {
"flake-utils": "flake-utils",
"ixx": "ixx",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1754301638,
"narHash": "sha256-aRgzcPDd2axHFOuMlPLuzmDptUM2JU8mUL3jfgbBeyc=",
"owner": "NuschtOS",
"repo": "search",
"rev": "a60091045273484c040a91f5c229ba298f8ecc27",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"repo": "search",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nixvim": "nixvim",
"spicetify-nix": "spicetify-nix"
}
},
"spicetify-nix": {
"inputs": {
"nixpkgs": "nixpkgs_2",
"systems": "systems_3"
},
"locked": {
"lastModified": 1754801101,
"narHash": "sha256-oxWjZ/SfhCvHFNePZcUu+LcE5j4xxuIt/yaoaSvMZk0=",
"owner": "Gerg-L",
"repo": "spicetify-nix",
"rev": "fcbfc21572518c68317df992929b28df9a1d8468",
"type": "github"
},
"original": {
"owner": "Gerg-L",
"repo": "spicetify-nix",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

41
flake.nix Normal file
View file

@ -0,0 +1,41 @@
{
description = "Modular and minimalist NixOS configuration";
inputs = {
# Nixos
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable-small";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# Spotify
spicetify-nix.url = "github:Gerg-L/spicetify-nix";
# Nvim
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{ nixpkgs, home-manager, ... }:
{
nixosConfigurations = {
nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./nixos/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.elisiei = import ./home/home.nix;
home-manager.backupFileExtension = "hm-backup";
home-manager.extraSpecialArgs = { inherit inputs; };
}
];
};
};
};
}

37
home/home.nix Normal file
View file

@ -0,0 +1,37 @@
{
imports = [
./packages.nix
# hyprland
./modules/hyprland/default.nix
# editors
./modules/ide/nvim/default.nix
# ./modules/ide/micro/default.nix
# terminal stuff
./modules/terminal/foot/default.nix
# shell stuff
./modules/shell/bash/default.nix
# ./modules/shell/nushell/default.nix
./modules/shell/direnv/default.nix
./modules/shell/fish/default.nix
# user stuff
# ./modules/user/wofi/default.nix # deprecated, i use tofi now.
./modules/user/tofi/default.nix
./modules/user/dunst/default.nix
./modules/user/git/default.nix
# ./modules/user/obs/default.nix
];
home.username = "elisiei";
home.homeDirectory = "/home/elisiei";
home.stateVersion = "25.05";
# workaround
nixpkgs.config.allowUnfreePredicate = _: true;
programs.home-manager.enable = true;
}

View file

@ -0,0 +1,177 @@
{ pkgs, ... }:
let
wallpaperScript = pkgs.writeShellScriptBin "random-wallpaper" ''
pkill swaybg 2>/dev/null || true
WALP=$(find "$HOME/wallpapers" -type f \( -iname "*.jpg" -o -iname "*.png" \) | shuf -n 1)
[ -n "$WALP" ] && ${pkgs.swaybg}/bin/swaybg -i "$WALP" --mode fill
'';
startupScript = pkgs.writeShellScriptBin "start" ''
${wallpaperScript}/bin/random-wallpaper
'';
in
{
home.packages = [ wallpaperScript ];
wayland.windowManager.hyprland = {
enable = true;
xwayland.enable = true;
settings = {
monitor = [
",1920x1080,auto,1,bitdepth,8"
",preferred,auto,1,mirror,eDP-1,bitdepth,8"
];
xwayland = {
force_zero_scaling = "true";
};
exec-once = [ "${startupScript}/bin/start" ];
"$term" = "foot";
"$browser" = "librewolf";
"$menu" = "exec $(tofi-drun)";
env = [
"XCURSOR_THEME,macOS"
"XCURSOR_SIZE,24"
];
general = {
gaps_in = "0";
gaps_out = "0";
border_size = "0";
"col.active_border" = "rgba(0,0,0,0)";
"col.inactive_border" = "rgba(0,0,0,0)";
resize_on_border = "false";
allow_tearing = "false";
layout = "dwindle";
};
debug = {
disable_logs = false;
};
decoration = {
rounding = "0";
active_opacity = "1";
inactive_opacity = "0.95";
shadow.enabled = false;
blur = {
enabled = false;
xray = false;
special = true;
new_optimizations = true;
size = 10;
passes = 3;
brightness = 0.9;
noise = 2.0e-2;
contrast = 1.1;
popups = true;
popups_ignorealpha = 0.5;
vibrancy = 0.2;
vibrancy_darkness = 0.1;
};
};
animations = {
enabled = false;
animations = {
bezier = [
"easeOutQuint, 0.23, 1, 0.32, 1"
"easeInOutCubic, 0.65, 0.05, 0.36, 1"
"linear, 0, 0, 1, 1"
"almostLinear, 0.5, 0.5, 0.75, 1.0"
"quick, 0.15, 0, 0.1, 1"
];
animation = [
"global, 1, 10, default"
"border, 1, 5.39, easeOutQuint"
"windows, 1, 4.79, easeOutQuint"
"windowsIn, 1, 4.1, easeOutQuint, popin 87%"
"windowsOut, 1, 1.49, linear, popin 87%"
"fadeIn, 1, 1.73, almostLinear"
"fadeOut, 1, 1.46, almostLinear"
"fade, 1, 3.03, quick"
"layers, 1, 3.81, easeOutQuint"
"layersIn, 1, 4, easeOutQuint, fade"
"layersOut, 1, 1.5, linear, fade"
"fadeLayersIn, 1, 1.79, almostLinear"
"fadeLayersOut, 1, 1.39, almostLinear"
"workspaces, 1, 1.94, almostLinear, fade"
"workspacesIn, 1, 1.21, almostLinear, fade"
"workspacesOut, 1, 1.94, almostLinear, fade"
"zoomFactor, 1, 7, quick"
];
};
};
misc = {
force_default_wallpaper = "0";
disable_hyprland_logo = "true";
middle_click_paste = "false";
vfr = "true";
};
gestures.workspace_swipe = "false";
device = {
name = "epic-mouse-v1";
sensitivity = "-0.5";
};
"$mainMod" = "SUPER";
bind = [
"$mainMod SHIFT, PRINT, exec, ~/bin/grimblast copy screen" # whole screen
"$mainMod, PRINT, exec, ~/bin/grimblast copy area" # selection
"$mainMod, SPACE, exec, $menu"
"$mainMod, W, exec, random-wallpaper"
"$mainMod, S, pin"
"$mainMod, T, exec, $term"
"$mainMod, Z, exec, $browser"
# "$mainMod, K, exec, st" # CHANGE THIS SDBHFDSFSFHJ
"$mainMod, Q, killactive"
"$mainMod SHIFT, M, exit"
"$mainMod, V, togglefloating"
"$mainMod, left, movefocus, l"
"$mainMod, right, movefocus, r"
"$mainMod, up, movefocus, u"
"$mainMod, down, movefocus, d"
"$mainMod, 1, workspace, 1"
"$mainMod, 2, workspace, 2"
"$mainMod, 3, workspace, 3"
"$mainMod, 4, workspace, 4"
"$mainMod, 5, workspace, 5"
"$mainMod, 6, workspace, 6"
"$mainMod, 7, workspace, 7"
"$mainMod, 8, workspace, 8"
"$mainMod, 9, workspace, 9"
"$mainMod, 0, workspace, 10"
"$mainMod SHIFT, 1, movetoworkspace, 1"
"$mainMod SHIFT, 2, movetoworkspace, 2"
"$mainMod SHIFT, 3, movetoworkspace, 3"
"$mainMod SHIFT, 4, movetoworkspace, 4"
"$mainMod SHIFT, 5, movetoworkspace, 5"
"$mainMod SHIFT, 6, movetoworkspace, 6"
"$mainMod SHIFT, 7, movetoworkspace, 7"
"$mainMod SHIFT, 8, movetoworkspace, 8"
"$mainMod SHIFT, 9, movetoworkspace, 9"
"$mainMod SHIFT, 0, movetoworkspace, 10"
];
input = {
kb_layout = "es,ru";
kb_options = "grp:alt_space_toggle";
numlock_by_default = true;
};
bindm = [
"$mainMod, mouse:272, movewindow" # left click
"$mainMod, mouse:273, resizewindow" # right click
];
windowrulev2 = "suppressevent maximize, class:.*";
};
};
}

View file

@ -0,0 +1,5 @@
{
programs.micro = {
enable = true;
};
}

View file

@ -0,0 +1,83 @@
{ pkgs, inputs, ... }:
# my most preciated config, well documented if you want to use it.
# inspired by https://github.com/xhuyz/nixvim
{
imports = [ inputs.nixvim.homeModules.nixvim ];
programs.nixvim = {
enable = true;
imports = [
# plugins
# ./plugins/aerial.nix
./plugins/autopairs.nix
./plugins/blink.nix
./plugins/dashboard.nix
./plugins/hlchunk.nix
./plugins/lualine.nix
./plugins/neo-tree.nix
./plugins/snacks.nix
./plugins/toggleterm.nix
./plugins/treesitter.nix
./plugins/treesj.nix
./plugins/web-devicons.nix
./plugins/yanky.nix
# lsp
./lsp/fidget.nix
./lsp/lsp.nix
./lsp/roslyn.nix
# keymaps
./keymaps.nix
# themes
./themes.nix
];
globals.mapleader = " ";
opts = {
number = true;
relativenumber = false;
colorcolumn = "80";
shiftwidth = 2;
tabstop = 2;
wrap = false;
swapfile = false; # undotree
backup = false; # undotree
undofile = true;
hlsearch = false;
incsearch = true;
termguicolors = true;
scrolloff = 8;
signcolumn = "no";
updatetime = 50;
foldlevelstart = 99;
};
clipboard = {
register = "unnamedplus";
};
extraPackages = with pkgs; [
# formatters
stylua
nixfmt-rfc-style
# linters
golangci-lint
shellcheck
];
extraConfigLua = ''
vim.diagnostic.config({ virtual_lines = true })
vim.diagnostic.config({ virtual_text = true })
vim.o.undofile = true
vim.o.undodir = vim.fn.expand("~/.local/state/nvim/undo")
vim.diagnostic.config({ signs = false })
'';
};
}

View file

@ -0,0 +1,9 @@
{
keymaps = [
{
key = "<leader>qq";
mode = [ "n" ];
action = "<cmd>qa<CR>";
}
];
}

View file

@ -0,0 +1,110 @@
{
plugins.fidget = {
enable = true;
settings = {
logger = {
level = "warn"; # "off", "error", "warn", "info", "debug", "trace"
float_precision = 1.0e-2; # Limit the number of decimals displayed for floats
};
progress = {
poll_rate = 0; # How and when to poll for progress messages
suppress_on_insert = true; # Suppress new messages while in insert mode
ignore_done_already = false; # Ignore new tasks that are already complete
ignore_empty_message = false; # Ignore new tasks that don't contain a message
clear_on_detach =
# Clear notification group when LSP server detaches
''
function(client_id)
local client = vim.lsp.get_client_by_id(client_id)
return client and client.name or nil
end
'';
notification_group =
# How to get a progress message's notification group key
''
function(msg) return msg.lsp_client.name end
'';
ignore = [ ]; # List of LSP servers to ignore
lsp = {
progress_ringbuf_size = 0; # Configure the nvim's LSP progress ring buffer size
};
display = {
render_limit = 16; # How many LSP messages to show at once
done_ttl = 3; # How long a message should persist after completion
done_icon = ""; # Icon shown when all LSP progress tasks are complete
done_style = "Constant"; # Highlight group for completed LSP tasks
progress_ttl = 10; # How long a message should persist when in progress
progress_icon = {
pattern = "dots";
period = 1;
}; # Icon shown when LSP progress tasks are in progress
progress_style = "WarningMsg"; # Highlight group for in-progress LSP tasks
group_style = "Title"; # Highlight group for group name (LSP server name)
icon_style = "Question"; # Highlight group for group icons
priority = 30; # Ordering priority for LSP notification group
skip_history = true; # Whether progress notifications should be omitted from history
format_message = ''
require ("fidget.progress.display").default_format_message
''; # How to format a progress message
format_annote = ''
function (msg) return msg.title end
''; # How to format a progress annotation
format_group_name = ''
function (group) return tostring (group) end
''; # How to format a progress notification group's name
overrides = {
rust_analyzer = {
name = "rust-analyzer";
};
}; # Override options from the default notification config
};
};
notification = {
poll_rate = 10; # How frequently to update and render notifications
filter = "info"; # "off", "error", "warn", "info", "debug", "trace"
history_size = 128; # Number of removed messages to retain in history
override_vim_notify = true;
redirect = {
__raw = ''
function(msg, level, opts)
if opts and opts.on_open then
return require("fidget.integration.nvim-notify").delegate(msg, level, opts)
end
end
'';
};
configs = {
default = {
name = "Notifications";
icon = "󰏪";
group = "Notifications";
annote = true;
debug = false;
debug_rate = 0.25;
};
};
window = {
normal_hl = "Comment";
winblend = 0;
border = "none"; # none, single, double, rounded, solid, shadow
zindex = 45;
max_width = 0;
max_height = 0;
x_padding = 1;
y_padding = 0;
align = "bottom";
relative = "editor";
};
view = {
stack_upwards = true; # Display notification items from bottom to top
icon_separator = " "; # Separator between group name and icon
group_separator = "---"; # Separator between notification groups
group_separator_hl =
# Highlight group used for group separator
"Comment";
};
};
};
};
}

View file

@ -0,0 +1,18 @@
{ lib, pkgs, ... }:
{
plugins = {
lsp.servers = {
clangd.enable = true;
cmake.enable = true;
};
conform-nvim.settings = {
formatters_by_ft = {
c = [ "clang_format" ];
cpp = [ "clang_format" ];
cmake = [ "cmake-format" ];
};
formatters.cmake-format.command = lib.getExe pkgs.cmake-format;
};
};
}

View file

@ -0,0 +1,5 @@
{
imports =
with builtins;
map (fn: ./${fn}) (filter (fn: fn != "default.nix") (attrNames (readDir ./.)));
}

View file

@ -0,0 +1,23 @@
{ lib, pkgs, ... }:
{
plugins = {
lsp.servers = {
gopls = {
enable = true;
filetypes = [
"go"
];
};
};
conform-nvim.settings = {
formatters_by_ft = {
go = [ "gofmt" ];
};
formatters = {
gofmt = {
command = lib.getExe pkgs.go + " fmt";
};
};
};
};
}

View file

@ -0,0 +1,12 @@
{
plugins = {
lsp.servers.lua_ls.enable = true;
conform-nvim.settings = {
formatters_by_ft.lua = [ "stylua" ];
formatters.stylua = {
# if a command is string then it will execute the system's stylua binary
command = "stylua";
};
};
};
}

View file

@ -0,0 +1,13 @@
{
plugins = {
lsp.servers = {
nixd = {
enable = true;
cmd = [ "nixd" ];
rootMarkers = [
"require('lspconfig.util').root_pattern('.nixd.json', 'flake.nix', '.git')"
];
};
};
};
}

View file

@ -0,0 +1,21 @@
{
plugins = {
conform-nvim.settings = {
formatters = {
odinfmt = {
command = "odinfmt";
args = [ "-stdin" ];
stdin = true;
};
};
formatters_by_ft = {
odin = [ "odinfmt" ];
};
};
lsp.servers = {
ols = {
enable = true;
};
};
};
}

View file

@ -0,0 +1,12 @@
{
plugins = {
ts-autotag.enable = false;
ts-comments.enable = false;
lsp.servers = {
html.enable = true;
cssls.enable = true;
svelte.enable = false;
ts_ls.enable = false;
};
};
}

View file

@ -0,0 +1,78 @@
{
pkgs,
...
}:
{
imports = [ ./langs/default.nix ];
plugins = {
lsp = {
enable = true;
inlayHints = true;
keymaps = {
silent = true;
lspBuf = {
gd = {
action = "definition";
desc = "Goto Definition";
};
gr = {
action = "references";
desc = "Goto References";
};
gD = {
action = "declaration";
desc = "Goto Declaration";
};
gI = {
action = "implementation";
desc = "Goto Implementation";
};
gT = {
action = "type_definition";
desc = "Type Definition";
};
K = {
action = "hover";
desc = "Hover";
};
"<leader>cw" = {
action = "workspace_symbol";
desc = "Workspace Symbol";
};
"<leader>cr" = {
action = "rename";
desc = "Rename";
};
};
diagnostic = {
"<leader>cd" = {
action = "open_float";
desc = "Line Diagnostics";
};
"[d" = {
action = "goto_next";
desc = "Next Diagnostic";
};
"]d" = {
action = "goto_prev";
desc = "Previous Diagnostic";
};
};
};
};
lsp-lines.enable = true;
lsp-format.enable = true;
helm.enable = true;
};
extraPlugins = with pkgs.vimPlugins; [
roslyn-nvim
];
extraPackages = with pkgs; [
roslyn-ls
nixfmt-rfc-style
svelte-language-server
typescript-language-server
typescript
];
}

View file

@ -0,0 +1,17 @@
{ lib, pkgs, ... }:
{
lsp.servers.roslyn_ls = {
enable = true;
settings = {
cmd = [
"${lib.getExe' pkgs.roslyn-ls "Microsoft.CodeAnalysis.LanguageServer"}"
"--logLevel"
"Information"
"--extensionLogDirectory"
"fs.joinpath(uv.os_tmpdir() \"roslyn_ls/logs\")"
"--stdio"
];
};
};
}

View file

@ -0,0 +1,63 @@
{
plugins.aerial = {
enable = true;
autoLoad = true;
settings = {
attach_mode = "global";
backends = [
"treesitter"
"lsp"
"markdown"
"man"
];
disable_max_lines = 5000;
highlight_on_hover = true;
ignore = {
filetypes = [
"gomod"
];
};
keymaps = {
"<2-LeftMouse>" = "actions.jump";
"<C-j>" = "actions.down_and_scroll";
"<C-k>" = "actions.up_and_scroll";
"<C-s>" = "actions.jump_split";
"<C-v>" = "actions.jump_vsplit";
"<CR>" = "actions.jump";
"?" = "actions.show_help";
H = "actions.tree_close_recursive";
L = "actions.tree_open_recursive";
O = "actions.tree_toggle_recursive";
"[[" = "actions.prev_up";
"]]" = "actions.next_up";
"g?" = "actions.show_help";
h = "actions.tree_close";
l = "actions.tree_open";
o = "actions.tree_toggle";
p = "actions.scroll";
q = "actions.close";
zA = "actions.tree_toggle_recursive";
zC = "actions.tree_close_recursive";
zM = "actions.tree_close_all";
zO = "actions.tree_open_recursive";
zR = "actions.tree_open_all";
zX = "actions.tree_sync_folds";
za = "actions.tree_toggle";
zc = "actions.tree_close";
zm = "actions.tree_decrease_fold_level";
zo = "actions.tree_open";
zr = "actions.tree_increase_fold_level";
zx = "actions.tree_sync_folds";
"{" = "actions.prev";
"}" = "actions.next";
};
};
};
keymaps = [
{
key = "<leader>o";
mode = [ "n" ];
action = "<cmd>AerialToggle<CR>";
}
];
}

View file

@ -0,0 +1,11 @@
{
plugins.nvim-autopairs = {
enable = true;
settings = {
disable_filetype = [
"TelescopePrompt"
"vim"
];
};
};
}

View file

@ -0,0 +1,95 @@
{
plugins = {
blink-cmp = {
enable = true;
setupLspCapabilities = true;
settings = {
keymap.preset = "super-tab";
signature.enabled = true;
sources = {
default = [
"lsp"
"buffer"
"path"
"snippets"
];
providers = {
lsp.score_offset = 4;
};
};
appearance = {
nerd_font_variant = "mono";
kind_icons = {
Text = "󰉿";
Method = "";
Function = "󰊕";
Constructor = "󰒓";
Field = "󰜢";
Variable = "󰆦";
Property = "󰖷";
Class = "󱡠";
Interface = "󱡠";
Struct = "󱡠";
Module = "󰅩";
Unit = "󰪚";
Value = "󰦨";
Enum = "󰦨";
EnumMember = "󰦨";
Keyword = "󰻾";
Constant = "󰏿";
Snippet = "󱄽";
Color = "󰏘";
File = "󰈔";
Reference = "󰬲";
Folder = "󰉋";
Event = "󱐋";
Operator = "󰪚";
TypeParameter = "󰬛";
Error = "󰏭";
Warning = "󰏯";
Information = "󰏮";
Hint = "󰏭";
};
};
completion = {
menu = {
border = "none";
draw = {
gap = 1;
treesitter = [ "lsp" ];
columns = [
{ __unkeyed-1 = "label"; }
{
__unkeyed-1 = "kind_icon";
__unkeyed-2 = "kind";
gap = 1;
}
{ __unkeyed-1 = "source_name"; }
];
};
};
trigger.show_in_snippet = false;
documentation = {
auto_show = true;
window.border = "single";
};
accept.auto_brackets.enabled = false;
performance = {
debounce_ms = 80;
throttle_ms = 50;
max_view_entries = 20;
};
};
};
};
};
}

View file

@ -0,0 +1,86 @@
{
plugins.dashboard = {
enable = true;
autoLoad = true;
settings = {
theme = "doom";
config = {
header = [
""
""
""
""
""
""
""
""
""
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
""
""
""
];
center = [
{
icon = " ";
desc = "find files";
action = "lua Snacks.picker.files()";
key = "f";
}
{
icon = " ";
desc = "projects";
action = "lua Snacks.picker.projects()";
key = "p";
}
{
icon = "󱁴 ";
desc = "grep";
action = "lua Snacks.picker.grep()";
key = "s";
}
{
icon = " ";
desc = "todos";
action = "lua Snacks.picker.todo_comments()";
key = "t";
}
{
icon = " ";
desc = "ragequit";
action = "qa";
key = "x";
}
];
footer = [ "~elisiei" ];
};
};
};
extraConfigLua = ''
vim.api.nvim_create_autocmd("User", {
pattern = "DashboardReady",
callback = function()
vim.b.miniindentscope_disable = true
end,
})
'';
}

View file

@ -0,0 +1,46 @@
{
plugins.hlchunk = {
enable = true;
autoLoad = true;
settings = {
blank = {
enable = false;
};
chunk = {
chars = {
horizontal_line = "";
left_bottom = "";
left_top = "";
right_arrow = "";
vertical_line = "";
};
enable = true;
exclude_filetypes = {
lazyterm = true;
neo-tree = true;
};
style = {
fg = "#91bef0";
};
use_treesitter = true;
};
indent = {
chars = [
""
];
exclude_filetypes = {
lazyterm = true;
neo-tree = true;
};
style = {
fg = "#45475a";
};
use_treesitter = false;
};
line_num = {
style = "#91bef0";
use_treesitter = true;
};
};
};
}

View file

@ -0,0 +1,97 @@
{
plugins.lualine = {
enable = true;
settings = {
options = {
globalstatus = true;
extensions = [
"fzf"
"neo-tree"
];
disabledFiletypes = {
statusline = [
"startup"
"alpha"
];
};
theme = "kanagawa";
};
sections = {
lualine_a = [
{
__unkeyed-1 = "mode";
icon = "";
}
];
lualine_b = [
{
__unkeyed-1 = "branch";
icon = "";
}
{
__unkeyed-1 = "diff";
symbols = {
added = " ";
modified = " ";
removed = " ";
};
}
];
lualine_c = [
{
__unkeyed-1 = "diagnostics";
sources = [ "nvim_lsp" ];
symbols = {
error = " ";
warn = " ";
info = " ";
hint = "󰝶 ";
};
}
{
__unkeyed-1 = "navic";
}
];
lualine_x = [
{
__unkeyed-1 = "filetype";
icon_only = true;
separator = "";
padding = {
left = 1;
right = 0;
};
}
{
__unkeyed-1 = "filename";
path = 1;
}
{
__unkeyed-1.__raw = ''
function()
local icon = " "
local status = require("copilot.api").status.data
return icon .. (status.message or " ")
end,
cond = function()
local ok, clients = pcall(vim.lsp.get_clients, { name = "copilot", bufnr = 0 })
return ok and #clients > 0
end,
'';
}
];
lualine_y = [
{
__unkeyed-1 = "progress";
}
];
lualine_z = [
{
__unkeyed-1 = "location";
}
];
};
};
};
}

View file

@ -0,0 +1,120 @@
{
plugins.neo-tree = {
enable = true;
sources = [
"filesystem"
"buffers"
"git_status"
];
enableDiagnostics = true;
enableGitStatus = true;
enableModifiedMarkers = true;
enableRefreshOnWrite = true;
openFilesInLastWindow = true;
extraOptions = {
open_files_do_not_replace_types = [
"terminal"
"Trouble"
"trouble"
"qf"
"Outline"
];
filesystem = {
bind_to_cwd = false;
follow_current_file = {
enabled = true;
};
use_libuv_file_watcher = true;
};
window.mappings = {
"l" = "open";
"h" = "close_node";
"<space>" = "none";
"Y" = {
__raw = ''
function(state)
local node = state.tree:get_node()
local path = node:get_id()
vim.fn.setreg("+", path, "c")
end
'';
desc = "Copy Path to Clipboard";
};
"O" = {
__raw = ''
function(state)
vim.ui.open(state.tree:get_node().path)
end
'';
desc = "Open with System Application";
};
};
default_component_configs = {
indent = {
with_expanders = true;
expander_collapsed = "";
expander_expanded = "";
expander_highlight = "NeoTreeExpander";
};
git_status.symbols = {
unstaged = "󰄱";
staged = "󰱒";
};
};
};
eventHandlers = {
file_moved = ''
function(data)
require("snacks.rename").on_rename_file(data.source, data.destination)
end
'';
file_renamed = ''
function(data)
require("snacks.rename").on_rename_file(data.source, data.destination)
end
'';
};
};
keymaps = [
{
key = "<leader>fe";
mode = [ "n" ];
action = ''
<cmd>lua require("neo-tree.command").execute({ toggle = true, dir = vim.fn.getcwd() })<CR>
'';
options.desc = "Explorer NeoTree (cwd)";
}
{
key = "<leader>e";
mode = [ "n" ];
action = "<leader>fe";
options.remap = true;
options.desc = "Explorer NeoTree (cwd)";
}
{
key = "<leader>ge";
mode = [ "n" ];
action = ''
<cmd>lua require("neo-tree.command").execute({ source = "git_status", toggle = true })<CR>
'';
options.desc = "Git Explorer";
}
{
key = "<leader>be";
mode = [ "n" ];
action = ''
<cmd>lua require("neo-tree.command").execute({ source = "buffers", toggle = true })<CR>
'';
options.desc = "Buffer Explorer";
}
];
}

View file

@ -0,0 +1,45 @@
{
plugins.snacks = {
enable = true;
autoLoad = true;
};
keymaps = [
{
key = "<leader>ff";
mode = [ "n" ];
action = "<cmd>lua Snacks.picker.files()<CR>";
options.desc = "Find files";
}
{
key = "<leader>fb";
mode = [ "n" ];
action = "<cmd>lua Snacks.picker.buffers()<CR>";
options.desc = "Find buffers";
}
{
key = "<leader>gl";
mode = [ "n" ];
action = "<cmd>lua Snacks.picker.git_log()<CR>";
options.desc = "Git log";
}
{
key = "<leader>gs";
mode = [ "n" ];
action = "<cmd>lua Snacks.picker.git_status()<CR>";
options.desc = "Git status";
}
{
key = "<leader>uC";
mode = [ "n" ];
action = "<cmd>lua Snacks.picker.colorschemes()<CR>";
options.desc = "Colorschemes";
}
{
key = "<leader>:";
mode = [ "n" ];
action = "<cmd>lua Snacks.picker.command_history()<CR>";
options.desc = "Command history";
}
];
}

View file

@ -0,0 +1,33 @@
{
plugins.toggleterm = {
enable = true;
settings = {
direction = "vertical";
float_opts = {
border = "curved";
height = 30;
width = 130;
};
open_mapping = "[[<c-t>]]";
autochdir = true;
auto_scroll = true;
close_on_exit = true;
insert_mappings = true;
shell = "nu";
};
};
keymaps = [
{
key = "<C-t>";
mode = [
"n"
"t"
];
action = "<cmd>ToggleTerm<CR>";
options = {
silent = true;
noremap = true;
};
}
];
}

View file

@ -0,0 +1,32 @@
{ pkgs, ... }:
{
plugins = {
treesitter = {
enable = true;
settings = {
indent = {
enable = true;
};
highlight = {
enable = true;
};
};
nixvimInjections = true;
grammarPackages = pkgs.vimPlugins.nvim-treesitter.allGrammars;
};
treesitter-context = {
enable = false;
};
treesitter-textobjects = {
enable = true;
select = {
enable = true;
lookahead = true;
};
};
};
}

View file

@ -0,0 +1,25 @@
{
plugins.treesj = {
enable = true;
autoLoad = true;
};
keymaps = [
{
key = "<leader>m";
mode = [
"n"
];
action = "<cmd>TSJToggle<CR>";
}
{
key = "<leader>s";
mode = [ "n" ];
action = "<cmd>TSJSplit<CR>";
}
{
key = "<leader>j";
mode = [ "n" ];
action = "<cmd>TSJJoin<CR>";
}
];
}

View file

@ -0,0 +1,10 @@
{
plugins.web-devicons = {
enable = true;
autoLoad = true;
settings = {
color_icons = true;
strict = true;
};
};
}

View file

@ -0,0 +1,139 @@
{ config, lib, ... }:
{
plugins = {
sqlite-lua.enable = true;
yanky = {
enable = true;
lazyLoad = {
settings = {
keys = lib.mkIf config.plugins.lz-n.enable [
{
__unkeyed-1 = "<leader>fy";
__unkeyed-2 = "<cmd>Telescope yank_history<cr>";
desc = "Paste from yanky history";
}
{
__unkeyed-1 = "y";
__unkeyed-2 = "<Plug>(YankyYank)";
mode = [
"n"
"x"
];
desc = "Yank text";
}
{
__unkeyed-1 = "p";
__unkeyed-2 = "<Plug>(YankyPutAfter)";
mode = [
"n"
"x"
];
desc = "Put yanked text after cursor";
}
{
__unkeyed-1 = "P";
__unkeyed-2 = "<Plug>(YankyPutBefore)";
mode = [
"n"
"x"
];
desc = "Put yanked text before cursor";
}
{
__unkeyed-1 = "gp";
__unkeyed-2 = "<Plug>(YankyGPutAfter)";
mode = [
"n"
"x"
];
desc = "Put yanked text after selection";
}
{
__unkeyed-1 = "gP";
__unkeyed-2 = "<Plug>(YankyGPutBefore)";
mode = [
"n"
"x"
];
desc = "Put yanked text before selection";
}
{
__unkeyed-1 = "<c-p>";
__unkeyed-2 = "<Plug>(YankyPreviousEntry)";
desc = "Select previous entry through yank history";
}
{
__unkeyed-1 = "<c-n>";
__unkeyed-2 = "<Plug>(YankyNextEntry)";
desc = "Select next entry through yank history";
}
{
__unkeyed-1 = "]p";
__unkeyed-2 = "<Plug>(YankyPutIndentAfterLinewise)";
desc = "Put indented after cursor (linewise)";
}
{
__unkeyed-1 = "[p";
__unkeyed-2 = "<Plug>(YankyPutIndentBeforeLinewise)";
desc = "Put indented before cursor (linewise)";
}
{
__unkeyed-1 = "]P";
__unkeyed-2 = "<Plug>(YankyPutIndentAfterLinewise)";
desc = "Put indented after cursor (linewise)";
}
{
__unkeyed-1 = "[P";
__unkeyed-2 = "<Plug>(YankyPutIndentBeforeLinewise)";
desc = "Put indented before cursor (linewise)";
}
{
__unkeyed-1 = ">p";
__unkeyed-2 = "<Plug>(YankyPutIndentAfterShiftRight)";
desc = "Put and indent right";
}
{
__unkeyed-1 = "<p";
__unkeyed-2 = "<Plug>(YankyPutIndentAfterShiftLeft)";
desc = "Put and indent left";
}
{
__unkeyed-1 = ">P";
__unkeyed-2 = "<Plug>(YankyPutIndentBeforeShiftRight)";
desc = "Put before and indent right";
}
{
__unkeyed-1 = "<P";
__unkeyed-2 = "<Plug>(YankyPutIndentBeforeShiftLeft)";
desc = "Put before and indent left";
}
{
__unkeyed-1 = "=p";
__unkeyed-2 = "<Plug>(YankyPutAfterFilter)";
desc = "Put after applying a filter";
}
{
__unkeyed-1 = "=P";
__unkeyed-2 = "<Plug>(YankyPutBeforeFilter)";
desc = "Put before applying a filter";
}
];
};
};
settings = {
ring = {
history_length = 100;
storage = "sqlite";
storage_path.__raw = "vim.fn.stdpath('data') .. '/databases/yanky.db'";
sync_with_numbered_registers = true;
cancel_event = "update";
ignore_registers = [ "_" ];
update_register_on_cycle = false;
};
};
};
};
}

View file

@ -0,0 +1,24 @@
{
colorschemes = {
# tokyonight
tokyonight = {
enable = false;
settings = {
transparent = true;
style = "night"; # options: "storm", "night", "day", "moon"
cmp = true;
illuminate = true;
indentblankline = true;
lsp_semantic = true;
mini_completion = true;
};
};
kanagawa = {
enable = true;
settings = {
transparent = true;
};
};
};
}

View file

@ -0,0 +1,11 @@
{
programs.bash = {
enable = false;
enableCompletion = false;
bashrcExtra = ''
export PATH="$PATH:$HOME/bin"
alias cls=clear
alias nv=nvim
'';
};
}

View file

@ -0,0 +1,7 @@
{
programs.direnv = {
enable = true;
enableNushellIntegration = true;
silent = true;
};
}

View file

@ -0,0 +1,8 @@
# set prompt
fish_config prompt choose informative_vcs
# setup direnv
direnv hook fish | source
# set theme
source ~/.config/fish/themes/kanagawa.fish

View file

@ -0,0 +1,27 @@
{ pkgs, ... }:
{
home.file.".config/fish/themes".source = ./themes;
programs.fish = {
enable = true;
package = pkgs.fishMinimal;
shellInit = builtins.readFile ./config.fish;
shellAliases = {
nv = "nvim";
cls = "clear";
};
functions = {
__fish_command_not_found_handler = {
body = "__fish_default_command_not_found_handler $argv[1]";
onEvent = "fish_command_not_found";
};
fish_greeting = {
body = "";
};
gitignore = "curl -sL https://www.gitignore.io/api/$argv";
};
};
}

View file

@ -0,0 +1,37 @@
#!/usr/bin/fish
# Kanagawa Fish shell theme
# A template was taken and modified from Tokyonight:
# https://github.com/folke/tokyonight.nvim/blob/main/extras/fish_tokyonight_night.fish
set -l foreground DCD7BA normal
set -l selection 2D4F67 brcyan
set -l comment 727169 brblack
set -l red C34043 red
set -l orange FF9E64 brred
set -l yellow C0A36E yellow
set -l green 76946A green
set -l purple 957FB8 magenta
set -l cyan 7AA89F cyan
set -l pink D27E99 brmagenta
# Syntax Highlighting Colors
set -g fish_color_normal $foreground
set -g fish_color_command $cyan
set -g fish_color_keyword $pink
set -g fish_color_quote $yellow
set -g fish_color_redirection $foreground
set -g fish_color_end $orange
set -g fish_color_error $red
set -g fish_color_param $purple
set -g fish_color_comment $comment
set -g fish_color_selection --background=$selection
set -g fish_color_search_match --background=$selection
set -g fish_color_operator $green
set -g fish_color_escape $pink
set -g fish_color_autosuggestion $comment
# Completion Pager Colors
set -g fish_pager_color_progress $comment
set -g fish_pager_color_prefix $cyan
set -g fish_pager_color_completion $foreground
set -g fish_pager_color_description $comment

View file

@ -0,0 +1,103 @@
use std repeat
$env.EDITOR = "nvim"
const config_path = $nu.default-config-dir | path join "config";
const aliases_path = $config_path | path join "aliases";
const completions_path = $config_path | path join "completions";
const hooks_path = $config_path | path join "hooks";
const scripts_path = $config_path | path join "scripts";
const themes_path = $config_path | path join "themes";
# register aliases
source ($aliases_path | path join "git.nu");
# register completions
source ($completions_path | path join "git.nu");
source ($completions_path | path join "make.nu");
# register hooks
source ($hooks_path | path join "did_you_mean.nu")
# register scripts
source ($scripts_path | path join "nufetch.nu")
# register themes
source ($themes_path | path join "tokyo-night.nu")
$env.PATH = ($env.PATH |
append /home/elisiei/bin |
append /home/elisiei/go/bin
)
$env.COLORTERM = "truecolor"
$env.config = {
buffer_editor: "nvim"
edit_mode: "vi"
show_banner: false
}
def create_left_prompt [] {
# path
let folder_name = (
$env.PWD
| str replace $env.HOME "~"
| split row "/"
| each {|it| $it }
| str join "/"
| $in
)
let folder = $"($folder_name)"
let folder_colored = (
$folder | ansi gradient --fgstart '0xA0B6A0' --fgend '0x6C94DC'
)
let path_segment = $"(ansi bo)($folder_colored)(ansi reset)"
# git
let git_segment = (
if (do -i { git rev-parse --is-inside-work-tree } | complete | get exit_code) == 0 {
let branch = (do -i { git branch --show-current } | complete | get stdout | str trim)
let changes = (do -i { git status --porcelain } | complete | get stdout | str trim)
let status = if ($changes | is-empty) { "" } else { $" (ansi bo)(ansi '#FF6E7F')[!]" }
$"(ansi i)on(ansi reset) (ansi bo)(ansi '#FBDBB6') ($branch)(ansi reset)($status)(ansi reset)"
} else {
""
}
)
# nix shell
let nix_segment = (
if ($env | columns | any {|c| $c == "IN_NIX_SHELL" }) and ($env.IN_NIX_SHELL | default "" | str trim | is-not-empty) {
$"(ansi i)via(ansi reset) (ansi bo)(ansi '#A4CCB1')nix(ansi reset)"
} else {
""
}
)
# all
[$path_segment $git_segment $nix_segment]
| where {|x| not ($x | is-empty) }
| str join " "
}
$env.PROMPT_COMMAND = { || create_left_prompt }
$env.PROMPT_COMMAND_RIGHT = { || }
$env.PROMPT_INDICATOR_VI_INSERT = { || ": " }
$env.PROMPT_INDICATOR_VI_NORMAL = { || "! " }
$env.PROMPT_MULTILINE_INDICATOR = { || "::: " }
$env.PROMPT_INDICATOR = { ||
let last_exit_code = $env.LAST_EXIT_CODE
let indicator = if ($last_exit_code == 0) {
$"(ansi cyan)(ansi reset)"
} else {
$"(ansi red)(ansi reset)"
}
$"\n($indicator) "
}

View file

@ -0,0 +1,246 @@
# returns the name of the current branch
export def git_current_branch [] {
^git rev-parse --abbrev-ref HEAD
}
export def git_main_branch [] {
git remote show origin
| lines
| str trim
| find --regex 'HEAD .*?[: ].+'
| first
| ansi strip
| str replace --regex 'HEAD .*?[: ]\s*(.+)' '$1'
}
#
# Aliases
# (sorted alphabetically)
#
export alias ga = git add
export alias gaa = git add --all
export alias gapa = git add --patch
export alias gau = git add --update
export alias gav = git add --verbose
export alias gap = git apply
export alias gapt = git apply --3way
export alias gb = git branch
export alias gba = git branch --all
export alias gbd = git branch --delete
export alias gbD = git branch --delete --force
export alias gbl = git blame -b -w
export alias gbm = git branch --move
export alias gbmc = git branch --move (git_current_branch)
export alias gbnm = git branch --no-merged
export alias gbr = git branch --remote
export alias gbs = git bisect
export alias gbsb = git bisect bad
export alias gbsg = git bisect good
export alias gbsn = git bisect new
export alias gbso = git bisect old
export alias gbsr = git bisect reset
export alias gbss = git bisect start
export alias gc = git commit --verbose
export alias gc! = git commit --verbose --amend
export alias gcn = git commit --verbose --no-edit
export alias gcn! = git commit --verbose --no-edit --amend
export alias gca = git commit --verbose --all
export alias gca! = git commit --verbose --all --amend
export alias gcan! = git commit --verbose --all --no-edit --amend
export alias gcans! = git commit --verbose --all --signoff --no-edit --amend
export def gcam [message: string] {
git commit --all --message $message
}
export def gcsm [message: string] {
git commit --all --signoff $message
}
export alias gcas = git commit --all --signoff
export def gcasm [message: string] {
git commit --all --signoff --message $message
}
export alias gcb = git checkout -b
export alias gcd = git checkout develop
export alias gcf = git config --list
export alias gcl = git clone --recurse-submodules
export alias gclean = git clean --interactive -d
export def gpristine [] {
git reset --hard
git clean -d --force -x
}
export alias gcm = git checkout (git_main_branch)
export def gcmsg [message: string] {
git commit --message $message
}
export alias gco = git checkout
export alias gcor = git checkout --recurse-submodules
export alias gcount = git shortlog --summary --numbered
export alias gcp = git cherry-pick
export alias gcpa = git cherry-pick --abort
export alias gcpc = git cherry-pick --continue
export alias gcs = git commit --gpg-sign
export alias gcss = git commit --gpg-sign --signoff
export def gcssm [message: string] {
git commit --gpg-sign --signoff --message $message
}
export alias gd = git diff
export alias gdca = git diff --cached
export alias gdcw = git diff --cached --word-diff
export alias gdct = git describe --tags (git rev-list --tags --max-count=1)
export alias gds = git diff --staged
export alias gdt = git diff-tree --no-commit-id --name-only -r
export alias gdup = git diff @{upstream}
export alias gdw = git diff --word-diff
export alias gf = git fetch
export alias gfa = git fetch --all --prune
export alias gfo = git fetch origin
export alias gg = git gui citool
export alias gga = git gui citool --amend
export alias ghh = git help
export alias gignore = git update-index --assume-unchanged
export alias gl = git log
export alias glg = git log --stat
export alias glgp = git log --stat --patch
export alias glgg = git log --graph
export alias glgga = git log --graph --decorate --all
export alias glgm = git log --graph --max-count=10
export alias glo = git log --oneline --decorate
export alias glod = git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ad(char rp) %C(char lp)bold blue(char rp)<%an>%Creset'
export alias glods = git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ad(char rp) %C(char lp)bold blue(char rp)<%an>%Creset' --date=short
export alias glog = git log --oneline --decorate --graph
export alias gloga = git log --oneline --decorate --graph --all
export alias glol = git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ar(char rp) %C(char lp)bold blue(char rp)<%an>%Creset'
export alias glola = git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ar(char rp) %C(char lp)bold blue(char rp)<%an>%Creset' --all
export alias glols = git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ar(char rp) %C(char lp)bold blue(char rp)<%an>%Creset' --stat
export alias gm = git merge
export alias gmtl = git mergetool --no-prompt
export alias gmtlvim = git mergetool --no-prompt --tool=vimdiff
export alias gma = git merge --abort
export def gmom [] {
let main = (git_main_branch)
git merge $"origin/($main)"
}
export alias gp = git push
export alias gpd = git push --dry-run
export alias gpf = git push --force-with-lease
export alias gpf! = git push --force
export alias gpl = git pull
export def gpoat [] {
git push origin --all; git push origin --tags
}
export alias gpod = git push origin --delete
export alias gpodc = git push origin --delete (git_current_branch)
def "nu-complete git pull rebase" [] {
["false","true","merges","interactive"]
}
export def gpr [rebase_type: string@"nu-complete git pull rebase"] {
git pull --rebase $rebase_type
}
export alias gpu = git push upstream
export alias gpv = git push --verbose
export alias gr = git remote
export alias gpra = git pull --rebase --autostash
export alias gprav = git pull --rebase --autostash --verbose
export alias gprv = git pull --rebase --verbose
export alias gpsup = git push --set-upstream origin (git_current_branch)
export alias gra = git remote add
export alias grb = git rebase
export alias grba = git rebase --abort
export alias grbc = git rebase --continue
export alias grbd = git rebase develop
export alias grbi = git rebase --interactive
export alias grbm = git rebase (git_main_branch)
export alias grbo = git rebase --onto
export alias grbs = git rebase --skip
export alias grev = git revert
export alias grh = git reset
export alias grhh = git reset --hard
export alias groh = git reset $"origin/(git_current_branch)" --hard
export alias grm = git rm
export alias grmc = git rm --cached
export def grmv [remote: string, new_name: string] {
git remote rename $remote $new_name
}
export def grrm [remote: string] {
git remote remove $remote
}
export alias grs = git restore
export def grset [remote: string, url: string] {
git remote set-url $remote $url
}
export alias grss = git restore --source
export alias grst = git restore --staged
export alias grt = cd (git rev-parse --show-toplevel or echo .)
export alias gru = git reset --
export alias grup = git remote update
export alias grv = git remote --verbose
export alias gsb = git status --short --branch
export alias gsd = git svn dcommit
export alias gsh = git show
export alias gshs = git show -s
export alias gsi = git submodule init
export alias gsps = git show --pretty=short --show-signature
export alias gsr = git svn rebase
export alias gss = git status --short
export alias gst = git status
export alias gsta = git stash push
export alias gstaa = git stash apply
export alias gstc = git stash clear
export alias gstd = git stash drop
export alias gstl = git stash list
export alias gstp = git stash pop
export alias gsts = git stash show --text
export alias gstu = gsta --include-untracked
export alias gstall = git stash --all
export alias gsu = git submodule update
export alias gsw = git switch
export alias gswc = git switch --create
export alias gts = git tag --sign
export def gtv [] {
git tag | lines | sort
}
export alias glum = git pull upstream (git_main_branch)
export alias gunignore = git update-index --no-assume-unchanged
export def gup [rebase_type: string@"nu-complete git pull rebase"] {
git pull --rebase $rebase_type
}
export alias gupv = git pull --rebase --verbose
export alias gupa = git pull --rebase --autostash
export alias gupav = git pull --rebase --autostash --verbose
export alias gwch = git whatchanged -p --abbrev-commit --pretty=medium
export alias gwt = git worktree
export def gwta [path: path, branch?: string] {
if $branch != null {
git worktree add $path $branch
} else {
git worktree add $path
}
}
export alias gwtls = git worktree list
export alias gwtmv = git worktree move
export def gwtm [worktree: string] {
git worktree remove $worktree
}
export alias gam = git am
export alias gamc = git am --continue
export alias gams = git am --skip
export alias gama = git am --abort
export alias gamscp = git am --show-current-patch

View file

@ -0,0 +1,985 @@
# nu-version: 0.102.0
module git-completion-utils {
export const GIT_SKIPABLE_FLAGS = ['-v', '--version', '-h', '--help', '-p', '--paginate', '-P', '--no-pager', '--no-replace-objects', '--bare']
# Helper function to append token if non-empty
def append-non-empty [token: string]: list<string> -> list<string> {
if ($token | is-empty) { $in } else { $in | append $token }
}
# Split a string to list of args, taking quotes into account.
# Code is copied and modified from https://github.com/nushell/nushell/issues/14582#issuecomment-2542596272
export def args-split []: string -> list<string> {
# Define our states
const STATE_NORMAL = 0
const STATE_IN_SINGLE_QUOTE = 1
const STATE_IN_DOUBLE_QUOTE = 2
const STATE_ESCAPE = 3
const WHITESPACES = [" " "\t" "\n" "\r"]
# Initialize variables
mut state = $STATE_NORMAL
mut current_token = ""
mut result: list<string> = []
mut prev_state = $STATE_NORMAL
# Process each character
for char in ($in | split chars) {
if $state == $STATE_ESCAPE {
# Handle escaped character
$current_token = $current_token + $char
$state = $prev_state
} else if $char == '\' {
# Enter escape state
$prev_state = $state
$state = $STATE_ESCAPE
} else if $state == $STATE_NORMAL {
if $char == "'" {
$state = $STATE_IN_SINGLE_QUOTE
} else if $char == '"' {
$state = $STATE_IN_DOUBLE_QUOTE
} else if ($char in $WHITESPACES) {
# Whitespace in normal state means token boundary
$result = $result | append-non-empty $current_token
$current_token = ""
} else {
$current_token = $current_token + $char
}
} else if $state == $STATE_IN_SINGLE_QUOTE {
if $char == "'" {
$state = $STATE_NORMAL
} else {
$current_token = $current_token + $char
}
} else if $state == $STATE_IN_DOUBLE_QUOTE {
if $char == '"' {
$state = $STATE_NORMAL
} else {
$current_token = $current_token + $char
}
}
}
# Handle the last token
$result = $result | append-non-empty $current_token
# Return the result
$result
}
# Get changed files which can be restored by `git checkout --`
export def get-changed-files []: nothing -> list<string> {
^git status -uno --porcelain=2 | lines
| where $it =~ '^1 [.MD]{2}'
| each { split row ' ' -n 9 | last }
}
# Get files which can be retrieved from a branch/commit by `git checkout <tree-ish>`
export def get-checkoutable-files []: nothing -> list<string> {
# Relevant statuses are .M", "MM", "MD", ".D", "UU"
^git status -uno --porcelain=2 | lines
| where $it =~ '^1 ([.MD]{2}|UU)'
| each { split row ' ' -n 9 | last }
}
export def get-all-git-local-refs []: nothing -> list<record<ref: string, obj: string, upstream: string, subject: string>> {
^git for-each-ref --format '%(refname:lstrip=2)%09%(objectname:short)%09%(upstream:remotename)%(upstream:track)%09%(contents:subject)' refs/heads | lines | parse "{ref}\t{obj}\t{upstream}\t{subject}"
}
export def get-all-git-remote-refs []: nothing -> list<record<ref: string, obj: string, subject: string>> {
^git for-each-ref --format '%(refname:lstrip=2)%09%(objectname:short)%09%(contents:subject)' refs/remotes | lines | parse "{ref}\t{obj}\t{subject}"
}
# Get local branches, remote branches which can be passed to `git merge`
export def get-mergable-sources []: nothing -> list<record<value: string, description: string>> {
let local = get-all-git-local-refs | each {|x| {value: $x.ref description: $'Branch, Local, ($x.obj) ($x.subject), (if ($x.upstream | is-not-empty) { $x.upstream } else { "no upstream" } )'} } | insert style 'light_blue'
let remote = get-all-git-remote-refs | each {|x| {value: $x.ref description: $'Branch, Remote, ($x.obj) ($x.subject)'} } | insert style 'blue_italic'
$local | append $remote
}
}
def "nu-complete git available upstream" [] {
^git branch --no-color -a | lines | each { |line| $line | str replace '* ' "" | str trim }
}
def "nu-complete git remotes" [] {
^git remote | lines | each { |line| $line | str trim }
}
def "nu-complete git log" [] {
^git log --pretty=%h | lines | each { |line| $line | str trim }
}
# Yield all existing commits in descending chronological order.
def "nu-complete git commits all" [] {
^git rev-list --all --remotes --pretty=oneline | lines | parse "{value} {description}"
}
# Yield commits of current branch only. This is useful for e.g. cut points in
# `git rebase`.
def "nu-complete git commits current branch" [] {
^git log --pretty="%h %s" | lines | parse "{value} {description}"
}
# Yield local branches like `main`, `feature/typo_fix`
def "nu-complete git local branches" [] {
^git branch --no-color | lines | each { |line| $line | str replace '* ' "" | str replace '+ ' "" | str trim }
}
# Yield remote branches like `origin/main`, `upstream/feature-a`
def "nu-complete git remote branches with prefix" [] {
^git branch --no-color -r | lines | parse -r '^\*?(\s*|\s*\S* -> )(?P<branch>\S*$)' | get branch | uniq
}
# Yield local and remote branch names which can be passed to `git merge`
def "nu-complete git mergable sources" [] {
use git-completion-utils *
let branches = get-mergable-sources
{
options: {
case_sensitive: false,
completion_algorithm: prefix,
sort: false,
},
completions: $branches
}
}
def "nu-complete git switch" [] {
use git-completion-utils *
let branches = get-mergable-sources
{
options: {
case_sensitive: false,
completion_algorithm: prefix,
sort: false,
},
completions: $branches
}
}
def "nu-complete git checkout" [context: string, position?:int] {
use git-completion-utils *
let preceding = $context | str substring ..$position
# See what user typed before, like 'git checkout a-branch a-path'.
# We exclude some flags from previous tokens, to detect if a branch name has been used as the first argument.
# FIXME: This method is still naive, though.
let prev_tokens = $preceding | str trim | args-split | where ($it not-in $GIT_SKIPABLE_FLAGS)
# In these scenarios, we suggest only file paths, not branch:
# - After '--'
# - First arg is a branch
# If before '--' is just 'git checkout' (or its alias), we suggest "dirty" files only (user is about to reset file).
if $prev_tokens.2? == '--' {
return (get-changed-files)
}
if '--' in $prev_tokens {
return (get-checkoutable-files)
}
# Already typed first argument.
if ($prev_tokens | length) > 2 and $preceding ends-with ' ' {
return (get-checkoutable-files)
}
# The first argument can be local branches, remote branches, files and commits
# Get local and remote branches
let branches = get-mergable-sources
let files = (get-checkoutable-files) | wrap value | insert description 'File' | insert style green
let commits = ^git rev-list -n 400 --remotes --oneline | lines | split column -n 2 ' ' value description | upsert description {|x| $'Commit, ($x.value) ($x.description)' } | insert style 'light_cyan_dimmed'
{
options: {
case_sensitive: false,
completion_algorithm: prefix,
sort: false,
},
completions: [...$branches, ...$files, ...$commits]
}
}
# Arguments to `git rebase --onto <arg1> <arg2>`
def "nu-complete git rebase" [] {
(nu-complete git local branches)
| parse "{value}"
| insert description "local branch"
| append (nu-complete git remote branches with prefix
| parse "{value}"
| insert description "remote branch")
| append (nu-complete git commits all)
}
def "nu-complete git stash-list" [] {
git stash list | lines | parse "{value}: {description}"
}
def "nu-complete git tags" [] {
^git tag --no-color | lines
}
# See `man git-status` under "Short Format"
# This is incomplete, but should cover the most common cases.
const short_status_descriptions = {
".D": "Deleted"
".M": "Modified"
"!" : "Ignored"
"?" : "Untracked"
"AU": "Staged, not merged"
"MD": "Some modifications staged, file deleted in work tree"
"MM": "Some modifications staged, some modifications untracked"
"R.": "Renamed"
"UU": "Both modified (in merge conflict)"
}
def "nu-complete git files" [] {
let relevant_statuses = ["?",".M", "MM", "MD", ".D", "UU"]
^git status -uall --porcelain=2
| lines
| each { |$it|
if $it starts-with "1 " {
$it | parse --regex "1 (?P<short_status>\\S+) (?:\\S+\\s?){6} (?P<value>\\S+)"
} else if $it starts-with "2 " {
$it | parse --regex "2 (?P<short_status>\\S+) (?:\\S+\\s?){6} (?P<value>\\S+)"
} else if $it starts-with "u " {
$it | parse --regex "u (?P<short_status>\\S+) (?:\\S+\\s?){8} (?P<value>\\S+)"
} else if $it starts-with "? " {
$it | parse --regex "(?P<short_status>.{1}) (?P<value>.+)"
} else {
{ short_status: 'unknown', value: $it }
}
}
| flatten
| where $it.short_status in $relevant_statuses
| insert "description" { |e| $short_status_descriptions | get $e.short_status}
}
def "nu-complete git built-in-refs" [] {
[HEAD FETCH_HEAD ORIG_HEAD]
}
def "nu-complete git refs" [] {
nu-complete git local branches
| parse "{value}"
| insert description Branch
| append (nu-complete git tags | parse "{value}" | insert description Tag)
| append (nu-complete git built-in-refs)
}
def "nu-complete git files-or-refs" [] {
nu-complete git local branches
| parse "{value}"
| insert description Branch
| append (nu-complete git files | where description == "Modified" | select value)
| append (nu-complete git tags | parse "{value}" | insert description Tag)
| append (nu-complete git built-in-refs)
}
def "nu-complete git subcommands" [] {
^git help -a | lines | where $it starts-with " " | parse -r '\s*(?P<value>[^ ]+) \s*(?P<description>\w.*)'
}
def "nu-complete git add" [] {
nu-complete git files
}
def "nu-complete git pull rebase" [] {
["false","true","merges","interactive"]
}
def "nu-complete git merge strategies" [] {
['ort', 'octopus']
}
def "nu-complete git merge strategy options" [] {
['ours', 'theirs']
}
# Check out git branches and files
export extern "git checkout" [
...targets: string@"nu-complete git checkout" # name of the branch or files to checkout
--conflict: string # conflict style (merge or diff3)
--detach(-d) # detach HEAD at named commit
--force(-f) # force checkout (throw away local modifications)
--guess # second guess 'git checkout <no-such-branch>' (default)
--ignore-other-worktrees # do not check if another worktree is holding the given ref
--ignore-skip-worktree-bits # do not limit pathspecs to sparse entries only
--merge(-m) # perform a 3-way merge with the new branch
--orphan: string # new unparented branch
--ours(-2) # checkout our version for unmerged files
--overlay # use overlay mode (default)
--overwrite-ignore # update ignored files (default)
--patch(-p) # select hunks interactively
--pathspec-from-file: string # read pathspec from file
--progress # force progress reporting
--quiet(-q) # suppress progress reporting
--recurse-submodules # control recursive updating of submodules
--theirs(-3) # checkout their version for unmerged files
--track(-t) # set upstream info for new branch
-b # create and checkout a new branch
-B: string # create/reset and checkout a branch
-l # create reflog for new branch
]
export extern "git reset" [
...targets: string@"nu-complete git checkout" # name of commit, branch, or files to reset to
--hard # reset HEAD, index and working tree
--keep # reset HEAD but keep local changes
--merge # reset HEAD, index and working tree
--mixed # reset HEAD and index
--patch(-p) # select hunks interactively
--quiet(-q) # be quiet, only report errors
--soft # reset only HEAD
--pathspec-from-file: string # read pathspec from file
--pathspec-file-nul # with --pathspec-from-file, pathspec elements are separated with NUL character
--no-refresh # skip refreshing the index after reset
--recurse-submodules: string # control recursive updating of submodules
--no-recurse-submodules # don't recurse into submodules
]
# Download objects and refs from another repository
export extern "git fetch" [
repository?: string@"nu-complete git remotes" # name of the branch to fetch
--all # Fetch all remotes
--append(-a) # Append ref names and object names to .git/FETCH_HEAD
--atomic # Use an atomic transaction to update local refs.
--depth: int # Limit fetching to n commits from the tip
--deepen: int # Limit fetching to n commits from the current shallow boundary
--shallow-since: string # Deepen or shorten the history by date
--shallow-exclude: string # Deepen or shorten the history by branch/tag
--unshallow # Fetch all available history
--update-shallow # Update .git/shallow to accept new refs
--negotiation-tip: string # Specify which commit/glob to report while fetching
--negotiate-only # Do not fetch, only print common ancestors
--dry-run # Show what would be done
--write-fetch-head # Write fetched refs in FETCH_HEAD (default)
--no-write-fetch-head # Do not write FETCH_HEAD
--force(-f) # Always update the local branch
--keep(-k) # Keep downloaded pack
--multiple # Allow several arguments to be specified
--auto-maintenance # Run 'git maintenance run --auto' at the end (default)
--no-auto-maintenance # Don't run 'git maintenance' at the end
--auto-gc # Run 'git maintenance run --auto' at the end (default)
--no-auto-gc # Don't run 'git maintenance' at the end
--write-commit-graph # Write a commit-graph after fetching
--no-write-commit-graph # Don't write a commit-graph after fetching
--prefetch # Place all refs into the refs/prefetch/ namespace
--prune(-p) # Remove obsolete remote-tracking references
--prune-tags(-P) # Remove any local tags that do not exist on the remote
--no-tags(-n) # Disable automatic tag following
--refmap: string # Use this refspec to map the refs to remote-tracking branches
--tags(-t) # Fetch all tags
--recurse-submodules: string # Fetch new commits of populated submodules (yes/on-demand/no)
--jobs(-j): int # Number of parallel children
--no-recurse-submodules # Disable recursive fetching of submodules
--set-upstream # Add upstream (tracking) reference
--submodule-prefix: string # Prepend to paths printed in informative messages
--upload-pack: string # Non-default path for remote command
--quiet(-q) # Silence internally used git commands
--verbose(-v) # Be verbose
--progress # Report progress on stderr
--server-option(-o): string # Pass options for the server to handle
--show-forced-updates # Check if a branch is force-updated
--no-show-forced-updates # Don't check if a branch is force-updated
-4 # Use IPv4 addresses, ignore IPv6 addresses
-6 # Use IPv6 addresses, ignore IPv4 addresses
]
# Push changes
export extern "git push" [
remote?: string@"nu-complete git remotes", # the name of the remote
...refs: string@"nu-complete git local branches" # the branch / refspec
--all # push all refs
--atomic # request atomic transaction on remote side
--delete(-d) # delete refs
--dry-run(-n) # dry run
--exec: string # receive pack program
--follow-tags # push missing but relevant tags
--force-with-lease # require old value of ref to be at this value
--force(-f) # force updates
--ipv4(-4) # use IPv4 addresses only
--ipv6(-6) # use IPv6 addresses only
--mirror # mirror all refs
--no-verify # bypass pre-push hook
--porcelain # machine-readable output
--progress # force progress reporting
--prune # prune locally removed refs
--push-option(-o): string # option to transmit
--quiet(-q) # be more quiet
--receive-pack: string # receive pack program
--recurse-submodules: string # control recursive pushing of submodules
--repo: string # repository
--set-upstream(-u) # set upstream for git pull/status
--signed: string # GPG sign the push
--tags # push tags (can't be used with --all or --mirror)
--thin # use thin pack
--verbose(-v) # be more verbose
]
# Pull changes
export extern "git pull" [
remote?: string@"nu-complete git remotes", # the name of the remote
...refs: string@"nu-complete git local branches", # the branch / refspec
--rebase(-r): string@"nu-complete git pull rebase", # rebase current branch on top of upstream after fetching
--quiet(-q) # suppress output during transfer and merge
--verbose(-v) # be more verbose
--commit # perform the merge and commit the result
--no-commit # perform the merge but do not commit the result
--edit(-e) # edit the merge commit message
--no-edit # use the auto-generated merge commit message
--cleanup: string # specify how to clean up the merge commit message
--ff # fast-forward if possible
--no-ff # create a merge commit in all cases
--gpg-sign(-S) # GPG-sign the resulting merge commit
--no-gpg-sign # do not GPG-sign the resulting merge commit
--log: int # include log messages from merged commits
--no-log # do not include log messages from merged commits
--signoff # add Signed-off-by trailer
--no-signoff # do not add Signed-off-by trailer
--stat(-n) # show a diffstat at the end of the merge
--no-stat # do not show a diffstat at the end of the merge
--squash # produce working tree and index state as if a merge happened
--no-squash # perform the merge and commit the result
--verify # run pre-merge and commit-msg hooks
--no-verify # do not run pre-merge and commit-msg hooks
--strategy(-s): string # use the given merge strategy
--strategy-option(-X): string # pass merge strategy-specific option
--verify-signatures # verify the tip commit of the side branch being merged
--no-verify-signatures # do not verify the tip commit of the side branch being merged
--summary # show a summary of the merge
--no-summary # do not show a summary of the merge
--autostash # create a temporary stash entry before the operation
--no-autostash # do not create a temporary stash entry before the operation
--allow-unrelated-histories # allow merging histories without a common ancestor
--no-rebase # do not rebase the current branch on top of the upstream branch
--all # fetch all remotes
--append(-a) # append fetched refs to existing contents of FETCH_HEAD
--atomic # use an atomic transaction to update local refs
--depth: int # limit fetching to the specified number of commits
--deepen: int # deepen the history by the specified number of commits
--shallow-since: string # deepen or shorten the history since a specified date
--shallow-exclude: string # exclude commits reachable from a specified branch or tag
--unshallow # convert a shallow repository to a complete one
--update-shallow # update .git/shallow with new refs
--tags(-t) # fetch all tags from the remote
--jobs(-j): int # number of parallel children for fetching
--set-upstream # add upstream (tracking) reference
--upload-pack: string # specify non-default path for upload-pack on the remote
--progress # force progress status even if stderr is not a terminal
--server-option(-o): string # transmit the given string to the server
]
# Switch between branches and commits
export extern "git switch" [
switch?: string@"nu-complete git switch" # name of branch to switch to
--create(-c) # create a new branch
--detach(-d): string@"nu-complete git log" # switch to a commit in a detached state
--force-create(-C): string # forces creation of new branch, if it exists then the existing branch will be reset to starting point
--force(-f) # alias for --discard-changes
--guess # if there is no local branch which matches then name but there is a remote one then this is checked out
--ignore-other-worktrees # switch even if the ref is held by another worktree
--merge(-m) # attempts to merge changes when switching branches if there are local changes
--no-guess # do not attempt to match remote branch names
--no-progress # do not report progress
--no-recurse-submodules # do not update the contents of sub-modules
--no-track # do not set "upstream" configuration
--orphan: string # create a new orphaned branch
--progress # report progress status
--quiet(-q) # suppress feedback messages
--recurse-submodules # update the contents of sub-modules
--track(-t) # set "upstream" configuration
]
# Apply the change introduced by an existing commit
export extern "git cherry-pick" [
commit?: string@"nu-complete git commits all" # The commit ID to be cherry-picked
--edit(-e) # Edit the commit message prior to committing
--no-commit(-n) # Apply changes without making any commit
--signoff(-s) # Add Signed-off-by line to the commit message
--ff # Fast-forward if possible
--continue # Continue the operation in progress
--abort # Cancel the operation
--skip # Skip the current commit and continue with the rest of the sequence
]
# Rebase the current branch
export extern "git rebase" [
branch?: string@"nu-complete git rebase" # name of the branch to rebase onto
upstream?: string@"nu-complete git rebase" # upstream branch to compare against
--continue # restart rebasing process after editing/resolving a conflict
--abort # abort rebase and reset HEAD to original branch
--quit # abort rebase but do not reset HEAD
--interactive(-i) # rebase interactively with list of commits in editor
--onto?: string@"nu-complete git rebase" # starting point at which to create the new commits
--root # start rebase from root commit
]
# Merge from a branch
export extern "git merge" [
# For now, to make it simple, we only complete branches (not commits) and support single-parent case.
branch?: string@"nu-complete git mergable sources" # The source branch
--edit(-e) # Edit the commit message prior to committing
--no-edit # Do not edit commit message
--no-commit(-n) # Apply changes without making any commit
--signoff # Add Signed-off-by line to the commit message
--ff # Fast-forward if possible
--continue # Continue after resolving a conflict
--abort # Abort resolving conflict and go back to original state
--quit # Forget about the current merge in progress
--strategy(-s): string@"nu-complete git merge strategies" # Merge strategy
-X: string@"nu-complete git merge strategy options" # Option for merge strategy
--verbose(-v)
--help
]
# List or change branches
export extern "git branch" [
branch?: string@"nu-complete git local branches" # name of branch to operate on
--abbrev # use short commit hash prefixes
--edit-description # open editor to edit branch description
--merged # list reachable branches
--no-merged # list unreachable branches
--set-upstream-to: string@"nu-complete git available upstream" # set upstream for branch
--unset-upstream # remote upstream for branch
--all # list both remote and local branches
--copy # copy branch together with config and reflog
--format # specify format for listing branches
--move # rename branch
--points-at # list branches that point at an object
--show-current # print the name of the current branch
--verbose # show commit and upstream for each branch
--color # use color in output
--quiet # suppress messages except errors
--delete(-d) # delete branch
--list # list branches
--contains: string@"nu-complete git commits all" # show only branches that contain the specified commit
--no-contains # show only branches that don't contain specified commit
--track(-t) # when creating a branch, set upstream
]
# List all variables set in config file, along with their values.
export extern "git config list" [
]
# Emits the value of the specified key.
export extern "git config get" [
]
# Set value for one or more config options.
export extern "git config set" [
]
# Unset value for one or more config options.
export extern "git config unset" [
]
# Rename the given section to a new name.
export extern "git config rename-section" [
]
# Remove the given section from the configuration file.
export extern "git config remove-section" [
]
# Opens an editor to modify the specified config file
export extern "git config edit" [
]
# List or change tracked repositories
export extern "git remote" [
--verbose(-v) # Show URL for remotes
]
# Add a new tracked repository
export extern "git remote add" [
]
# Rename a tracked repository
export extern "git remote rename" [
remote: string@"nu-complete git remotes" # remote to rename
new_name: string # new name for remote
]
# Remove a tracked repository
export extern "git remote remove" [
remote: string@"nu-complete git remotes" # remote to remove
]
# Get the URL for a tracked repository
export extern "git remote get-url" [
remote: string@"nu-complete git remotes" # remote to get URL for
]
# Set the URL for a tracked repository
export extern "git remote set-url" [
remote: string@"nu-complete git remotes" # remote to set URL for
url: string # new URL for remote
]
# Show changes between commits, working tree etc
export extern "git diff" [
rev1_or_file?: string@"nu-complete git files-or-refs"
rev2?: string@"nu-complete git refs"
--cached # show staged changes
--name-only # only show names of changed files
--name-status # show changed files and kind of change
--no-color # disable color output
]
# Commit changes
export extern "git commit" [
--all(-a) # automatically stage all modified and deleted files
--amend # amend the previous commit rather than adding a new one
--message(-m): string # specify the commit message rather than opening an editor
--reuse-message(-C): string # reuse the message from a previous commit
--reedit-message(-c): string # reuse and edit message from a commit
--fixup: string # create a fixup/amend commit
--squash: string # squash commit for autosquash rebase
--reset-author # reset author information
--short # short-format output for dry-run
--branch # show branch info in short-format
--porcelain # porcelain-ready format for dry-run
--long # long-format output for dry-run
--null(-z) # use NUL instead of LF in output
--file(-F): string # read commit message from file
--author: string # override commit author
--date: string # override author date
--template(-t): string # use commit message template file
--signoff(-s) # add Signed-off-by trailer
--no-signoff # do not add Signed-off-by trailer
--trailer: string # add trailer to commit message
--no-verify(-n) # bypass pre-commit and commit-msg hooks
--verify # do not bypass pre-commit and commit-msg hooks
--allow-empty # allow commit with no changes
--allow-empty-message # allow commit with empty message
--cleanup: string # cleanup commit message
--edit(-e) # edit commit message
--no-edit # do not edit commit message
--include(-i) # include given paths in commit
--only(-o) # commit only specified paths
--pathspec-from-file: string # read pathspec from file
--pathspec-file-nul # use NUL character for pathspec file
--untracked-files(-u): string # show untracked files
--verbose(-v) # show diff in commit message template
--quiet(-q) # suppress commit summary
--dry-run # show paths to be committed without committing
--status # include git-status output in commit message
--no-status # do not include git-status output
--gpg-sign(-S) # GPG-sign commit
--no-gpg-sign # do not GPG-sign commit
...pathspec: string # commit files matching pathspec
]
# List commits
export extern "git log" [
# Ideally we'd allow completion of revisions here, but that would make completion of filenames not work.
-U # show diffs
--follow # show history beyond renames (single file only)
--grep: string # show log entries matching supplied regular expression
]
# Show or change the reflog
export extern "git reflog" [
]
# Stage files
export extern "git add" [
...file: string@"nu-complete git add" # file to add
--all(-A) # add all files
--dry-run(-n) # don't actually add the file(s), just show if they exist and/or will be ignored
--edit(-e) # open the diff vs. the index in an editor and let the user edit it
--force(-f) # allow adding otherwise ignored files
--interactive(-i) # add modified contents in the working tree interactively to the index
--patch(-p) # interactively choose hunks to stage
--verbose(-v) # be verbose
]
# Delete file from the working tree and the index
export extern "git rm" [
-r # recursive
--force(-f) # override the up-to-date check
--dry-run(-n) # Don't actually remove any file(s)
--cached # unstage and remove paths only from the index
]
# Show the working tree status
export extern "git status" [
--verbose(-v) # be verbose
--short(-s) # show status concisely
--branch(-b) # show branch information
--show-stash # show stash information
]
# Stash changes for later
export extern "git stash push" [
--patch(-p) # interactively choose hunks to stash
]
# Unstash previously stashed changes
export extern "git stash pop" [
stash?: string@"nu-complete git stash-list" # stash to pop
--index(-i) # try to reinstate not only the working tree's changes, but also the index's ones
]
# List stashed changes
export extern "git stash list" [
]
# Show a stashed change
export extern "git stash show" [
stash?: string@"nu-complete git stash-list"
-U # show diff
]
# Drop a stashed change
export extern "git stash drop" [
stash?: string@"nu-complete git stash-list"
]
# Create a new git repository
export extern "git init" [
--initial-branch(-b): string # initial branch name
]
# List or manipulate tags
export extern "git tag" [
--delete(-d): string@"nu-complete git tags" # delete a tag
]
# Prune all unreachable objects
export extern "git prune" [
--dry-run(-n) # dry run
--expire: string # expire objects older than
--progress # show progress
--verbose(-v) # report all removed objects
]
# Start a binary search to find the commit that introduced a bug
export extern "git bisect start" [
bad?: string # a commit that has the bug
good?: string # a commit that doesn't have the bug
]
# Mark the current (or specified) revision as bad
export extern "git bisect bad" [
]
# Mark the current (or specified) revision as good
export extern "git bisect good" [
]
# Skip the current (or specified) revision
export extern "git bisect skip" [
]
# End bisection
export extern "git bisect reset" [
]
# Show help for a git subcommand
export extern "git help" [
command?: string@"nu-complete git subcommands" # subcommand to show help for
]
# git worktree
export extern "git worktree" [
--help(-h) # display the help message for this command
...args
]
# create a new working tree
export extern "git worktree add" [
path: path # directory to clone the branch
branch: string@"nu-complete git available upstream" # Branch to clone
--help(-h) # display the help message for this command
--force(-f) # checkout <branch> even if already checked out in other worktree
-b # create a new branch
-B # create or reset a branch
--detach(-d) # detach HEAD at named commit
--checkout # populate the new working tree
--lock # keep the new working tree locked
--reason # reason for locking
--quiet(-q) # suppress progress reporting
--track # set up tracking mode (see git-branch(1))
--guess-remote # try to match the new branch name with a remote-tracking branch
...args
]
# list details of each worktree
export extern "git worktree list" [
--help(-h) # display the help message for this command
--porcelain # machine-readable output
--verbose(-v) # show extended annotations and reasons, if available
--expire # add 'prunable' annotation to worktrees older than <time>
-z # terminate records with a NUL character
...args
]
def "nu-complete worktree list" [] {
^git worktree list | to text | parse --regex '(?P<value>\S+)\s+(?P<commit>\w+)\s+(?P<description>\S.*)'
}
# prevent a working tree from being pruned
export extern "git worktree lock" [
worktree: string@"nu-complete worktree list"
--reason: string # reason because the tree is locked
--help(-h) # display the help message for this command
--reason # reason for locking
...args
]
# move a working tree to a new location
export extern "git worktree move" [
--help(-h) # display the help message for this command
--force(-f) # force move even if worktree is dirty or locked
...args
]
# prune working tree information
export extern "git worktree prune" [
--help(-h) # display the help message for this command
--dry-run(-n) # do not remove, show only
--verbose(-v) # report pruned working trees
--expire # expire working trees older than <time>
...args
]
# remove a working tree
export extern "git worktree remove" [
worktree: string@"nu-complete worktree list"
--help(-h) # display the help message for this command
--force(-f) # force removal even if worktree is dirty or locked
]
# allow working tree to be pruned, moved or deleted
export extern "git worktree unlock" [
worktree: string@"nu-complete worktree list"
...args
]
# clones a repo
export extern "git clone" [
--help(-h) # display the help message for this command
--local(-l) # cloning from the local machine
--no-local # use the git transport mechanism even if cloning from a local path
--no-hardlinks # force git to copy files when cloning from the local machine
--shared(-s) # setup .git/objects/info/alternates to share objects with the source local repo
--reference: string # setup .git/objects/info/alternates to share objects with the =<reference> local repo
--reference-if-able: string # same as --reference, but skips empty folders
--dissociate # borrow objects from the referenced repo (--reference)
--quiet(-q) # suppress progress reporting
--verbose(-v) # be verbose
--progress # report progress unless --quiet
--server-option: string # transmit the =<option> to the server
--no-checkout(-n) # no checkout of HEAD
--reject-shallow # reject shallow repository as source
--no-reject-shallow # do not reject shallow repository as source
--bare # make a bare git repo
--sparse # initialize the sparse-checkout file
--filter: string # partial clone using the given =<filter-spec>
--mirror # mirror the source repo
--origin(-o): string # use <name> as the name for the remote origin
--branch(-b): string # point HEAD to <name> branch
--upload-pack(-u): string # use <upload-pack> as the path in the other end when using ssh
--template: string # use <template-dir> as the templates directory
--config(-c): string # set a <key>=<value> config variable
--depth: int # shallow clone <depth> commits
--shallow-since: string # shallow clone commits newer than =<date>
--shallow-exclude: string # do not clone commits reachable from <revision> (branch or tag)
--single-branch # clone commit history from a single branch
--no-single-Branch # do not clone only one branch
--no-tags # do not clone any tags
--recurse-submodules # clone the submodules. Also accepts paths
--shallow-submodules # shallow clone submodules with depth 1
--no-shallow-submodules # do not shallow clone submodules
--remote-submodules # submodules are updating using their remote tracking branch
--no-remote-submodules # do not track submodules remote
--separate-git-dir: string # place the clone at =<git dir> and link it here
--jobs(-j): int # number of simultaneous submodules fetch
...args
]
# Restores files in working tree or index to previous versions
export extern "git restore" [
--help(-h) # Display the help message for this command
--source(-s) # Restore the working tree files with the content from the given tree
--patch(-p) # Interactively choose hunks to restore
--worktree(-W) # Restore working tree (default if neither --worktree or --staged is used)
--staged(-S) # Restore index
--quiet(-q) # Quiet, suppress feedback messages
--progress # Force progress reporting
--no-progress # Suppress progress reporting
--ours # Restore from index using our version for unmerged files
--theirs # Restore from index using their version for unmerged files
--merge(-m) # Restore from index and recreate the conflicted merge in unmerged files
--conflict: string # Like --merge but changes the conflict presentation with =<style>
--ignore-unmerged # Restore from index and ignore unmerged entries (unmerged files are left as is)
--ignore-skip-worktree-bits # Ignore sparse checkout patterns and unconditionally restores any files in <pathspec>
--recurse-submodules # Restore the contents of sub-modules in working tree
--no-recurse-submodules # Do not restore the contents of sub-modules in working tree (default)
--overlay # Do not remove files that don't exist when restoring from tree with --source
--no-overlay # Remove files that don't exist when restoring from tree with --source (default)
--pathspec-from-file: string # Read pathspec from file
--pathspec-file-nul # Separate pathspec elements with NUL character when reading from file
...pathspecs: string@"nu-complete git files" # Target pathspecs to restore
]
# Print lines matching a pattern
export extern "git grep" [
--help(-h) # Display the help message for this command
--cached # Search blobs registered in the index file instead of worktree
--untracked # Include untracked files in search
--no-index # Similar to `grep -r`, but with additional benefits, such as using pathspec patterns to limit paths; Cannot be used together with --cached or --untracked
--no-exclude-standard # Include ignored files in search (only useful with --untracked)
--exclude-standard # No not include ignored files in search (only useful with --no-index)
--recurse-submodules # Recursively search in each submodule that is active and checked out
--text(-a) # Process binary files as if they were text
--textconv # Honor textconv filter settings
--no-textconv # Do not honor textconv filter settings (default)
--ignore-case(-i) # Ignore case differences between patterns and files
-I # Dont match the pattern in binary files
--max-depth: int # Max <depth> to descend down directories for each pathspec. A value of -1 means no limit.
--recursive(-r) # Same as --max-depth=-1
--no-recursive # Same as --max-depth=0
--word-regexp(-w) # Match the pattern only at word boundary
--invert-match(-v) # Select non-matching lines
-H # Suppress filename in output of matched lines
--full-name # Force relative path to filename from top directory
--extended-regexp(-E) # Use POSIX extended regexp for patterns
--basic-regexp(-G) # Use POSIX basic regexp for patterns (default)
--perl-regexp(-P) # Use Perl-compatible regular expressions for patterns
--line-number(-n) # Prefix the line number to matching lines
--column # Prefix the 1-indexed byte-offset of the first match from the start of the matching line
--files-with-matches(-l) # Print filenames of files that contains matches
--name-only # Same as --files-with-matches
--files-without-match(-L) # Print filenames of files that do not contain matches
--null(-z) # Use \0 as the delimiter for pathnames in the output, and print them verbatim
--only-matching(-o) # Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line
--count(-c) # Instead of showing every matched line, show the number of lines that match
--no-color # Same as --color=never
--break # Print an empty line between matches from different files.
--heading # Show the filename above the matches in that file instead of at the start of each shown line.
--show-function(-p) # Show the preceding line that contains the function name of the match, unless the matching line is a function name itself.
--context(-C): int # Show <num> leading and trailing lines, and place a line containing -- between contiguous groups of matches.
--after-context(-A): int # Show <num> trailing lines, and place a line containing -- between contiguous groups of matches.
--before-context(-B): int # Show <num> leading lines, and place a line containing -- between contiguous groups of matches.
--function-context(-W) # Show the surrounding text from the previous line containing a function name up to the one before the next function name
--max-count(-m): int # Limit the amount of matches per file. When using the -v or --invert-match option, the search stops after the specified number of non-matches.
--threads: int # Number of grep worker threads to use. Use --help for more information on grep threads.
-f: string # Read patterns from <file>, one per line.
-e: string # Next parameter is the pattern. Multiple patterns are combined by --or.
--and # Search for lines that match multiple patterns.
--or # Search for lines that match at least one of multiple patterns. --or is implied between patterns without --and or --not.
--not # Search for lines that does not match pattern.
--all-match # When giving multiple pattern expressions combined with --or, this flag is specified to limit the match to files that have lines to match all of them.
--quiet(-q) # Do not output matched lines; instead, exit with status 0 when there is a match and with non-zero status when there isnt.
...pathspecs: string # Target pathspecs to limit the scope of the search.
]
export extern "git" [
command?: string@"nu-complete git subcommands" # Subcommands
--version(-v) # Prints the Git suite version that the git program came from
--help(-h) # Prints the synopsis and a list of the most commonly used commands
--html-path # Print the path, without trailing slash, where Gits HTML documentation is installed and exit
--man-path # Print the manpath (see man(1)) for the man pages for this version of Git and exit
--info-path # Print the path where the Info files documenting this version of Git are installed and exit
--paginate(-p) # Pipe all output into less (or if set, $env.PAGER) if standard output is a terminal
--no-pager(-P) # Do not pipe Git output into a pager
--no-replace-objects # Do not use replacement refs to replace Git objects
--bare # Treat the repository as a bare repository
]

View file

@ -0,0 +1,64 @@
def "nu-complete make" [] {
ls
| find --ignore-case makefile
| open $in.0.name
| lines
| find --regex '^[\w\.-]+\s*:'
| where ($it | str starts-with '.') == false
| split column ':' target
| get target
| str trim
}
def "nu-complete make jobs" [] {
seq 1 (sys cpu | length)
}
def "nu-complete make files" [] {
ls **/* | where type == file | get name
}
def "nu-complete make dirs" [] {
ls **/* | where type == dir | get name
}
export extern "make" [
command?: string@"nu-complete make"
--always-make(-B) # Unconditionally make all targets.
--directory(-C): string@"nu-complete make dirs" # Change to DIRECTORY before doing anything.
--debug(-d) # Print various types of debugging information.
--environment-overrides(-e) # Environment variables override makefiles.
--eval(-E): string # Evaluate STRING as a makefile statement.
--file(-f) # Read FILE as a makefile.
--help(-h) # Print this message and exit.
--ignore-errors(-i) # Ignore errors from recipes.
--include-dir(-I): string@"nu-complete make dirs" # Search DIRECTORY for included makefiles.
--jobs(-j): int@"nu-complete make jobs" # Allow N jobs at once; infinite jobs with no arg.
--keep-going(-k) # Keep going when some targets can't be made.
--load-average(-l): int@"nu-complete make jobs" # Don't start multiple jobs unless load is below N.
--check-symlink-times(-L) # Use the latest mtime between symlinks and target.
--just-print(-n) # Don't actually run any recipe; just print them.
--dry-run
--recon
--assume-old: string@"nu-complete make files" # Consider FILE to be very old and don't remake it.
--old-file(-o): string@"nu-complete make files"
--output-sync(-O) # Synchronize output of parallel jobs by TYPE.
--print-data-base(-p) # Print make's internal database.
--question(-q) # Run no recipe; exit status says if up to date.
--no-builtin-rules(-r) # Disable the built-in implicit rules.
--no-builtin-variables(-R) # Disable the built-in variable settings.
--silent(-s) # Don't echo recipes.
--quiet
--no-silent # Echo recipes (disable --silent mode).
--stop(-S) # Turns off -k.
--no-keep-going
--touch(-t) # Touch targets instead of remaking them.
--trace # Print tracing information.
--version(-v) # Print the version number of make and exit.
--print-directory(-w) # Print the current directory.
--no-print-directory # Turn off -w, even if it was turned on implicitly.
--what-if(-W): string@"nu-complete make files" # Consider FILE to be infinitely new.
--new-file: string@"nu-complete make files"
--assume-new: string@"nu-complete make files"
--warn-undefined-variables # Warn when an undefined variable is referenced.
]

View file

@ -0,0 +1,48 @@
# example:
# ```nu
# > got
# Error: nu::shell::external_command
#
# × External command failed
# ╭─[entry #1:1:1]
# 1 │ got
# · ─┬─
# · ╰── did you mean 'get'?
# ╰────
# help: No such file or directory (os error 2)
#
# did you mean?
# dot
# git
# go
# ```
{|cmd|
let commands_in_path = (
$env.PATH | each {|directory|
if ($directory | path exists) {
ls $directory | get name | path parse | update parent "" | path join
}
}
| flatten
| wrap cmd
)
let closest_commands = (
$commands_in_path
| insert distance {|it|
$it.cmd | str distance $cmd
}
| uniq
| sort-by distance
| get cmd
| first 3
)
let pretty_commands = (
$closest_commands | each {|cmd|
$" (ansi {fg: "default" attr: "di"})($cmd)(ansi reset)"
}
)
$"\ndid you mean?\n($pretty_commands | str join "\n")"
}

View file

@ -0,0 +1,120 @@
let pri = ansi --escape '38;2;82;119;195m'
let sec = ansi --escape '38;2;127;183;255m'
let pri_bg = ansi --escape '48;2;82;119;195m'
let sec_bg = ansi --escape '48;2;127;183;255m'
let reset = ansi reset
let arts = [
{
name: "NixOS",
art: $"
██ ███ ██
███ ██████
███ ██████
████████████████ 
█████████████████ ██
███ ██████
███ █████
█████████ ████████
████████ █████████
█████ ███
██████ ███
██ █████████████████
 ████████████████
██████ ███
██████ ███
██ ███ ██
"
}
]
def get_art [--fake: string] {
if ($fake | is-not-empty) {
return ($arts | where name == $fake | first | get art)
}
let host = sys host
let target = $arts | where name == $host.name | first
if ($target | is-empty) {
return ""
} else {
let ar = $target | get art
return ($ar | ansi gradient --fgstart '0x47CBFF' --fgend '0x4797FF')
}
}
def get_pc_model [] {
if ($nu.os-info.name == "windows") {
let info = wmic computersystem get model /format:csv | from csv | first
return $info.Model
} else if ($nu.os-info.name == "linux") {
return (cat /sys/class/dmi/id/product_name)
}
}
def get_shell [] {
$env.SHELL | path split | last
}
def get_local_ip [] {
ip -j route | from json | default gateway ""| default metric "" | first | get prefsrc
}
def calculate_packages [] {
# TODO
let nix_packages = ls /run/current-system/sw/bin | length
return {
nix: $nix_packages,
}
}
def print_dots [] {
let colors = {
blue: "34m",
cyan: "36m",
green: "32m",
yellow: "33m",
red: "31m",
magenta: "35m",
}
let dots = $colors | values | each {|k| $'(ansi --escape $k) '}
return $"($dots | str join ' ') (ansi --escape '0m')"
}
def get_gpus [] {
lspci | where description =~ "VGA" | each {|x| $'($x.description)'}
}
def nufetch [ --fake: string -l ] {
if ($l) {
return $arts
}
let art = get_art --fake $fake
let hostinfo = sys host
let pkgs = calculate_packages | transpose name count | each {|x| $"($x.name) - ($x.count)"} | str join ", "
let cpus = sys cpu | get brand | uniq
let disks = sys disks | each {$"(ansi yellow)Диск \(($in.mount)\)(ansi white): ($in.total) / ($in.free) \(((((($in.total - $in.free) / $in.total) * 100) | math floor))%\)"}
let information = [
$"(ansi blue)(whoami)(ansi white)@(ansi blue)($hostinfo.hostname)(ansi white)",
"-------------------------------------",
$"(ansi yellow)ОC(ansi white): ($hostinfo.long_os_version) ($hostinfo.kernel_version)",
$"(ansi yellow)Модель(ansi white): (get_pc_model)",
$"(ansi yellow)Ядро(ansi white): ($hostinfo.long_os_version)",
$"(ansi yellow)Время(ansi white): ($hostinfo.uptime)",
$"(ansi yellow)Oболочка(ansi white): (get_shell)",
$"(ansi yellow)Пакеты(ansi white): ($pkgs)",
$"(ansi yellow)Процессоры(ansi white): ($cpus | str join ', ')",
$"(ansi yellow)Память(ansi white): ((sys mem | $'($in.total) / (ansi red)($in.used)(ansi white) / (ansi green)($in.free)(ansi white)'))",
...$disks,
$"(ansi yellow)Локальный IP(ansi white): (get_local_ip)",
$"(ansi yellow)Цвета(ansi white): (print_dots)",
]
print ([[Арт, Информация]; [$art ($information | str join "\n")]] | table -i false)
}

View file

@ -0,0 +1,133 @@
# TokyoNight Storm for Nushell
# Retrieve the theme settings
export def main [] {
return {
binary: '#bb9af7'
block: '#7aa2f7'
cell-path: '#a9b1d6'
closure: '#7dcfff'
custom: '#c0caf5'
duration: '#e0af68'
float: '#f7768e'
glob: '#c0caf5'
int: '#bb9af7'
list: '#7dcfff'
nothing: '#f7768e'
range: '#e0af68'
record: '#7dcfff'
string: '#9ece6a'
bool: {|| if $in { '#7dcfff' } else { '#e0af68' } }
datetime: {|| (date now) - $in |
if $in < 1hr {
{ fg: '#f7768e' attr: 'b' }
} else if $in < 6hr {
'#f7768e'
} else if $in < 1day {
'#e0af68'
} else if $in < 3day {
'#9ece6a'
} else if $in < 1wk {
{ fg: '#9ece6a' attr: 'b' }
} else if $in < 6wk {
'#7dcfff'
} else if $in < 52wk {
'#7aa2f7'
} else { 'dark_gray' }
}
filesize: {|e|
if $e == 0b {
'#a9b1d6'
} else if $e < 1mb {
'#7dcfff'
} else {{ fg: '#7aa2f7' }}
}
shape_and: { fg: '#bb9af7' attr: 'b' }
shape_binary: { fg: '#bb9af7' attr: 'b' }
shape_block: { fg: '#7aa2f7' attr: 'b' }
shape_bool: '#7dcfff'
shape_closure: { fg: '#7dcfff' attr: 'b' }
shape_custom: '#9ece6a'
shape_datetime: { fg: '#7dcfff' attr: 'b' }
shape_directory: '#7dcfff'
shape_external: '#7dcfff'
shape_external_resolved: '#7dcfff'
shape_externalarg: { fg: '#9ece6a' attr: 'b' }
shape_filepath: '#7dcfff'
shape_flag: { fg: '#7aa2f7' attr: 'b' }
shape_float: { fg: '#f7768e' attr: 'b' }
shape_garbage: { fg: '#FFFFFF' bg: '#FF0000' attr: 'b' }
shape_glob_interpolation: { fg: '#7dcfff' attr: 'b' }
shape_globpattern: { fg: '#7dcfff' attr: 'b' }
shape_int: { fg: '#bb9af7' attr: 'b' }
shape_internalcall: { fg: '#7dcfff' attr: 'b' }
shape_keyword: { fg: '#bb9af7' attr: 'b' }
shape_list: { fg: '#7dcfff' attr: 'b' }
shape_literal: '#7aa2f7'
shape_match_pattern: '#9ece6a'
shape_matching_brackets: { attr: 'u' }
shape_nothing: '#f7768e'
shape_operator: '#e0af68'
shape_or: { fg: '#bb9af7' attr: 'b' }
shape_pipe: { fg: '#bb9af7' attr: 'b' }
shape_range: { fg: '#e0af68' attr: 'b' }
shape_raw_string: { fg: '#c0caf5' attr: 'b' }
shape_record: { fg: '#7dcfff' attr: 'b' }
shape_redirection: { fg: '#bb9af7' attr: 'b' }
shape_signature: { fg: '#9ece6a' attr: 'b' }
shape_string: '#9ece6a'
shape_string_interpolation: { fg: '#7dcfff' attr: 'b' }
shape_table: { fg: '#7aa2f7' attr: 'b' }
shape_vardecl: { fg: '#7aa2f7' attr: 'u' }
shape_variable: '#bb9af7'
# Base foot.ini colors
foreground: '#c0caf5'
background: '#1a1b26'
cursor: '#c0caf5'
empty: '#7aa2f7'
header: { fg: '#9ece6a' attr: 'b' }
hints: '#414868'
leading_trailing_space_bg: { attr: 'n' }
row_index: { fg: '#9ece6a' attr: 'b' }
search_result: { fg: '#f7768e' bg: '#a9b1d6' }
separator: '#a9b1d6'
}
}
# Update the Nushell configuration
export def --env "set color_config" [] {
$env.config.color_config = (main)
}
# Update terminal colors
export def "update terminal" [] {
let theme = (main)
# Set terminal colors
let osc_screen_foreground_color = '10;'
let osc_screen_background_color = '11;'
let osc_cursor_color = '12;'
$"
(ansi -o $osc_screen_foreground_color)($theme.foreground)(char bel)
(ansi -o $osc_screen_background_color)($theme.background)(char bel)
(ansi -o $osc_cursor_color)($theme.cursor)(char bel)
"
| str replace --all "\n" ''
| print -n $"($in)\r"
}
export module activate {
export-env {
set color_config
update terminal
}
}
# Activate the theme when sourced
use activate

View file

@ -0,0 +1,12 @@
{
home.file.".config/nushell/config".source = ./config;
programs.nushell = {
enable = false;
configFile.source = ./config.nu;
shellAliases = {
cls = "clear";
nv = "nvim";
ls = "lse";
};
};
}

View file

@ -0,0 +1,18 @@
{ config, ... }:
{
home.file.".config/foot/themes".source = ./themes;
programs.foot = {
enable = true;
settings = {
main = {
shell = "fish";
pad = "0x0center";
font = "Maple Mono NF:size=12";
include = "${config.xdg.configHome}/foot/themes/kanagawa.ini";
};
scrollback = {
lines = 100000;
};
};
};
}

View file

@ -0,0 +1,27 @@
[colors]
foreground = dcd7ba
background = 1f1f28
selection-foreground = c8c093
selection-background = 2d4f67
regular0 = 090618
regular1 = c34043
regular2 = 76946a
regular3 = c0a36e
regular4 = 7e9cd8
regular5 = 957fb8
regular6 = 6a9589
regular7 = c8c093
bright0 = 727169
bright1 = e82424
bright2 = 98bb6c
bright3 = e6c384
bright4 = 7fb4ca
bright5 = 938aa9
bright6 = 7aa89f
bright7 = dcd7ba
16 = ffa066
17 = ff5d62

View file

@ -0,0 +1,25 @@
[colors]
foreground=c0caf5
background=1a1b26
urls=73daca
regular0=15161e
regular1=f7768e
regular2=9ece6a
regular3=e0af68
regular4=7aa2f7
regular5=bb9af7
regular6=7dcfff
regular7=a9b1d6
bright0=414868
bright1=f7768e
bright2=9ece6a
bright3=e0af68
bright4=7aa2f7
bright5=bb9af7
bright6=7dcfff
bright7=c0caf5
16=ff9e64
17=db4b4b

View file

@ -0,0 +1,27 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
(st.overrideAttrs (oldAttrs: {
src = fetchFromGitHub {
owner = "elisiei";
repo = "st";
rev = "dd154987103b12df593a424fd238713201fbce54";
sha256 = "sha256-/++WajhlI6zlE18DlslOn+qtoqxROxnZb63NK4MTeX0=";
};
nativeBuildInputs = oldAttrs.nativeBuildInputs or [ ] ++ [ pkg-config ];
buildInputs = oldAttrs.buildInputs ++ [
imlib2
zlib
harfbuzz
];
preBuild = ''
cp config.def.h config.h
'';
makeFlags = [ "CC=${pkgs.gcc}/bin/gcc" ];
installFlags = [ "PREFIX=$(out)" ];
}))
];
}

View file

@ -0,0 +1,39 @@
{
services.dunst = {
enable = true;
settings = {
global = {
offset = "15x15";
corner_radius = 0;
transparency = 50;
frame_width = 1;
timeout = 3;
font = "Maple Mono NF 10";
icon_corner_radius = 0;
min_icon_size = 56;
};
urgency_low = {
background = "#1e2030";
foreground = "#c8d3f5";
frame_color = "#c8d3f5";
timeout = 3;
};
urgency_normal = {
background = "#222436";
foreground = "#c8d3f5";
frame_color = "#c8d3f5";
timeout = 3;
};
urgency_critical = {
background = "#2f334d";
foreground = "#c53b53";
frame_color = "#c53b53";
timeout = 5;
};
};
};
}

View file

@ -0,0 +1,27 @@
{
programs.git = {
enable = true;
userName = "Elisiei Yehorov";
userEmail = "yehorovye@disroot.org";
signing = {
key = "BA1D158DCE3DF089";
signByDefault = true;
};
extraConfig = {
tag.gpgSign = true;
credential.helper = "store";
push.default = "current";
# @elisiei
url."git@github.com-elisiei:".insteadOf = "https://github.com/elisiei/";
url."git@github.com-elisiei:".pushInsteadOf = "https://github.com/elisiei/";
# @yehorovye
url."git@github.com-yehorovye:".insteadOf = "https://github.com/yehorovye/";
url."git@github.com-yehorovye:".pushInsteadOf = "https://github.com/yehorovye/";
};
};
}

View file

@ -0,0 +1,11 @@
{ pkgs, ... }:
{
programs.obs-studio = {
enable = true;
plugins = with pkgs.obs-studio-plugins; [
wlrobs
obs-backgroundremoval
obs-pipewire-audio-capture
];
};
}

View file

@ -0,0 +1,17 @@
{
programs.tofi = {
enable = true;
settings = {
background-color = "#000000";
border-width = 0;
font = "monospace";
height = "100%";
num-results = 5;
outline-width = 0;
padding-left = "35%";
padding-top = "35%";
result-spacing = 25;
width = "100%";
};
};
}

View file

@ -0,0 +1,18 @@
{
programs.wofi = {
enable = true;
style = ./style.css;
settings = {
show = "drun";
width = 750;
height = 400;
always_parse_args = true;
show_all = false;
term = "foot";
hide_scroll = true;
print_command = true;
insensitive = true;
columns = 1;
};
};
}

View file

@ -0,0 +1,35 @@
window {
background-color: #1a1b26;
border: none;
}
#input {
padding: 0.6em 0.8em;
background-color: #24283b;
color: #c0caf5;
border: none;
font-size: 14px;
}
#entry {
padding: 0.6em 0.8em;
color: #c0caf5;
background: transparent;
border: none;
font-size: 14px;
}
#entry:selected {
background-color: #7aa2f7;
color: #1a1b26;
font-weight: bold;
}
#text {
color: inherit;
}
#text:selected {
color: #1a1b26;
font-weight: bold;
}

14
home/packages.nix Normal file
View file

@ -0,0 +1,14 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
ripgrep
jq
btop
fd
fzf
zig
kdePackages.dolphin
gnome.gvfs
discord
];
}

28
nixos/configuration.nix Normal file
View file

@ -0,0 +1,28 @@
{ inputs, ... }:
{
imports = [
inputs.spicetify-nix.nixosModules.default
./hardware-configuration.nix
./modules/networking.nix
./modules/localization.nix
./modules/xserver.nix
./modules/audio.nix
./modules/user.nix
./modules/programs.nix
./modules/boot.nix
./modules/fonts.nix
# gaming shi
./modules/gaming.nix
];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nixpkgs.config.allowUnfree = true;
system.stateVersion = "25.05";
}

View file

@ -0,0 +1,41 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/90ae88e4-a293-4e43-94ff-311f194d84d6";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/AF0B-79BE";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/9553ce42-c192-47b4-8d3d-c4d3e9dc0f74"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

11
nixos/modules/audio.nix Normal file
View file

@ -0,0 +1,11 @@
{
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
}

35
nixos/modules/boot.nix Normal file
View file

@ -0,0 +1,35 @@
{ pkgs, config, ... }:
{
boot = {
tmp.cleanOnBoot = true;
kernelPackages = pkgs.linuxKernel.packages.linux_6_12;
extraModulePackages = with config.boot.kernelPackages; [
rtl88xxau-aircrack
];
loader = {
efi.canTouchEfiVariables = true;
efi.efiSysMountPoint = "/boot";
timeout = null;
grub = {
enable = true;
device = "nodev";
efiSupport = true;
useOSProber = true;
gfxmodeEfi = "2715x1527"; # for 4k: 3840x2160
gfxmodeBios = "2715x1527"; # for 4k: 3840x2160
theme = pkgs.stdenv.mkDerivation {
pname = "distro-grub-themes";
version = "3.1";
src = pkgs.fetchFromGitHub {
owner = "AdisonCavani";
repo = "distro-grub-themes";
rev = "v3.1";
hash = "sha256-ZcoGbbOMDDwjLhsvs77C7G7vINQnprdfI37a9ccrmPs=";
};
installPhase = "cp -r customize/nixos $out";
};
};
};
};
}

18
nixos/modules/fonts.nix Normal file
View file

@ -0,0 +1,18 @@
{ pkgs, ... }:
{
fonts = {
enableDefaultPackages = true;
packages = with pkgs; [
nerd-fonts.fira-code
nerd-fonts.fira-mono
nerd-fonts.noto
nerd-fonts.jetbrains-mono
maple-mono.NF
];
fontconfig.defaultFonts = {
serif = [ "Noto Nerd Font" ];
sansSerif = [ "Noto Nerd Font" ];
monospace = [ "Noto Nerd Font" ];
};
};
}

13
nixos/modules/gaming.nix Normal file
View file

@ -0,0 +1,13 @@
{ pkgs, ... }:
{
programs.gamemode.enable = true;
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
};
environment.systemPackages = with pkgs; [
protonup-qt
];
}

View file

@ -0,0 +1,17 @@
{
time.timeZone = "Europe/Madrid";
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "es_ES.UTF-8";
LC_IDENTIFICATION = "es_ES.UTF-8";
LC_MEASUREMENT = "es_ES.UTF-8";
LC_MONETARY = "es_ES.UTF-8";
LC_NAME = "es_ES.UTF-8";
LC_NUMERIC = "es_ES.UTF-8";
LC_PAPER = "es_ES.UTF-8";
LC_TELEPHONE = "es_ES.UTF-8";
LC_TIME = "es_ES.UTF-8";
};
}

View file

@ -0,0 +1,30 @@
{
networking.hostName = "nixos";
networking.networkmanager.enable = true;
services.blueman.enable = true;
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
settings = {
General = {
# Shows battery charge of connected devices on supported
# Bluetooth adapters. Defaults to 'false'.
Experimental = true;
# When enabled other devices can connect faster to us, however
# the tradeoff is increased power consumption. Defaults to
# 'false'.
FastConnectable = true;
};
Policy = {
# Enable all controllers when they are found. This includes
# adapters present on start as well as adapters that are plugged
# in later on. Defaults to 'true'.
AutoEnable = true;
};
};
};
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
}

View file

@ -0,0 +1,58 @@
{ pkgs, inputs, ... }:
let
spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system};
in
{
programs.hyprland = {
enable = true;
withUWSM = true;
xwayland.enable = true;
};
environment.sessionVariables = {
WLR_NO_HARDWARE_CURSORS = "1";
NIXOS_OZONE_WL = "1";
};
environment.systemPackages = with pkgs; [
# essential
curl
# useful
wl-clipboard
gnumake
git-credential-manager
# notifications
libnotify
# screenshot utils
grim
slurp
hyprpicker # not really for screenshots, but i use it to freeze screen
# email client
thunderbird
# browser
librewolf
# wayland
swaybg
apple-cursor
];
environment.gnome.excludePackages = [ pkgs.gnome-tour ];
services.xserver.excludePackages = [ pkgs.xterm ];
services.xserver.desktopManager.xterm.enable = false;
programs.spicetify = {
enable = true;
enabledExtensions = with spicePkgs.extensions; [
adblock
hidePodcasts
];
colorScheme = "Ocean";
};
}

19
nixos/modules/user.nix Normal file
View file

@ -0,0 +1,19 @@
{ pkgs, ... }:
{
users.users.elisiei = {
isNormalUser = true;
description = "elisiei";
extraGroups = [
"networkmanager"
"wheel"
"video"
"audio"
];
shell = pkgs.fishMinimal;
};
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
}

42
nixos/modules/xserver.nix Normal file
View file

@ -0,0 +1,42 @@
{ config, ... }:
{
services.xserver.enable = true;
services.xserver.videoDrivers = [ "nvidia" ];
hardware.graphics = {
enable = true;
enable32Bit = true;
};
hardware.nvidia = {
modesetting.enable = true;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
open = false; # closed-source driver
prime = {
offload.enable = true;
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
services.xserver.xkb = {
layout = "es";
variant = "";
};
console.keyMap = "es";
services.displayManager.sddm.enable = true;
services.displayManager.defaultSession = "hyprland-uwsm";
services.displayManager.autoLogin.enable = true;
services.displayManager.autoLogin.user = "elisiei";
services.displayManager.sddm.wayland.enable = true;
environment.etc."xdg/sessions/hyprland.desktop".text = ''
[Desktop Entry]
Name=Hyprland
Comment=Hyprland Wayland Compositor
Exec=Hyprland
Type=Application
'';
}