add vscode

also misc. formatting cleanup, groundwork for machine-specific
environments
This commit is contained in:
John Bowdre 2023-07-23 16:09:58 -05:00
parent 38cad0c658
commit f99d6f8412
6 changed files with 137 additions and 67 deletions

View file

@ -1,26 +1,29 @@
{ {
description = "A Very Flakey Home Manager"; description = "A Very Flakey Home Manager";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
}; };
outputs = {nixpkgs, home-manager, ...}: outputs = {nixpkgs, home-manager, ...}:
let let
system = "x86_64-linux"; system = "x86_64-linux";
in { in {
defaultPackage.${system} = home-manager.defaultPackage.${system}; defaultPackage.${system} = home-manager.defaultPackage.${system};
homeConfigurations = { homeConfigurations = {
"john" = home-manager.lib.homeManagerConfiguration { "john@penguin" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs { system = "${system}"; }; pkgs = import nixpkgs {
system = "${system}";
config.allowUnfree = true;
};
modules = [ ./nix/common/home.nix ]; modules = [ ./nix/machines/penguin/home.nix ];
}; };
}; };
}; };
} }

View file

@ -8,7 +8,6 @@
home.homeDirectory = "/home/john"; home.homeDirectory = "/home/john";
home.stateVersion = "23.05"; # Please read the comment before changing. home.stateVersion = "23.05"; # Please read the comment before changing.
programs.home-manager.enable = true; programs.home-manager.enable = true;
nixpkgs.config.allowUnfree = true;
targets.genericLinux.enable = true; targets.genericLinux.enable = true;
# home files # home files
@ -17,7 +16,6 @@
# # the Nix store. Activating the configuration will then make '~/.screenrc' a # # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy. # # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc; # ".screenrc".source = dotfiles/screenrc;
# ".vimrc".source = .dotfiles/vim/.vimrc;
# # You can also set the file content immediately. # # You can also set the file content immediately.
# ".gradle/gradle.properties".text = '' # ".gradle/gradle.properties".text = ''
@ -39,6 +37,7 @@
hugo hugo
libvirt libvirt
packer packer
powershell
terraform terraform
tldr tldr
vagrant vagrant
@ -74,8 +73,8 @@
userEmail = "john@bowdre.net"; userEmail = "john@bowdre.net";
userName = "John Bowdre"; userName = "John Bowdre";
extraConfig = { extraConfig = {
pull.ff = "only";
init.defaultBranch = "main"; init.defaultBranch = "main";
pull.ff = "only";
}; };
}; };

View file

@ -3,10 +3,10 @@
enable = true; enable = true;
baseIndex = 1; baseIndex = 1;
clock24 = true; clock24 = true;
mouse = true; escapeTime = 50;
historyLimit = 100000; historyLimit = 100000;
keyMode = "vi"; keyMode = "vi";
escapeTime = 50; mouse = true;
plugins = with pkgs.tmuxPlugins; [ ]; plugins = with pkgs.tmuxPlugins; [ ];
extraConfig = '' extraConfig = ''
# navigating panes with Ctrl+{hjkl} # navigating panes with Ctrl+{hjkl}

View file

@ -10,56 +10,56 @@
tabstop = 2; tabstop = 2;
}; };
plugins = with pkgs.vimPlugins; [ plugins = with pkgs.vimPlugins; [
vim-trailing-whitespace
nerdcommenter nerdcommenter
vim-go vim-go
vim-sensible vim-sensible
vim-trailing-whitespace
]; ];
extraConfig = '' extraConfig = ''
" Tmux integration to switch panes with Ctrl+{hkjl} " Tmux integration to switch panes with Ctrl+{hkjl}
if exists('$TMUX') if exists('$TMUX')
function! TmuxOrSplitSwitch(wincmd, tmuxdir) function! TmuxOrSplitSwitch(wincmd, tmuxdir)
let previous_winnr = winnr() let previous_winnr = winnr()
silent! execute "wincmd " . a:wincmd silent! execute "wincmd " . a:wincmd
if previous_winnr == winnr() if previous_winnr == winnr()
call system("tmux select-pane -" . a:tmuxdir) call system("tmux select-pane -" . a:tmuxdir)
redraw! redraw!
endif endif
endfunction endfunction
let previous_title = substitute(system("tmux display-message -p '#{pane_title}'"), '\n', "", "") let previous_title = substitute(system("tmux display-message -p '#{pane_title}'"), '\n', "", "")
let &t_ti = "\<Esc>2;vim\<Esc>\\" . &t_ti let &t_ti = "\<Esc>2;vim\<Esc>\\" . &t_ti
let &t_te = "\<Esc>2;". previous_title . "\<Esc>\\" . &t_te let &t_te = "\<Esc>2;". previous_title . "\<Esc>\\" . &t_te
nnoremap <silent> <C-h> :call TmuxOrSplitSwitch('h', 'L')<cr> nnoremap <silent> <C-h> :call TmuxOrSplitSwitch('h', 'L')<cr>
nnoremap <silent> <C-j> :call TmuxOrSplitSwitch('j', 'D')<cr> nnoremap <silent> <C-j> :call TmuxOrSplitSwitch('j', 'D')<cr>
nnoremap <silent> <C-k> :call TmuxOrSplitSwitch('k', 'U')<cr> nnoremap <silent> <C-k> :call TmuxOrSplitSwitch('k', 'U')<cr>
nnoremap <silent> <C-l> :call TmuxOrSplitSwitch('l', 'R')<cr> nnoremap <silent> <C-l> :call TmuxOrSplitSwitch('l', 'R')<cr>
else else
map <C-h> <C-w>h map <C-h> <C-w>h
map <C-j> <C-w>j map <C-j> <C-w>j
map <C-k> <C-w>k map <C-k> <C-w>k
map <C-l> <C-w>l map <C-l> <C-w>l
endif endif
" coding preference " coding preference
filetype off filetype off
filetype plugin indent on filetype plugin indent on
syntax on syntax on
set backspace=indent,eol,start set backspace=indent,eol,start
set noautoindent set noautoindent
set noswapfile set noswapfile
set ruler set ruler
set showmatch set showmatch
set smarttab set smarttab
set sts=2 set sts=2
let g:NERDSpaceDelims=1 let g:NERDSpaceDelims=1
let mapleader="," let mapleader=","
if has("autocmd") if has("autocmd")
autocmd FileType go set ts=2 sw=2 sts=2 noet nolist autowrite autocmd FileType go set ts=2 sw=2 sts=2 noet nolist autowrite
endif endif
''; '';
}; };
} }

55
nix/lib/vscode.nix Normal file
View file

@ -0,0 +1,55 @@
{ pkgs, lib, ...}: {
programs.vscode = {
enable = true;
enableExtensionUpdateCheck = false;
enableUpdateCheck = false;
extensions = with pkgs.vscode-extensions; [
bbenoist.nix
eamodio.gitlens
github.copilot
golang.go
hashicorp.terraform
ms-kubernetes-tools.vscode-kubernetes-tools
ms-vscode-remote.remote-ssh
ms-vscode.powershell
redhat.vscode-yaml
timonwong.shellcheck
vscodevim.vim
yzhang.markdown-all-in-one
];
userSettings = {
"diffEditor.ignoreTrimWhitespace" = false;
"editor.acceptSuggestionOnCommitCharacter" = false;
"editor.acceptSuggestionOnEnter" = "off";
"editor.lineNumbers" = "relative";
"editor.renderControlCharacters" = true;
"editor.renderWhitespace" = "boundary";
"editor.tabCompletion" = "off";
"editor.tabSize" = 2;
"explorer.confirmDragAndDrop" = false;
"files.hotExit" = "onExitAndWindowClose";
"git.confirmSync" = false;
"git.ignoreLegacyWarning" = true;
"powershell.codeFormatting.useCorrectCasing" = true;
"security.workspace.trust.untrustedFiles" = "open";
"vim.statusBarColorControl" = true;
"vim.useCtrlKeys" = false;
"window.restoreWindows" = "all";
"workbench.startupEditor" = "none";
"workbench.colorCustomizations" = {
"statusBar.background" = "#005f5f";
"statusBar.debuggingBackground" = "#005f5f";
"statusBar.noFolderBackground" = "#005f5f";
};
"vim.normalModeKeyBindings" = [
{
"after" = ["@q"];
"before" = ["Q"];
}
];
};
};
services.gnome-keyring.enable = true;
}

View file

@ -0,0 +1,13 @@
{ pkgs, lib, config, ... }: {
imports = [
../../common/home.nix
../../lib/vscode.nix
];
# packages
home.packages = with pkgs; [
firefox-esr
obsidian
qFlipper
];
}