1
0

feat: initial commit; NixOS Era

This commit is contained in:
2025-11-20 22:13:05 +01:00
commit 8d0bddf680
46 changed files with 2044 additions and 0 deletions

15
pkgs/fish/config.fish Normal file
View File

@@ -0,0 +1,15 @@
set fish_greeting '( .-.)'
fish_vi_key_bindings
alias cls='clear; and echo $fish_greeting';
alias ...='cd ../..';
set -l directory (status dirname)
[ -f "$directory/prompt.fish" ]; and source "$directory/prompt.fish"
[ -f "$directory/alias.fish" ]; and source "$directory/alias.fish"
if not set -qx SSH_AUTH_SOCK
set -x SSH_AUTH_SOCK (gpgconf --list-dirs agent-ssh-socket)
end

23
pkgs/fish/default.nix Normal file
View File

@@ -0,0 +1,23 @@
{
pkgs ? import <nixpkgs> { },
lib ? pkgs.lib,
...
}:
pkgs.stdenv.mkDerivation rec {
pname = "fish-config";
version = "1.0";
src = builtins.path {
path = ./.;
name = pname;
};
installPhase = ''
mkdir -p $out
cp -r ${src}/* $out/
'';
dontUnpack = true;
dontBuild = true;
}

View File

@@ -0,0 +1,26 @@
function clip
if not command -q xclip
echoerr "clip: 'xclip' is not available on this system"
return 1
end
if not tty -s
set -l stdin
read stdin -z
end
if set -ql stdin
echo "$stdin" | xclip -selection clipboard
echo "copied into clipboard (stdin)"
return 0
end
if [ -n "$(string trim -- $argv)" ]
echo "$argv" | xclip -selection clipboard
echo "copied into clipboard"
return 0
end
xclip -selection clipboard -o
end

View File

@@ -0,0 +1,3 @@
function echoerr
echo $argv >&2
end

View File

@@ -0,0 +1,45 @@
function nix-shell
set -l _argv (string split ' ' -- $argv);
if contains -- '-q' $_argv; or contains -- '--query' $_argv
for pkg in (string split ' ' -- $FISH_NIX_PACKAGES)
echo $pkg
end
return 0;
end
function package_flag -a arg
contains -- '-p' $arg
or contains -- '--packages' $arg
end
if not command -q nix-shell; or not package_flag $argv
command nix-shell --run fish $argv;
return $status;
end
set -l packages
set -l reading_packages 0
for arg in $_argv
if [ $reading_packages -ne 0 ]
if string match -r '^-'
set reading_packages 0
else
not contains -- $arg (string split ' ' -- $FISH_NIX_PACKAGES);
and set packages $packages $arg
end
else
package_flag $arg; and set reading_packages 1
end
end
set -l prev_packages $FISH_NIX_PACKAGES;
set -x FISH_NIX_PACKAGES $prev_packages $packages;
command nix-shell --run fish $argv;
set -l nix_status $status;
set -x FISH_NIX_PACKAGES $prev_packages;
return $nix_status
end

View File

@@ -0,0 +1,12 @@
function nix-shell
if not command -q nix-shell
command nix-shell;
return $status;
end
set -l _argv $argv
argparse -i 'p/packages=' -- $argv
or command nix-shell -- $_argv
set -x FISH_NIX_PACKAGES
end

View File

@@ -0,0 +1,18 @@
function round
argparse -n 'round' -i 'p/precision=!_validate_int' -- $argv
or return 1;
set -l value (string trim -- $argv)
if [ -z $value ]
echoerr 'round: no input'
return 1
end
set -l precision 1
if set -q _flag_precision
set precision (math "10 ^ $_flag_precision")
end
set value (math "$value * $precision")
echo (math "round($value) / $precision")
end

76
pkgs/fish/prompt.fish Normal file
View File

@@ -0,0 +1,76 @@
function fish_mode_prompt; end
function fish_prompt
set -l command_status $status;
set -l duration '';
begin
[ $CMD_DURATION -gt 700 ]; and set -l seconds \
"$(round -p 2 (math $CMD_DURATION / 1000 % 60))s";
[ $CMD_DURATION -gt 60000 ]; and set -l minutes \
"$(round (math $CMD_DURATION / 60000))m";
[ $CMD_DURATION -gt 700 ]; and set duration (string join '' -- \
(set_color normal) \
'took ' \
(set_color yellow) \
(string join ' ' -- $minutes $seconds) \
);
end
set -l mode
begin
function color_and_wrap -a color char
string join '' -- (set_color --bold $color) "[$char]"
functions -e color_and_wrap
end
set -l indicator \
(switch $fish_bind_mode
case default; color_and_wrap red 'N'
case insert; color_and_wrap cyan 'I'
case replace_one; color_and_wrap green 'R'
case visual; color_and_wrap brmagenta 'V'
case '*'; color_and_wrap red '?'
end)
set mode (string join '' -- $indicator (set_color normal) ' ')
end
set -l nix_shell
begin
set -l packages (string split ' ' -- $FISH_NIX_PACKAGES)
if [ -n "$IN_NIX_SHELL" ]
set nix_shell "$(set_color brblue) "
set -ql packages[1]; and set nix_shell "$nix_shell($packages[1]";
set -ql packages[2]; and set nix_shell "$nix_shell, $packages[2]";
set -ql packages[3]; and not set -ql packages[4]; and set nix_shell "$nix_shell, $packages[3]";
set -ql packages[4]; and set nix_shell "$nix_shell, +$(math (count $packages) - 2) more"
set -ql packages[1]; set nix_shell "$nix_shell) "
end
end
set -l cursor_color (set_color green)
[ $command_status -ne 0 ]; and set -l cursor_color (set_color red)
set -l pwd (string join '' -- \
$cursor_color \
(prompt_pwd -D 2 -d 1) \
(set_color normal) \
);
[ (fish_vcs_prompt) ]; and set -l git (string join '' -- \
(set_color yellow) \
' 󰘬 ' \
(string sub -s 3 -e -1 -- (fish_vcs_prompt)) \
' ' \
);
[ $command_status -ne 0 ]; and set -l last_status "[$command_status]";
[ -n $duration ]; and echo $duration
string join '' -- $mode $nix_shell $pwd $git $cursor_color $last_status '|> '
end

View File

@@ -0,0 +1,29 @@
{
pkgs ? import <nixpkgs> { system = builtins.currentSystem; },
lib ? pkgs.lib,
...
}:
pkgs.stdenv.mkDerivation rec {
pname = "monaco-font";
version = "1.0";
src = builtins.fetchurl {
url = "https://github.com/taodongl/monaco.ttf/raw/refs/heads/master/monaco.ttf";
sha256 = "sha256:09chm7js9qk80q47d1ybp5imhl0bwjp0kcwfk4i8hcsjbf0cwrvw";
};
dontUnpack = true;
installPhase = ''
mkdir -p $out/share/fonts/truetype
cp $src $out/share/fonts/truetype/monaco.ttf
'';
meta = with lib; {
desscription = "Monaco font";
homepage = "https://github.com/taodongl/monaco.ttf";
licensse = licenses.free;
platforms = platforms.all;
};
}

1
pkgs/monaco-font/result Symbolic link
View File

@@ -0,0 +1 @@
/nix/store/kp450zrxxva5fv7wwpnz841vgxan6c49-nixos-system-blueplum-25.05.811874.daf6dc47aa4b

View File

@@ -0,0 +1 @@
vim.lsp.enable('fish_ls')

View File

@@ -0,0 +1,2 @@
vim.wo.wrap = false
vim.opt.expandtab = true

23
pkgs/neovim/default.nix Normal file
View File

@@ -0,0 +1,23 @@
{
pkg ? import <nixpkg>,
lib ? pkg.lib,
...
}:
pkg.stdenv.mkDerivation rec {
pname = "neovim-config";
version = "1.0";
src = builtins.path {
path = ./.;
name = "neovim-config";
};
installPhase = ''
mkdir -p $out
cp -r ${src}/* $out/
'';
dontUnpack = true;
dontBuild = true;
}

14
pkgs/neovim/init.lua Normal file
View File

@@ -0,0 +1,14 @@
local lazy = require('BluePlum.lazy').bootstrap()
require('BluePlum')
if lazy then
lazy.setup({
spec = {
{ import = 'plugins' },
},
checker = { enabled = false },
change_detection = { notify = false },
performance = { rtp = { reset = false } }
})
end

View File

@@ -0,0 +1,20 @@
{
"blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" },
"cord.nvim": { "branch": "master", "commit": "a4484bb25e343a375d95b250ffadbdcbfbfdf2ac" },
"flash.nvim": { "branch": "develop", "commit": "045457978f3fb7df03efa2023dbc8a5f6e9179bd" },
"formatter.nvim": { "branch": "master", "commit": "b9d7f853da1197b83b8edb4cc4952f7ad3a42e41" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
"markview.nvim": { "branch": "main", "commit": "d5d37102d24c3d5d032b01263855081b6850509b" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
"mini.icons": { "branch": "main", "commit": "94848dad1589a199f876539bd79befb0c5e3abf0" },
"nvim-treesitter": { "branch": "main", "commit": "dafb3cb3cb066774526c1103f3d1d6b34578800b" },
"oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" },
"oxocarbon.nvim": { "branch": "main", "commit": "acdfdd5d319c36170b5ad2a120283bec2f450081" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"smear-cursor.nvim": { "branch": "main", "commit": "4a0f7ac265b4ed1ce4d0af2afc13072763bfa691" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
"vim-fugitive": { "branch": "master", "commit": "593f831d6f6d779cbabb70a4d1e6b1b1936a88af" }
}

View File

@@ -0,0 +1,4 @@
return {
cmd = { 'bash-language-server', 'start' },
filetypes = { 'sh', 'bash' },
}

View File

@@ -0,0 +1,4 @@
return {
cmd = { 'fish-lsp', 'start' },
filetypes = { 'fish' },
}

View File

@@ -0,0 +1,5 @@
return {
cmd = { 'lua-language-server' },
filetypes = { 'lua' },
root_markers = { '.luarc.json', '.luarc.jsonc' },
}

36
pkgs/neovim/lsp/nixd.lua Normal file
View File

@@ -0,0 +1,36 @@
return {
cmd = { 'nixd' },
filetypes = { 'nix' },
root_markers = { { 'configuration.nix', 'flake.nix', 'default.nix' } },
settings = {
nixd = {
options = {
nixos = {
expr = [[
(import <nixpkgs/nixos/lib/eval-config.nix> {
modules = [
<nixos-config>
/etc/nixos/hardware-configuration.nix
];
})
.options
]]
},
['home-manager'] = {
expr = [[
let
pkgs = import <nixpkgs> {};
config = pkgs.callPackage <nixos-config> {};
home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-${config.system.stateVersion}.tar.gz";
in
(import "${home-manager}/modules" {
inherit pkgs;
configuration = /etc/nixos/home.nix;
})
.options
]]
}
}
}
}
}

View File

@@ -0,0 +1,12 @@
return {
cmd = { 'rust-analyzer' },
filetypes = { 'rust' },
root_markers = { 'Cargo.toml', '.git' },
settings = {
['rust-analyzer'] = {
check = {
command = 'clippy',
},
},
},
}

View File

@@ -0,0 +1,5 @@
return {
cmd = { 'typescript-language-server', '--stdio' },
filetypes = { 'typescript', 'javascript' },
root_markers = { 'package.json', 'tsconfig.json' },
}

View File

@@ -0,0 +1,22 @@
vim.api.nvim_create_user_command('Dot', 'edit ~/.config/nvim', {})
vim.cmd.cnoreabbrev('Git', 'GIt')
vim.api.nvim_create_user_command('GIt', function(ctx)
local subcommand = ctx.fargs[1]
if subcommand == 'log' then
local argv = table.concat({
'log',
'--graph',
'--abbrev-commit',
'--decorate',
}, ' ')
local sliced = vim.list_slice(ctx.fargs, 2)
vim.cmd.Git(argv .. ' ' .. table.concat(sliced, ' '))
return
end
vim.cmd.Git(table.concat(ctx.fargs, ' '))
end, {
nargs = '+',
})

View File

@@ -0,0 +1,3 @@
require('BluePlum.set')
require('BluePlum.keymap')
require('BluePlum.commands')

View File

@@ -0,0 +1,87 @@
--- Defaults to `{'n'}`
--- @alias Mode 'n'|'v'|'Q'|'t'|'i'|'c'
--- @alias Mapping string|fun(): nil
--- @type table<string, { [string]: Mapping, modes: (Mode)[]? }>
local keymap = {
move_lines = {
['<M-Up>'] = '<ESC>:move-2<CR>i',
['<M-Down>'] = '<ESC>:move+<CR>i',
modes = { 'i' },
},
half_screen_scroll = {
['<C-Up>'] = '<C-u>zz',
['<C-Down>'] = '<C-d>zz',
},
clipboard_yank = {
['<leader>y'] = '"+y',
modes = { 'n', 'v' },
},
terminal_escape = {
['<ESC>'] = '<C-\\><C-n>',
modes = { 't' },
},
terminal = {
['<leader>t'] = function()
OpenTerminal = OpenTerminal or nil
local open_buf = vim.api.nvim_get_current_buf()
if PreviousBuffer and open_buf == OpenTerminal then
vim.api.nvim_set_current_buf(PreviousBuffer)
PreviousBuffer = nil
return
end
PreviousBuffer = open_buf
if OpenTerminal then
vim.api.nvim_set_current_buf(OpenTerminal)
return
end
vim.cmd.term()
OpenTerminal = vim.api.nvim_get_current_buf()
vim.api.nvim_create_autocmd({ 'BufDelete' }, {
callback = function()
OpenTerminal = nil
end,
buffer = OpenTerminal,
})
end,
},
goto_last_buffer = {
['<leader>l'] = ':e#<CR>',
},
scratch_pad = {
['<leader>s'] = table.concat({
':bo vs',
':enew',
':setlocal noswapfile',
':setlocal bufhidden=hide',
':set filetype=markdown',
':set syntax=markdown',
'',
}, '<CR>'),
},
window_navigation = {
['<M-q>'] = '<C-w>q',
['<M-left>'] = '<C-w><left>',
['<M-right>'] = '<C-w><right>',
['<M-up>'] = '<C-w><up>',
['<M-down>'] = '<C-w><down>',
},
}
for _, tbl in pairs(keymap) do
for key, value in pairs(tbl) do
if key ~= 'modes' then
local modes = tbl.modes --[[ @as Mode[] ]]
or { 'n' }
for _, mode in ipairs(modes) do
--- @cast value Mapping
vim.keymap.set(mode, key, value)
end
end
end
end

View File

@@ -0,0 +1,64 @@
--- @class Lazy
--- @field setup fun(opts: table)
local M = {}
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
--- @nodiscard
--- @return Lazy?
function M.bootstrap()
--- @type { fs_stat: fun(path: string): boolean }
local fs = vim.uv or vim.loop
if fs.fs_stat(lazypath) then
vim.opt.rtp:prepend(lazypath)
return require('lazy')
end
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
local out = vim.fn.system({ 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
{ out, 'WarningMsg' },
}, true, {})
return nil
end
return require('lazy')
end
M.icons = 'echasnovski/mini.icons'
M.icons_require = function()
return require('mini.icons')
end
--- @enum PlenaryModule
local _ = {
async = 'async',
async_lib = 'async_lib',
job = 'job',
path = 'path',
scandir = 'scandir',
context_manager = 'context_manager',
test_harness = 'test_harness',
filetype = 'filetype',
strings = 'strings',
}
--- @param module PlenaryModule
M.plenary_require = function(module)
return require('plenary.' .. module)
end
M.plenary = 'nvim-lua/plenary.nvim'
--- @enum
M.event = {
BufEnter = 'BufEnter',
BufWinEnter = 'BufWinEnter',
BufWritePost = 'BufWritePost',
VeryLazy = 'VeryLazy',
}
return M

Some files were not shown because too many files have changed in this diff Show More