Skip to content

Instantly share code, notes, and snippets.

@SolarLiner
Last active March 7, 2024 04:11
Show Gist options
  • Save SolarLiner/e0635faa39061433f76aa8a61d6db149 to your computer and use it in GitHub Desktop.
Save SolarLiner/e0635faa39061433f76aa8a61d6db149 to your computer and use it in GitHub Desktop.
Nix home-manager config
{
"nodes": {
"coc-omnisharp": {
"flake": false,
"locked": {
"lastModified": 1608601047,
"narHash": "sha256-ADlvOZX4q6tcUAV5NPoQyNmBlrUGjPkI2ohNcAjsAEQ=",
"owner": "coc-extensions",
"repo": "coc-omnisharp",
"rev": "7a224248758e53bd8920ba52033d0e721f6d4742",
"type": "github"
},
"original": {
"owner": "coc-extensions",
"repo": "coc-omnisharp",
"type": "github"
}
},
"deno": {
"flake": false,
"locked": {
"narHash": "sha256-ZpybUyL060S5+aWJDApAl+krz62Z7liOpYxZRCAv7J0=",
"type": "tarball",
"url": "https://github.com/denoland/deno/releases/download/v1.16.4/deno-x86_64-unknown-linux-gnu.zip"
},
"original": {
"type": "tarball",
"url": "https://github.com/denoland/deno/releases/download/v1.16.4/deno-x86_64-unknown-linux-gnu.zip"
}
},
"flake-utils": {
"locked": {
"lastModified": 1638122382,
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1639506187,
"narHash": "sha256-6wcFhEaA14bHbbr7xgpMv2QEXOEp1vleW7pB6siJXrQ=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c61fc1c288bd1fdf96261ba5574a12cf8f9be70b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"material-vim": {
"flake": false,
"locked": {
"lastModified": 1639160130,
"narHash": "sha256-0QwN8tbCv27qxlGYVXnwhOJ9FA3KRDPrr6oFqaDJlNM=",
"owner": "kaicataldo",
"repo": "material.vim",
"rev": "445534b2db7f7ec3dc088eae21c86ff0e9bb19de",
"type": "github"
},
"original": {
"owner": "kaicataldo",
"repo": "material.vim",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1639566195,
"narHash": "sha256-ZnTBGSV6bTwopdDibmsBaAkedmTZC/rOgwQzOGcOD+s=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3c52ea8c9216a0d5b7a7b4d74a9d2e858b06df5c",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1639566195,
"narHash": "sha256-ZnTBGSV6bTwopdDibmsBaAkedmTZC/rOgwQzOGcOD+s=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3c52ea8c9216a0d5b7a7b4d74a9d2e858b06df5c",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"coc-omnisharp": "coc-omnisharp",
"deno": "deno",
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"material-vim": "material-vim",
"nixpkgs": "nixpkgs_2",
"vim-autosave": "vim-autosave",
"zsh-256color": "zsh-256color"
}
},
"vim-autosave": {
"flake": false,
"locked": {
"lastModified": 1634287348,
"narHash": "sha256-9kvTtfCIq6kTe2Ir81is3is2VXfdEQV92vpEXhYsB/w=",
"owner": "907th",
"repo": "vim-auto-save",
"rev": "d8ff037621e2351278cf0892ca19ee7ce479e802",
"type": "github"
},
"original": {
"owner": "907th",
"repo": "vim-auto-save",
"type": "github"
}
},
"zsh-256color": {
"flake": false,
"locked": {
"lastModified": 1563652855,
"narHash": "sha256-Qd9pjDSQk+kz++/UjGVbM4AhAklc1xSTimLQXxN57pI=",
"owner": "chrissicool",
"repo": "zsh-256color",
"rev": "9d8fa1015dfa895f2258c2efc668bc7012f06da6",
"type": "github"
},
"original": {
"owner": "chrissicool",
"repo": "zsh-256color",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
{
description = "Personal home-manager setup";
inputs = rec {
nixpkgs = {
type = "indirect";
id = "nixpkgs";
};
flake-utils.url = github:numtide/flake-utils;
flake-utils.inputs = {
inherit nixpkgs;
};
home-manager.url = github:nix-community/home-manager;
home-manager.inputs = {
inherit nixpkgs;
};
vim-autosave = {
url = github:907th/vim-auto-save;
flake = false;
};
material-vim = {
url = github:kaicataldo/material.vim;
flake = false;
};
coc-omnisharp = {
url = github:coc-extensions/coc-omnisharp;
flake = false;
};
deno = {
url = https://github.com/denoland/deno/releases/download/v1.16.4/deno-x86_64-unknown-linux-gnu.zip;
flake = false;
};
zsh-256color = {
url = github:chrissicool/zsh-256color;
flake = false;
};
};
outputs = inputs:
let username = "solarliner"; in
with inputs.flake-utils.lib; eachDefaultSystem (system:
let
pkgs = import inputs.nixpkgs { inherit system; };
deno = pkgs.stdenvNoCC.mkDerivation {
pname = "deno";
version = "1.16.2";
src = inputs.deno;
phases = [ "installPhase" ];
dontUnpack = true;
installPhase = ''
mkdir -p $out/bin
cp $src $out/bin
'';
};
coc-omnisharp = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "coc-omnisharp";
version = "master";
src = inputs.coc-omnisharp;
};
material-vim = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "material.vim";
version = "master";
src = inputs.material-vim;
};
vim-autosave = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "vim-autosave";
version = "master";
src = inputs.vim-autosave;
};
zsh-256color = rec {
name = "zsh-256color";
file = "${name}.plugin.zsh";
src = inputs.zsh-256color;
};
in
{
packages.homeConfigurations."${username}" = inputs.home-manager.lib.homeManagerConfiguration {
inherit system username;
homeDirectory = "/home/${username}";
configuration.imports = [ ./home.nix ];
extraSpecialArgs = { inherit deno vim-autosave material-vim coc-omnisharp zsh-256color; };
};
});
}
{ pkgs, vim-autosave, material-vim, coc-omnisharp, deno, zsh-256color, ... }:
{
home.packages = with pkgs; [
# tidal
coq
tree
cachix
htop
# dotnet-sdk_6
deno
# ffmpeg
docker-compose
# neofetch
jq
nixfmt
# julia
# flamegraph
pv
# radare2
# rust-analyzer
# ruby
# faust2
# faustlive
/* (
agda.withPackages
(p: with p; [ standard-library ])
) */
# idris2
# meson
# ninja
# flatpak
# flatpak-builder
# niv
rnix-lsp
pulumi-bin
# coq
# ghc
# cabal-install
# haskell-language-server
# Fonts
jetbrains-mono
];
fonts.fontconfig.enable = true;
programs.home-manager.enable = true;
programs.autojump.enable = true;
programs.bat.enable = true;
programs.bash.enable = false;
programs.nushell = {
enable = true;
settings = {
startup = [
"mkdir ~/.cache/starship"
"starship init nu | save ~/.cache/starship/init.nu"
"source ~/.cache/starship/init.nu"
];
prompt = "starship_prompt";
};
};
programs.exa = {
enable = true;
enableAliases = true;
};
programs.git = {
package = pkgs.gitAndTools.gitFull;
enable = true;
delta.enable = true;
lfs.enable = true;
userName = "Nathan Graule";
userEmail = "[email protected]";
};
programs.gh = {
enable = true;
settings = {
prompt = "enabled";
git_protocol = "ssh";
};
};
programs.opam = {
enable = true;
enableZshIntegration = true;
};
programs.starship = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
programs.zsh = {
enable = true;
enableCompletion = true;
enableAutosuggestions = true;
enableSyntaxHighlighting = true;
sessionVariables = {
EDITOR = "nvim";
};
plugins = [ zsh-256color ];
initExtra = ''
if [ -e $HOME/.profile ]; then
. $HOME/.profile
fi
# NVM
export NVM_DIR=$HOME/.local/share/nvm
if [[ ! -e $NVM_DIR ]]; then
git clone https://github.com/nvm-sh/nvm.git $NVM_DIR
fi
source $NVM_DIR/nvm.sh
source $NVM_DIR/bash_completion
# Rustup
export CARGO_HOME=$HOME/.cargo
if [[ -e $CARGO_HOME ]]; then
export PATH=$CARGO_HOME/bin:$PATH
fi
# Pyenv
export PYENV_ROOT=$HOME/.pyenv
if [[ -e $PYENV_ROOT ]]; then
export PATH=$PYENV_ROOT/bin:$PATH
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"
fi
'';
oh-my-zsh = {
enable = true;
plugins = [ "git" "sudo" "pyenv" "nvm" "cargo" "rust" "autojump" "vscode" ];
extraConfig = ''
BULLETTRAIN_PROMPT_ORDER=(
git
context
dir
virtualenv
nvm
go
)
BULLETTRAIN_VIRTUALENV_FG=black
BULLETTRAIN_NVM_FG=black
BULLETTRAIN_CONTEXT_DEFAULT_USER=solarliner
BULLETTRAIN_CONTEXT_IS_SSH_CLIENT=true
BULLETTRAIN_DIR_EXTENDED=0
BULLETTRAIN_DIR_BG=black
BULLETTRAIN_DIR_FG=white
export NIX_PATH=$HOME/.nix-defexpr/channels''${NIX_PATH:+:}$NIX_PATH
'';
};
};
programs.neovim = {
enable = true;
withNodeJs = true;
withPython3 = true;
extraConfig = ''
set nocompatible
set nobackup
set hidden
set list
set listchars=tab:↦\ ,trail:⬝
set clipboard=unnamedplus
set mouse=a
set signcolumn=yes:2
set relativenumber
set expandtab
set softtabstop=4
set tabstop=4
set shiftwidth=4
set wildmenu
set wildmode=longest:full,full
set scrolloff=8
set sidescrolloff=8
set updatetime=300
let mapleader = ','
let maplocalleader = ','
set exrc
set secure
autocmd InsertEnter * :set number
autocmd InsertLeave * :set relativenumber
if (has("nvim"))
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
if (has("termguicolors"))
set termguicolors
endif
if has('nvim-0.5.0') || has('patch-8.1.1564')
set signcolumn=number
else
set signcolumn=yes
endif
" Custom Vim keybinds
vnoremap < <gv
vnoremap > >gv
nnoremap <S-Tab> <<
vnoremap <S-Tab> <gv
inoremap <S-Tab> <C-d>
nnoremap <Tab> >>
vnoremap <Tab> >gv
" Open files highlithed under cursor
map gf :edit <cfile><cr>
'';
plugins = with pkgs.vimPlugins; [
{
plugin = vim-autosave;
config = ''
let g:auto_save = 1 " enable AutoSave on Vim startup
'';
}
{
plugin = material-vim;
config = ''
set background = "dark"
let g:material_theme_style = 'darker'
let g:material_theme_italics = 1
colorscheme material
'';
}
{
plugin = airline;
config = ''
let g:airline_theme = 'material'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
let g:airline_powerline_fonts = 1
'';
}
ctrlp
vim-toml
vim-nix
vim-sensible
vim-surround
fzf-vim
emmet-vim
vim-sleuth
vim-javascript
vim-polyglot
typescript-vim
agda-vim
fugitive
idris2-vim
auto-pairs
zig-vim
nerdtree
nerdtree-git-plugin
vim-devicons
popup-nvim
markdown-preview-nvim
{
plugin = coc-nvim;
config = ''
inoremap <silent><expr> <TAB>
\ pumvisible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump','''])\<CR>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
let g:coc_snippet_next = '<tab>'
let g:coc_snippet_prev = '<s-tab>'
" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent! call CocActionAsync('highlight')
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
" Remap for hover action
nmap <leader>h :call CocAction('doHover')<CR>
" Remap for format selected region
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format)
" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Remap for do codeAction of current line
nmap <leader>ac <Plug>(coc-codeaction)
" Fix autofix problem of current line
nmap <leader>fc <Plug>(coc-fix-current)
" Search workspace symbols
nmap <leader>s :<C-u>CocList -I symbols<cr>
" Add status line support, for integration with other plugin, checkout `:h coc-status`
set statusline^=%{coc#status()}%{get(b:,'coc_current_function',''')}
" Add comments to JSON
autocmd FileType json syntax match Comment +\/\/.\+$+
" use <c-space>for trigger completion
inoremap <silent><expr> <c-space> coc#refresh()
'';
}
{
plugin = editorconfig-vim;
config = ''let g:EditorConfig_exclude_patterns = ["fugitive://.\*"]'';
}
coc-rust-analyzer
coc-git
coc-python
coc-clangd
coc-tsserver
coc-omnisharp
coc-json
coc-yaml
coc-html
coc-vimlsp
{
plugin = Coqtail;
config = ''
augroup CoqtailHighlights
autocmd!
autocmd ColorScheme *
\ hi def CoqtailChecked guibg=DarkGreen guifg=White
\| hi def CoqtailSent guibg=DarkBlue guifg=White
augroup END
augroup CoqtailEnable
autocmd FileType *.v CoqStart
augroup END
'';
# config = ''
# augroup CoqtailHighlights
# autocmd!
# autocmd ColorScheme *
# \ hi def CoqtailChecked ctermbg = 4
# \| hi def CoqtailSent ctermbg=7
# augroup END'';
}
];
extraPackages = with pkgs; [ fzf ];
extraPython3Packages = ps: with ps; [ /* python-language-server */ ];
};
home.file.".ideavimrc".text = ''
set clipboard=ideaput
set command
set easymotion
set highlightedyank
set surround
'';
xdg.configFile."kitty/kitty.conf".text =
let theme = builtins.fetchurl {
url = "https://raw.githubusercontent.com/kdrag0n/base16-kitty/master/colors/base16-material-darker.conf";
sha256 = "sha256:01rmlpgclvhimr92f0v95301dz73iakgr61zcifcia6054yj12fd";
}; in ''
font_family JetBrains Mono
font_size 10
adjust_line_height 130%
disable_ligatures cursor
enable_audio_bell no
visual_bell_duration 0.1
window_margin_width 8
tab_bar_style powerline
include ${theme}
'';
xdg.configFile."nvim/coc-settings.json".text = builtins.toJSON {
languageserver = {
haskell = {
command = "haskell-language-server-wrapper";
filetypes = [ "hs" "lhs" "haskell" ];
rootPatterns = [ "stack.yml" "cabal.config" "package.yaml" ];
initializationOptions = {
languageServerHaskell = {
hlintOn = true;
};
};
};
nix = {
command = "rnix-lsp";
filetypes = [ "nix" ];
};
python = {
command = "python-language-server";
filetypes = [ "py" ];
rootPatterns = [ "pyproject.toml" "setup.py" "setup.cfg" ];
};
ocaml = { command = "ocamllsp"; filetypes = [ "ml" "ocaml" ]; rootPatterns = [ "dune-project" "dune-workspace" ".git" ]; };
zig = {
command = "zls";
filetypes = [ "zig" ];
rootPatterns = [ "builg.zig" ];
};
};
"eslint.format.enable" = true;
"rust-analyzer.server.path" = "${pkgs.rust-analyzer}/bin/rust-analyzer";
"rust-analyzer.procMacro.enable" = true;
"rust-analyzer.cargo.loadOutDirsFromCheck" = true;
};
# // (
# flatten {
# rust-analyzer = {
# # path = "${pkgs.rust-analyzer}/bin/rust-analyzer";
# path = "rust-analyzer";
# procMacro.enable = true;
# cargo.loadOutDirsFromCheck = true;
# };
# }
# );
}
{ pkgs ? import <nixpkgs> {} }:
let
githubVimPlugin = { repo, rev ? "master", sha256 ? "", owner, config ? "", dependencies ? [] }:
{
plugin = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = repo;
version = rev;
src = pkgs.fetchFromGitHub {
inherit owner repo rev sha256;
};
inherit dependencies;
};
inherit config;
};
in
with pkgs; {
vscode-extensions = pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
publisher = "maximedenes";
name = "vscoq";
version = "0.3.2";
sha256 = "sha256-a6URVRu4A3C7zH5Xy2eoyxi358vCGTBhl2LBvtVXpcw=";
}
{
publisher = "equinusocio";
name = "vsc-material-theme";
version = "33.1.2";
sha256 = "sha256-RBhv7EKSvsYkeCkTDU3wETYf4sc4PuZUp2BmBmsHq5E=";
}
{
publisher = "julialang";
name = "language-julia";
version = "1.1.25";
sha256 = "sha256-mb10vEclVhGY+eMpkkpVWRxJxKWpFTlXmp8Te+T4mJY=";
}
/* {
publisher = "llvm-vs-code-extensions";
name = "vscode-clangd";
version = "4.5";
} */
];
vim-plugins = builtins.map githubVimPlugin [
{
repo = "vim-auto-save";
owner = "907th";
sha256 = "sha256:0dj45g56n0q4advc9sgch11ghb2h5ahk601gndwy02a0937axjh2";
config = ''
let g:auto_save = 1
" let g:auto_save_events = ["InsertLeave"]
'';
}
{ repo = "coc-omnisharp"; owner = "coc-extensions"; sha256 = "sha256-ADlvOZX4q6tcUAV5NPoQyNmBlrUGjPkI2ohNcAjsAEQ="; }
# { repo = "scvim"; owner = "supercollider"; sha256 = "sha256-0uqEQroKU6rLJ/sEA4y3Jju1QQlLQ6ODmSHSwWbOwfI="; }
/* {
repo = "vim-tidal";
owner = "tidalcycles";
sha256 = "sha256-zR3DQU3PpfTEz2rXOaOHd2Q2T7V8KQpiiAod0tECSlw=";
config = ''
let g:tidal_target = "terminal"
'';
} */
{ owner = "gmoe"; repo = "vim-faust"; rev = "main"; sha256 = "sha256-hK2ZoZCKR3oeqXhq7FgoAY8/S/+dCMUMwncHYbHxq/w="; }
];
zsh-plugins = [
{
name = "zsh-256color";
file = "zsh-256color.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "chrissicool";
repo = "zsh-256color";
rev = "ae40a49ccfc7520d2d7b575aaea160ff876fe3dc";
sha256 = "0c2yzbd4y0fyn9yycrxh32am27r0df0x3r526gf1pmyqiv49rg5z";
};
}
/* {
name = "fast-syntax-highlighting";
file = "fast-syntax-highlighting.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "zdharma";
repo = "fast-syntax-highlighting";
rev = "5fab542516579bdea5cc8b94137d9d85a0c3fda5";
sha256 = "1ff1z2snbl9rx3mrcjbamlvc21fh9l32zi2hh9vcgcwbjwn5kikg";
};
}
{
name = "bullet-train";
src = builtins.fetchTarball {
url = "https://github.com/caiogondim/bullet-train.zsh/archive/master.tar.gz";
};
file = "bullet-train.zsh-theme";
} */
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment