still working

This commit is contained in:
Bryan Ramos 2023-06-05 15:14:24 -04:00
parent 64235f2775
commit 0712b63194
14 changed files with 508 additions and 174 deletions

View file

@ -0,0 +1,83 @@
{ pkgs, lib, config, ... } =
with lib;
let cfg = config.modules.alacritty;
in {
options.modules.alacritty = { enable = mkEnableOption "alacritty"; };
config = mkIf cfg.enable {
programs.alacritty = {
enable = true;
settings = {
scrolling = {
history = 10000;
multiplier = 3;
};
window = {
opacity = 0.95;
};
colors = {
primary = {
background = 0x0d1117;
foreground = 0xb3b1ad;
};
normal = {
black = 0x484f58;
red = 0xff7b72;
green = 0x3fb950;
yellow = 0xd29922;
blue = 0x58a6ff;
magenta = 0xbc8cff;
cyan = 0x39c5cf;
white = 0xb1bac4;
};
bright = {
black = 0x6e7681;
red = 0xffa198;
green = 0x56d364;
yellow = 0xe3b341;
blue = 0x79c0ff;
magenta = 0xd2a8ff;
cyan = 0x56d4dd;
white = 0xf0f6fc;
};
font = {
normal = {
family = TerminusWithNerdFont;
style = Medium;
};
bold = {
family = TerminusWithNerdFont;
style = Bold;
};
italic = {
family = TerminusWithNerdFont;
style = Medium Italic;
};
bold_italic = {
family = TerminusWithNerdFont;
style = Bold Italic;
};
size = 14;
cursor = {
color = 0xffffff;
style = {
shape = Block;
blinking = Always;
blink-interval = 750;
};
};
};
};
}

View file

@ -64,120 +64,118 @@ in {
unset flake_icon
}
PROMPT_COMMAND="set_ps1_prompt; $PROMPT_COMMAND"
'';
function cdg() {
if [[ $1 == "--help" ]]; then
echo "A simple utility for navigating to the root of a git repo"
return 0
fi
bashrcExtra = ''
function cdg() {
if [[ $1 == "--help" ]]; then
echo "A simple utility for navigating to the root of a git repo"
return 0
fi
# Check for invalid command
if [[ -n "$1" ]]; then
echo "Invalid command: $1. Try 'cdg --help'."
return 1
fi
# Check for invalid command
if [[ -n "$1" ]]; then
echo "Invalid command: $1. Try 'cdg --help'."
return 1
fi
local root_dir
root_dir=$(git rev-parse --show-toplevel 2>/dev/null)
local git_status=$?
local root_dir
root_dir=$(git rev-parse --show-toplevel 2>/dev/null)
local git_status=$?
if [ $git_status -ne 0 ]; then
echo "Error: Not a git repo."
return 1
fi
if [ $git_status -ne 0 ]; then
echo "Error: Not a git repo."
return 1
fi
cd "$root_dir"
}
cd "$root_dir"
}
function ldv() {
if [[ $1 == "help" ]] || [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
cat << EOF
ldv
A simple utility for setting up development environments effortlessly.
Commands:
ldv Start a preconfigured nix shell.
init Create a new dev template in the current working directory.
help Show available commands and options.
Contributions welcome: https://github.com/itme-brain/ldv
EOF
elif [[ $1 == "init" ]] || [[ $1 == "-i" ]] || [[ $1 == "--init" ]]; then
if [[ -e ./shell.nix ]] || [[ -e ./.envrc ]]; then
function ldv() {
if [[ $1 == "help" ]] || [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
cat << EOF
Existing environment found.
Initialization cancelled.
EOF
return
ldv
A simple utility for setting up development environments effortlessly.
Commands:
ldv Start a preconfigured nix shell.
init Create a new dev template in the current working directory.
help Show available commands and options.
Contributions welcome: https://github.com/itme-brain/ldv
EOF
elif [[ $1 == "init" ]] || [[ $1 == "-i" ]] || [[ $1 == "--init" ]]; then
if [[ -e ./shell.nix ]] || [[ -e ./.envrc ]]; then
cat << EOF
Existing environment found.
Initialization cancelled.
EOF
return
fi
cat << EOF
Initializing a new environment...
Select an environment:
1. Web
2. Elixir
3. Haskell
EOF
read -p "Enter the number of your choice: " choice
case $choice in
1)
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/shells/web.nix -O shell.nix
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/flake -O flake.nix
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/envrc -O .envrc
direnv allow
;;
2)
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/shells/elixir.nix -O shell.nix
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/flake -O flake.nix
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/envrc -O .envrc
direnv allow
;;
3)
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/shells/haskell.nix -O shell.nix
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/flake -O flake.nix
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/envrc -O .envrc
direnv allow
;;
*)
echo "Invalid choice."
;;
esac
elif [[ -z $1 ]]; then
cat << EOF
Select an environment:
1. Web
2. Elixir
3. Haskell
EOF
read -p "Enter the number of your choice: " choice
case $choice in
1)
(nix develop github:itme-brain/ldv#web)
;;
2)
(nix develop github:itme-brain/ldv#elixir)
;;
3)
(nix develop github:itme-brain/ldv#haskell)
;;
# Add more cases here...
*)
echo "Invalid choice."
;;
esac
else
echo "Error: Invalid command. Try 'ldv --help'"
fi
cat << EOF
Initializing a new environment...
Select an environment:
1. Web
2. Elixir
3. Haskell
EOF
read -p "Enter the number of your choice: " choice
case $choice in
1)
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/shells/web.nix -O shell.nix
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/flake -O flake.nix
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/envrc -O .envrc
direnv allow
;;
2)
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/shells/elixir.nix -O shell.nix
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/flake -O flake.nix
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/envrc -O .envrc
direnv allow
;;
3)
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/shells/haskell.nix -O shell.nix
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/flake -O flake.nix
wget -q https://raw.githubusercontent.com/itme-brain/ldv/main/utils/envrc -O .envrc
direnv allow
;;
*)
echo "Invalid choice."
;;
esac
elif [[ -z $1 ]]; then
cat << EOF
Select an environment:
1. Web
2. Elixir
3. Haskell
EOF
read -p "Enter the number of your choice: " choice
case $choice in
1)
(nix develop github:itme-brain/ldv#web)
;;
2)
(nix develop github:itme-brain/ldv#elixir)
;;
3)
(nix develop github:itme-brain/ldv#haskell)
;;
# Add more cases here...
*)
echo "Invalid choice."
;;
esac
else
echo "Error: Invalid command. Try 'ldv --help'"
fi
}
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
ldv "$@"
fi
'';
}
'';
shellAliases = {
ls = "lsd";

View file

@ -9,11 +9,13 @@ in
config = mkIf cfg.enable {
programs.git = {
enable = true;
userName = "Bryan Ramos";
userEmail = "bryan@ramos.codes";
extraConfig = {
init = { defaultBranch = "main"; };
};
};
home.file = {
".gitconfig".source = ./gitconfig;
};
};
}

4
modules/git/gitconfig Normal file
View file

@ -0,0 +1,4 @@
[user]
email = bryan@ramos.codes
name = Bryan Ramos
signingkey = F1F3466458452B2DF351F1E864D12BA95ACE1F2D

11
modules/gpg/default.nix Normal file
View file

@ -0,0 +1,11 @@
{ pkgs, lib, config, ... }:
with lib;
let cfg = config.modules.gpg;
in {
options.modules.gpg = { enable = mkEnableOption "gpg"; };
config = mkIf cfg.enable {
programs.gpg.enable = true;
};
}

10
modules/gtk/default.nix Normal file
View file

@ -0,0 +1,10 @@
{ pkgs, lib, config, ... }:
with lib;
let cfg = config.modules.PROGRAM;
in {
options.modules.PROGRAM = { enable = mkEnableOption "PROGRAM"; };
config = mkIf cfg.enable {
};
}

132
modules/home.nix Normal file
View file

@ -0,0 +1,132 @@
{ config, pkgs, ... }:
{
programs.home-manager.enable = true; # Leave this set to true.
home = {
username = "bryan";
homeDirectory = "/home/bryan";
stateVersion = "22.11"; # Do not edit this variable
};
home.packages = with pkgs; [
firefox
google-chrome
(tor-browser-bundle-bin.override {
useHardenedMalloc = false; # Nix specific bug in tor browser requires disabling useHardenedMalloc
})
spotify
discord
alacritty
ranger
highlight
imv
gimp
android-studio
gh
syncthing
rsync
wget
curl
btop
pciutils
tree
git
git-review
openssh
unzip
lsd
fping
calc
qrencode
mdbook
bash-completion
pkg-config
docker
nix-init
lazygit
ripgrep
fd
luajit
trezor-suite
trezorctl
electrum
keepassxc
neofetch
evince
wireguard-tools
nodejs
gcc
ghc
cabal-install
haskellPackages.hoogle
cabal2nix
python3
# LSPs
nodePackages.eslint
nodePackages.vscode-langservers-extracted
nodePackages.typescript-language-server
nodePackages.diagnostic-languageserver
nodePackages.pyright
nodePackages.purescript-language-server
nodePackages."@tailwindcss/language-server"
nodePackages.bash-language-server
haskell-language-server
nil
marksman
sumneko-lua-language-server
];
# PROGRAM CONFIGS
# DIRENV
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
# NEOVIM
programs.neovim = {
enable = true;
# plugins = with pkgs; [
# vimPlugins.nvim-treesitter.withAllGrammars
# ];
};
# SERVICES
# GPG SSH AGENT
home.sessionVariables = {
SSH_AUTH_SOCK = "${config.xdg.dataHome}/gnupg/S.gpg-agent.ssh";
};
# DOTFILE SYMLINKS
home.file = {
".gitconfig".source = ./dotfiles/gitconfig;
".config/" = {
source = ./dotfiles;
recursive = true;
};
".bashrc".source = ./dotfiles/bash/bashrc;
".bash_profile".source = ./dotfiles/bash/bash_profile;
".local/share/themes" = {
source = ./dotfiles/themes;
recursive = true;
};
};
}

View file

@ -8,7 +8,7 @@ let cfg = config.modules.neovim;
src = pkgs.fetchFromGithub {
owner = "projekt0n";
repo = "github-nvim-theme";
rev = "62b7b54a90c70c20cd1641f9facfced46bdd3561";
rev = "ea713c37691b2519f56cd801a2330bdf66393d0f";
sha256 = "0cwr3b5r2ac7aizxmwb3mlhdc2sh0pw670vcwps79x9jp52yrj2y";
};
};
@ -27,7 +27,6 @@ in {
vimAlias = true;
plugins = with pkgs.vimPlugins; [
{
plugin = github-theme;
config = ''
@ -37,13 +36,15 @@ in {
'';
}
lazygit.nvim
{ plugin = lazygit.nvim; }
{
plugin = LazyVim;
config = ''
lua << EOF
return {
{'williamboman/mason.nvim', enabled = false },
{'williamboman/mason-lspconfig.nvim', enabled = false },
{'nvim-treesitter/nvim-treesitter', enabled = false },
}
EOF
@ -65,19 +66,162 @@ in {
}
{
plugin = nvim-treesitter.withAllGrammars
plugin = nvim-treesitter.withAllGrammars;
config = ''
lua << EOF
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
},
}
EOF
'';
}
];
extraLuaConfig = ''
lua << EOF
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
vim.o.clipboard = "unnamedplus"
EOF
'';
generatedConfigs = {
lua = ''
require("config.lazy")
local lsp = require("lsp-zero").preset({})
lsp.on_attach(function(client, bufnr)
lsp.default_keymaps({ buffer = bufnr })
end)
lsp.setup_servers({
"tsserver",
"eslint",
"hls",
"pyright",
"nil_ls",
"cssls",
"html",
"jsonls",
"diagnosticls",
"lua_ls",
"marksman",
"purescriptls",
"tailwindcss",
"bashls",
})
require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls())
lsp.setup()
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
},
})
vim.cmd([[
au BufRead,BufNewFile *.purs set filetype=purescript
]])
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local luasnip = require("luasnip")
cmp.setup({
enabled = function()
-- disable completion in comments
local context = require("cmp.config.context")
-- keep command mode completion enabled when cursor is in a comment
if vim.api.nvim_get_mode().mode == "c" then
return true
else
return not context.in_treesitter_capture("comment") and not context.in_syntax_group("Comment")
end
end,
mapping = {
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
["<CR>"] = cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
}),
},
})
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
-- Disable virtual_text
virtual_text = false,
})
require("notify").setup({
background_colour = "#000000",
})
'';
};
};
home.packages = with pkgs; [
nodePackages.eslint
nodePackages.vscode-langservers-extracted
nodePackages.typescript-language-server
nodePackages.diagnostic-languageserver
nodePackages.pyright
nodePackages.purescript-language-server
nodePackages."@tailwindcss/language-server"
nodePackages.bash-language-server
marksman
nil nixfmt
sumneko-lua-language-server stylua
haskell-language-server hlint
];
};